mirror of
https://codeberg.org/icewind/ugc-scaper.git
synced 2026-06-03 18:24:10 +02:00
more reliable steamid selector
This commit is contained in:
parent
39d74de097
commit
edf357511e
1 changed files with 5 additions and 3 deletions
|
|
@ -9,7 +9,7 @@ use steamid_ng::SteamID;
|
||||||
use time::Date;
|
use time::Date;
|
||||||
|
|
||||||
const SELECTOR_PLAYER_NAME: &str = ".container .col-md-4 > h3 > b";
|
const SELECTOR_PLAYER_NAME: &str = ".container .col-md-4 > h3 > b";
|
||||||
const SELECTOR_PLAYER_ID: &str = ".container .col-md-4 > p.nomargin";
|
const SELECTOR_PLAYER_ID: &str = r#"a[href*="steam://friends/add"]"#;
|
||||||
|
|
||||||
const SELECTOR_PLAYER_HONORS_GROUP: &str =
|
const SELECTOR_PLAYER_HONORS_GROUP: &str =
|
||||||
".container .col-md-6:nth-child(2) .white-row-small .row-fluid";
|
".container .col-md-6:nth-child(2) .white-row-small .row-fluid";
|
||||||
|
|
@ -100,7 +100,9 @@ impl Parser for PlayerParser {
|
||||||
selector: SELECTOR_PLAYER_ID,
|
selector: SELECTOR_PLAYER_ID,
|
||||||
role: "player steam id",
|
role: "player steam id",
|
||||||
})?
|
})?
|
||||||
.nth_text(3)
|
.attr("href")
|
||||||
|
.unwrap_or_default()
|
||||||
|
.strip_prefix("steam://friends/add/")
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
|
|
@ -226,7 +228,7 @@ impl Parser for PlayerParser {
|
||||||
Ok(Player {
|
Ok(Player {
|
||||||
name,
|
name,
|
||||||
avatar,
|
avatar,
|
||||||
steam_id: SteamID::from_steam3(&id).unwrap_or_default(),
|
steam_id: SteamID::try_from(id.as_str()).unwrap_or_default(),
|
||||||
honors,
|
honors,
|
||||||
teams,
|
teams,
|
||||||
favorite_classes,
|
favorite_classes,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue