mirror of
https://codeberg.org/icewind/ugc-scaper.git
synced 2026-06-03 10:14:11 +02:00
guess region from format
This commit is contained in:
parent
cf17647408
commit
a46314d91a
1 changed files with 9 additions and 2 deletions
|
|
@ -151,11 +151,12 @@ impl Parser for TeamParser {
|
|||
.map(String::from)
|
||||
});
|
||||
|
||||
let format = select_text(root, &self.selector_team_format)
|
||||
let format_text = select_text(root, &self.selector_team_format)
|
||||
.ok_or(ParseError::ElementNotFound {
|
||||
selector: SELECTOR_TEAM_FORMAT,
|
||||
role: "team format",
|
||||
})?
|
||||
})?;
|
||||
let format = format_text
|
||||
.parse::<GameMode>()
|
||||
.map_err(|e| ParseError::InvalidText {
|
||||
text: e.text,
|
||||
|
|
@ -191,6 +192,12 @@ impl Parser for TeamParser {
|
|||
}
|
||||
}
|
||||
|
||||
if region.is_none() {
|
||||
region = format_text
|
||||
.split(' ')
|
||||
.find_map(|part| Region::from_str(part).ok());
|
||||
}
|
||||
|
||||
let description = select_text(root, &self.selector_team_description)
|
||||
.unwrap_or_default()
|
||||
.replace('\n', " ");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue