mirror of
https://codeberg.org/icewind/ugc-scaper.git
synced 2026-06-03 18:24:10 +02:00
add steam group for teams
This commit is contained in:
parent
9a2615d046
commit
e0c56056a4
7 changed files with 16 additions and 0 deletions
|
|
@ -91,6 +91,7 @@ pub struct Team {
|
|||
pub image: String,
|
||||
pub format: String,
|
||||
pub timezone: Option<String>,
|
||||
pub steam_group: Option<String>,
|
||||
pub division: String,
|
||||
pub description: String,
|
||||
pub titles: Vec<String>,
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ const SELECTOR_TEAM_NAME_TO_TAG: &str = "td:nth-child(3) small";
|
|||
const SELECTOR_TEAM_NAME_TO_NAME: &str = "td:nth-child(4) small";
|
||||
const SELECTOR_TEAM_NAME_DATE: &str = "td:nth-child(5) small";
|
||||
|
||||
const SELECTOR_STEAM: &str = r#"a.btn.btn-xs.btn-default[href*="//steamcommunity.com/groups"]"#;
|
||||
|
||||
pub struct TeamParser {
|
||||
selector_name: Selector,
|
||||
selector_tag: Selector,
|
||||
|
|
@ -48,6 +50,7 @@ pub struct TeamParser {
|
|||
selector_team_timezone: Selector,
|
||||
selector_team_description: Selector,
|
||||
selector_team_titles: Selector,
|
||||
selector_steam_group: Selector,
|
||||
|
||||
selector_team_member_row: Selector,
|
||||
selector_team_member_link: Selector,
|
||||
|
|
@ -85,6 +88,7 @@ impl TeamParser {
|
|||
selector_team_timezone: Selector::parse(SELECTOR_TEAM_TIMEZONE).unwrap(),
|
||||
selector_team_description: Selector::parse(SELECTOR_TEAM_DESCRIPTION).unwrap(),
|
||||
selector_team_titles: Selector::parse(SELECTOR_TEAM_TITLES).unwrap(),
|
||||
selector_steam_group: Selector::parse(SELECTOR_STEAM).unwrap(),
|
||||
|
||||
selector_team_member_row: Selector::parse(SELECTOR_TEAM_MEMBER_ROW).unwrap(),
|
||||
selector_team_member_link: Selector::parse(SELECTOR_TEAM_MEMBER_LINK).unwrap(),
|
||||
|
|
@ -147,6 +151,11 @@ impl Parser for TeamParser {
|
|||
})?
|
||||
.to_string();
|
||||
|
||||
let steam_group = root
|
||||
.select(&self.selector_steam_group)
|
||||
.next()
|
||||
.and_then(|link| link.attr("href").map(String::from));
|
||||
|
||||
let division = select_text(root, &self.selector_team_division)
|
||||
.ok_or(ParseError::ElementNotFound {
|
||||
selector: SELECTOR_TEAM_DIVISION,
|
||||
|
|
@ -330,6 +339,7 @@ impl Parser for TeamParser {
|
|||
division,
|
||||
timezone,
|
||||
format,
|
||||
steam_group,
|
||||
image,
|
||||
tag,
|
||||
titles,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ expression: parsed
|
|||
"image": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/f7/f75809d7774c917be9883370d772d3099bfe457d_full.jpg",
|
||||
"format": "TF2 Highlander",
|
||||
"timezone": "West-Euro",
|
||||
"steam_group": "http://steamcommunity.com/groups/Melintongpotsss",
|
||||
"division": "Euro Platinum",
|
||||
"description": "",
|
||||
"titles": [],
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ expression: parsed
|
|||
"image": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/09/096a30b1025c586f9d41c686077129f6e86998d0_full.jpg",
|
||||
"format": "TF2 6vs6",
|
||||
"timezone": "West-Euro",
|
||||
"steam_group": null,
|
||||
"division": "Europe",
|
||||
"description": "Giel is Jesus",
|
||||
"titles": [
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ expression: parsed
|
|||
"image": "clan_avatars/32437_thumbnail.jpg",
|
||||
"format": "TF2 Highlander",
|
||||
"timezone": null,
|
||||
"steam_group": "http://https://steamcommunity.com/groups/xyxxx-",
|
||||
"division": "North America",
|
||||
"description": "",
|
||||
"titles": [
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ expression: parsed
|
|||
"image": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/db/dbabbd8bab7ccf6d27a9d4ca2e73a76e085bb201_full.jpg",
|
||||
"format": "TF2 Highlander",
|
||||
"timezone": "West-Euro",
|
||||
"steam_group": "http://https://steamcommunity.com/groups/XenonxTF2",
|
||||
"division": "Euro Platinum",
|
||||
"description": "Contact Kimo or Icewind for everything.",
|
||||
"titles": [
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ expression: parsed
|
|||
"image": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/d7/d71ff4e1e2635c3d7c1be8d96bc40b499c665aad_full.jpg",
|
||||
"format": "TF2 Highlander",
|
||||
"timezone": null,
|
||||
"steam_group": "http://steamcommunity.com/groups/BARNEYANDTHEGANKS",
|
||||
"division": "NA Platinum",
|
||||
"description": "",
|
||||
"titles": [],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue