mirror of
https://codeberg.org/icewind/ugc-scaper.git
synced 2026-06-03 10:14:11 +02:00
handle roster history without steam group
This commit is contained in:
parent
22366e957f
commit
c81cc2f717
5 changed files with 2460 additions and 10 deletions
|
|
@ -172,7 +172,7 @@ pub struct Record {
|
|||
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
|
||||
#[non_exhaustive]
|
||||
pub struct TeamRosterData {
|
||||
pub steam_group: String,
|
||||
pub steam_group: Option<String>,
|
||||
pub history: Vec<RosterHistory>,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,16 +49,10 @@ impl Parser for TeamRosterHistoryParser {
|
|||
fn parse(&self, document: &str) -> Result<Self::Output> {
|
||||
let document = Html::parse_document(document);
|
||||
|
||||
let steam_group = document.select(&self.selector_steam_group).next().ok_or(
|
||||
ParseError::ElementNotFound {
|
||||
selector: SELECTOR_STEAM,
|
||||
role: "team steam group",
|
||||
},
|
||||
)?;
|
||||
let steam_group = document.select(&self.selector_steam_group).next();
|
||||
let steam_group = steam_group
|
||||
.attr("href")
|
||||
.unwrap_or_default()
|
||||
.replace("http://http", "http");
|
||||
.and_then(|link| link.attr("href"))
|
||||
.map(|href| href.replace("http://http", "http"));
|
||||
|
||||
let history = document
|
||||
.select(&self.selector_item)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue