This commit is contained in:
parent
4651f3bc02
commit
8f0af3e76b
2 changed files with 30 additions and 27 deletions
|
@ -199,7 +199,7 @@ impl DataSource for CGGDataSource {
|
|||
}
|
||||
}
|
||||
|
||||
let stat = champs_stats.get(&key).unwrap();
|
||||
if let Some(stat) = champs_stats.get(&key) {
|
||||
data.push((
|
||||
position.to_owned(),
|
||||
blocks,
|
||||
|
@ -212,6 +212,7 @@ impl DataSource for CGGDataSource {
|
|||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
data
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,13 +61,15 @@ impl DataSource for PBDataSource {
|
|||
) -> Vec<(String, Vec<Value>, Stat)> {
|
||||
let mut builds = vec![];
|
||||
|
||||
let page = client
|
||||
let rep = client
|
||||
.get(format!("https://www.probuilds.net/ajax/games?limit=1&sort=gameDate-desc&championId={}&olderThan=0&lane=®ion=", champ.key).as_str())
|
||||
.set("Accept", "application/json")
|
||||
.call().unwrap().into_string().unwrap();
|
||||
.call();
|
||||
|
||||
if let Ok(page) = rep {
|
||||
let str = page.into_string().unwrap();
|
||||
let mut items = vec![];
|
||||
let mut build = &page[page.find("'items'").unwrap()..];
|
||||
let mut build = &str[str.find("'items'").unwrap()..];
|
||||
while build.contains("items") {
|
||||
let pos = build.find("data-id=").unwrap();
|
||||
build = &build[pos + 10..];
|
||||
|
@ -80,7 +82,7 @@ impl DataSource for PBDataSource {
|
|||
"items": items.iter().map(|x| json!({"id": x.to_string(), "count": 1})).collect::<Vec<Value>>(),
|
||||
"type": "Set"
|
||||
})], Stat{win_rate:0.0,games:1,kda:0.0,patch:"".to_string()}));
|
||||
|
||||
}
|
||||
builds
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue