mirror of
https://codeberg.org/icewind/ugc-scaper.git
synced 2026-06-03 10:14:11 +02:00
more region parsing
This commit is contained in:
parent
ddbac7dc79
commit
335c75cb12
6 changed files with 4268 additions and 5 deletions
8
api-server/Cargo.lock
generated
8
api-server/Cargo.lock
generated
|
|
@ -412,9 +412,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "h2"
|
name = "h2"
|
||||||
version = "0.4.8"
|
version = "0.4.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5017294ff4bb30944501348f6f8e42e6ad28f42c8bbef7a74029aff064a4e3c2"
|
checksum = "75249d144030531f8dee69fe9cea04d3edf809a017ae445e2abdff6629e86633"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atomic-waker",
|
"atomic-waker",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
|
@ -1964,7 +1964,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ugc-scraper"
|
name = "ugc-scraper"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
source = "git+https://github.com/icewind1991/ugc-scaper#59b742dee15a9fe16d8d816f23e5433933a1851c"
|
source = "git+https://github.com/icewind1991/ugc-scaper#f79c02a010ee5ec572901b4eb5b14067b5ab45a9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"regex",
|
"regex",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
|
@ -1979,7 +1979,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ugc-scraper-types"
|
name = "ugc-scraper-types"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/icewind1991/ugc-scaper#59b742dee15a9fe16d8d816f23e5433933a1851c"
|
source = "git+https://github.com/icewind1991/ugc-scaper#f79c02a010ee5ec572901b4eb5b14067b5ab45a9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"steamid-ng",
|
"steamid-ng",
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ rustPlatform.buildRustPackage rec {
|
||||||
cargoLock = {
|
cargoLock = {
|
||||||
lockFile = ./api-server/Cargo.lock;
|
lockFile = ./api-server/Cargo.lock;
|
||||||
outputHashes = {
|
outputHashes = {
|
||||||
"ugc-scraper-0.5.0" = "sha256-xuvuhNLKCgI/wPhMXPxBlgZGdkn6qnpxCV17TCNg/xM=";
|
"ugc-scraper-0.5.0" = "sha256-akmSE/AwxsBhF+SiUQWV2oTzlNi4s61AztGShYMohr4=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4042
tests/data/team_10763.html
Normal file
4042
tests/data/team_10763.html
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -35,6 +35,7 @@ fn test_parse_player_details_html(input: &str, name: &str) {
|
||||||
#[test_case("team_6929.html", "team_changed_name")]
|
#[test_case("team_6929.html", "team_changed_name")]
|
||||||
#[test_case("team_32437.html", "team_empty_name_change")]
|
#[test_case("team_32437.html", "team_empty_name_change")]
|
||||||
#[test_case("team_29228.html", "team_newlines_join_date")]
|
#[test_case("team_29228.html", "team_newlines_join_date")]
|
||||||
|
#[test_case("team_10763.html", "team_na_4v4")]
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
fn test_parse_team_html(input: &str, name: &str) {
|
fn test_parse_team_html(input: &str, name: &str) {
|
||||||
let body = read_to_string(format!("tests/data/{input}")).unwrap();
|
let body = read_to_string(format!("tests/data/{input}")).unwrap();
|
||||||
|
|
|
||||||
219
tests/snapshots/snapshot__parse_team_na_4v4_html.snap
Normal file
219
tests/snapshots/snapshot__parse_team_na_4v4_html.snap
Normal file
|
|
@ -0,0 +1,219 @@
|
||||||
|
---
|
||||||
|
source: tests/snapshot.rs
|
||||||
|
expression: parsed
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"name": "Banananana Boat",
|
||||||
|
"tag": "-BB-",
|
||||||
|
"image": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/4c/4c75e24cd642d648ae3105fc9e66580e6064e393_full.jpg",
|
||||||
|
"format": "4v4",
|
||||||
|
"region": "NorthAmerica",
|
||||||
|
"timezone": "East",
|
||||||
|
"steam_group": "http://steamcommunity.com/groups/banananana_boat",
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"description": "",
|
||||||
|
"titles": [
|
||||||
|
"TF2 4v4 NA Steel Runner-up Season 2",
|
||||||
|
"TF2 4v4 NA Silver 3rd Place Season 4",
|
||||||
|
"TF2 4v4 NA Gold Champions Season 8",
|
||||||
|
"TF2 4v4 NA Gold Runner-up Season 10",
|
||||||
|
"TF2 4v4 NA Gold Champions Season 11",
|
||||||
|
"TF2 4v4 NA Gold Runner-up Season 12",
|
||||||
|
"TF2 4v4 NA Gold 3rd Place Season 13",
|
||||||
|
"TF2 4v4 NA Gold Champions Season 14",
|
||||||
|
"TF2 4v4 NA Gold Runner-Up Season 15",
|
||||||
|
"TF2 4v4 NA Gold Champions Season 16",
|
||||||
|
"TF2 4v4 NA Gold Runner-Up Season 17",
|
||||||
|
"TF2 4v4 NA Gold Champions Season 18",
|
||||||
|
"TF2 4v4 NA Gold Champions Season 19",
|
||||||
|
"TF2 4v4 NA Gold Champions Season 20",
|
||||||
|
"TF2 4v4 NA Gold Champions Season 21",
|
||||||
|
"TF2 4v4 NA Gold Champions Season 22",
|
||||||
|
"TF2 4v4 NA 2nd Place Season 23"
|
||||||
|
],
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"name": "Bonesaw",
|
||||||
|
"steam_id": "76561198008087350",
|
||||||
|
"role": "Leader",
|
||||||
|
"since": "+002014-04-17T11:16:00.000000000-05:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ether",
|
||||||
|
"steam_id": "76561198064711665",
|
||||||
|
"role": "Member",
|
||||||
|
"since": "+002019-11-22T05:40:00.000000000-05:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "eerie",
|
||||||
|
"steam_id": "76561198044268201",
|
||||||
|
"role": "Member",
|
||||||
|
"since": "+002020-06-13T12:11:00.000000000-05:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "bug",
|
||||||
|
"steam_id": "76561198078731479",
|
||||||
|
"role": "Member",
|
||||||
|
"since": "+002020-10-09T07:29:00.000000000-05:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "blank",
|
||||||
|
"steam_id": "76561198105529673",
|
||||||
|
"role": "Member",
|
||||||
|
"since": "+002021-10-22T08:07:00.000000000-05:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "JohhnyFromCali 7",
|
||||||
|
"steam_id": "76561198044015725",
|
||||||
|
"role": "Member",
|
||||||
|
"since": "+002021-11-19T09:13:00.000000000-05:00"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"results": [
|
||||||
|
{
|
||||||
|
"season": 29,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 0,
|
||||||
|
"losses": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 24,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 6,
|
||||||
|
"losses": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 23,
|
||||||
|
"division": "North America",
|
||||||
|
"wins": 8,
|
||||||
|
"losses": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 22,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 10,
|
||||||
|
"losses": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 21,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 7,
|
||||||
|
"losses": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 20,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 10,
|
||||||
|
"losses": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 19,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 10,
|
||||||
|
"losses": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 18,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 10,
|
||||||
|
"losses": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 17,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 10,
|
||||||
|
"losses": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 16,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 11,
|
||||||
|
"losses": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 15,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 10,
|
||||||
|
"losses": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 14,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 10,
|
||||||
|
"losses": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 13,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 9,
|
||||||
|
"losses": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 12,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 7,
|
||||||
|
"losses": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 11,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 11,
|
||||||
|
"losses": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 10,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 9,
|
||||||
|
"losses": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 9,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 7,
|
||||||
|
"losses": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 8,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 12,
|
||||||
|
"losses": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 7,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 4,
|
||||||
|
"losses": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 6,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 4,
|
||||||
|
"losses": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 5,
|
||||||
|
"division": "Gold N.Amer",
|
||||||
|
"wins": 4,
|
||||||
|
"losses": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 4,
|
||||||
|
"division": "Silver N.Amer",
|
||||||
|
"wins": 9,
|
||||||
|
"losses": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 3,
|
||||||
|
"division": "Silver N.Amer",
|
||||||
|
"wins": 4,
|
||||||
|
"losses": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"season": 2,
|
||||||
|
"division": "Steel N.Amer",
|
||||||
|
"wins": 8,
|
||||||
|
"losses": 4
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name_changes": []
|
||||||
|
}
|
||||||
|
|
@ -378,6 +378,7 @@ impl FromStr for Region {
|
||||||
"ASIA" => Ok(Region::Asia),
|
"ASIA" => Ok(Region::Asia),
|
||||||
"NA" => Ok(Region::NorthAmerica),
|
"NA" => Ok(Region::NorthAmerica),
|
||||||
"North America" => Ok(Region::NorthAmerica),
|
"North America" => Ok(Region::NorthAmerica),
|
||||||
|
"N.Amer" => Ok(Region::NorthAmerica),
|
||||||
"South American" => Ok(Region::SouthAmerica),
|
"South American" => Ok(Region::SouthAmerica),
|
||||||
"SA" => Ok(Region::SouthAmerica),
|
"SA" => Ok(Region::SouthAmerica),
|
||||||
"AUS" => Ok(Region::Australia),
|
"AUS" => Ok(Region::Australia),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue