Get event name from the document <body> rather than <title>

This commit is contained in:
Clarence Chan committed 2024-05-28 12:49:29 -04:00
1 parent 8bfa77d76d
commit bd0e29b4e4
1 file changed
+8 -1
+8 -1
View File
@@ -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");