mirror of
https://github.com/clarencechaan/ufc-cal.git
synced 2026-10-19 00:38:30 -07:00
Get event name from the document <body> rather than <title>
This commit is contained in:
1 parent
8bfa77d76d
commit
bd0e29b4e4
1 file changed
+8
-1
@@ -42,7 +42,14 @@ async function getDetailsFromEventLink(url) {
|
|||||||
const root = parse(text);
|
const root = parse(text);
|
||||||
|
|
||||||
// Extract basic details of the event from the DOM object
|
// Extract basic details of the event from the DOM object
|
||||||
let name = root.querySelector("title").innerText.replace(" | UFC", "");
|
let headlinePrefix = root
|
||||||
|
.querySelector(".c-hero__headline-prefix")
|
||||||
|
.innerText.trim();
|
||||||
|
let headline = root
|
||||||
|
.querySelector(".c-hero__headline")
|
||||||
|
.innerText.replace(/\s\s+/g, " ")
|
||||||
|
.trim();
|
||||||
|
let name = `${headlinePrefix}: ${headline}`;
|
||||||
let date = root
|
let date = root
|
||||||
.querySelector(".c-hero__headline-suffix")
|
.querySelector(".c-hero__headline-suffix")
|
||||||
.getAttribute("data-timestamp");
|
.getAttribute("data-timestamp");
|
||||||
|
|||||||
Reference in new issue
Block a user