Continue scrape when a fight list item's formatting is broken on the UFC event page

This commit is contained in:
Clarence Chan committed 2023-09-28 11:51:13 -04:00
1 parent b6e2be62f7
commit 065ea870da
1 file changed
+9 -1
+9 -1
View File
@@ -37,7 +37,15 @@ async function getDetailsFromEventLink(url) {
let prelims = [];
function convertLiToStr(li) {
let bout = li.querySelector(".c-listing-fight__class-text").innerText;
let bout = li.querySelector(".c-listing-fight__class-text")?.innerText;
if (!bout)
return (
"• " +
li
.querySelector(".field--name-node-title")
.innerText.trim()
.replace(" vs ", " vs. ")
);
if (bout.includes("Strawweight")) bout = "115";
else if (bout.includes("Flyweight")) bout = "125";
else if (bout.includes("Bantamweight")) bout = "135";