mirror of
https://github.com/clarencechaan/ufc-cal.git
synced 2026-10-19 00:38:30 -07:00
Continue scrape when a fight list item's formatting is broken on the UFC event page
This commit is contained in:
1 parent
b6e2be62f7
commit
065ea870da
1 file changed
+9
-1
@@ -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";
|
||||
|
||||
Reference in new issue
Block a user