Handle missing category_id in scraper

This commit is contained in:
Tyler Hallada 2022-01-18 17:03:22 -05:00
parent e7b5c750cd
commit f22587d4a0

View File

@ -100,13 +100,12 @@ impl ModListResponse {
.next() .next()
.expect("Missing category link for mod"); .expect("Missing category link for mod");
let category_id = match category_elem.value().attr("href") { let category_id = match category_elem.value().attr("href") {
Some(href) => Some( Some(href) => href
href.split("/") .split("/")
.nth(6) .nth(6)
.expect("Missing category id for mod") .expect("Missing category id for mod")
.parse::<i32>() .parse::<i32>()
.expect("Failed to parse category id"), .ok(),
),
None => None, None => None,
}; };
let category_name = category_elem.text().next(); let category_name = category_elem.text().next();
@ -147,7 +146,6 @@ impl ModListResponse {
.next() .next()
.expect("Missing last update text for mod") .expect("Missing last update text for mod")
.trim(); .trim();
dbg!(&first_upload_at);
let first_upload_at = NaiveDate::parse_from_str(first_upload_at, "%d %b %Y") let first_upload_at = NaiveDate::parse_from_str(first_upload_at, "%d %b %Y")
.expect("Cannot parse first upload date"); .expect("Cannot parse first upload date");
let last_update_date_text = right let last_update_date_text = right