This commit is contained in:
Robin Appelman 2023-11-21 20:26:04 +01:00
commit 4b11b636c7
4 changed files with 10 additions and 8 deletions

2
api-server/Cargo.lock generated
View file

@ -1743,6 +1743,8 @@ dependencies = [
[[package]] [[package]]
name = "ugc-scraper" name = "ugc-scraper"
version = "0.2.1" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11be22a2de36995a81b56450a26132bb8718296f60616e32487f59cd2cd49e12"
dependencies = [ dependencies = [
"reqwest", "reqwest",
"scraper", "scraper",

View file

@ -6,8 +6,8 @@ edition = "2021"
[dependencies] [dependencies]
tokio = { version = "1.34.0", features = ["macros", "rt-multi-thread", "rt"] } tokio = { version = "1.34.0", features = ["macros", "rt-multi-thread", "rt"] }
main_error = "0.1.2" main_error = "0.1.2"
ugc-scraper = { path = "../", version = "0.2.1" } #ugc-scraper = { path = "../", version = "0.2.1" }
#ugc-scraper = "0.2.1" ugc-scraper = "0.2.1"
axum = "0.6.20" axum = "0.6.20"
steamid-ng = "1.0.0" steamid-ng = "1.0.0"
thiserror = "1.0.50" thiserror = "1.0.50"

View file

@ -52,7 +52,7 @@ impl Parser for TeamLookupParser {
role: "team name", role: "team name",
selector: SELECTOR_OPTION, selector: SELECTOR_OPTION,
})?; })?;
let (_, name) = text.split_once("-").unwrap_or_default(); let (_, name) = text.split_once('-').unwrap_or_default();
let id = team_id_from_link(link)?; let id = team_id_from_link(link)?;
Ok(TeamRef { Ok(TeamRef {

View file

@ -157,7 +157,7 @@ impl Parser for TeamMatchesParser {
let (score, score_opponent) = let (score, score_opponent) =
scores scores
.split_once("-") .split_once('-')
.ok_or_else(|| ParseError::InvalidText { .ok_or_else(|| ParseError::InvalidText {
text: scores.to_string(), text: scores.to_string(),
role: "match scores", role: "match scores",
@ -187,8 +187,8 @@ impl Parser for TeamMatchesParser {
role: "match page link", role: "match page link",
})?, })?,
opponent, opponent,
score: score, score,
score_opponent: score_opponent, score_opponent,
match_points: point, match_points: point,
match_points_opponent: points_opponent, match_points_opponent: points_opponent,
} }
@ -199,8 +199,8 @@ impl Parser for TeamMatchesParser {
role: "match page link", role: "match page link",
})?, })?,
opponent, opponent,
score: score, score,
score_opponent: score_opponent, score_opponent,
}, },
_ => MatchResult::ByeWeek, _ => MatchResult::ByeWeek,
}; };