mirror of
https://codeberg.org/icewind/ugc-scaper.git
synced 2026-06-03 18:24:10 +02:00
fix non hl match page
This commit is contained in:
parent
94501b4d76
commit
bc9a4bffdd
5 changed files with 15 additions and 7 deletions
10
src/lib.rs
10
src/lib.rs
|
|
@ -41,8 +41,16 @@ impl Default for UgcClient {
|
|||
/// "API client" for ugc by scraping the website
|
||||
impl UgcClient {
|
||||
pub fn new() -> Self {
|
||||
let redirect_policy = Policy::custom(|attempt| {
|
||||
// the different matchpage_* redirect to each other if you use the match id from a different game mode
|
||||
if attempt.url().path().contains("matchpage_") {
|
||||
attempt.follow()
|
||||
} else {
|
||||
attempt.stop()
|
||||
}
|
||||
});
|
||||
UgcClient {
|
||||
client: Client::builder().redirect(Policy::none()).build().unwrap(),
|
||||
client: Client::builder().redirect(redirect_policy).build().unwrap(),
|
||||
player_parser: PlayerParser::new(),
|
||||
player_detail_parser: PlayerDetailsParser::new(),
|
||||
team_parser: TeamParser::new(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue