This commit is contained in:
parent
245e9c8628
commit
bdf6f97923
1 changed files with 11 additions and 14 deletions
|
@ -15,7 +15,7 @@ struct ChampionResponse {
|
|||
#[derive(Deserialize, Debug)]
|
||||
struct Champion {
|
||||
key: String,
|
||||
name: String
|
||||
name: String,
|
||||
}
|
||||
|
||||
impl DataSource for PBDataSource {
|
||||
|
@ -29,19 +29,18 @@ impl DataSource for PBDataSource {
|
|||
300
|
||||
}
|
||||
|
||||
fn get_champs_with_positions(
|
||||
&self,
|
||||
client: &ureq::Agent,
|
||||
) -> IndexMap<u32, Vec<String>> {
|
||||
fn get_champs_with_positions(&self, client: &ureq::Agent) -> IndexMap<u32, Vec<String>> {
|
||||
let mut champs = IndexMap::new();
|
||||
|
||||
let page = client
|
||||
.get("https://www.probuilds.net/ajax/championListNew")
|
||||
.set("Accept", "application/json")
|
||||
.call().unwrap().into_string().unwrap();
|
||||
.call()
|
||||
.unwrap()
|
||||
.into_string()
|
||||
.unwrap();
|
||||
|
||||
let data: ChampionResponse =
|
||||
serde_json::from_str(&page).unwrap();
|
||||
let data: ChampionResponse = serde_json::from_str(&page).unwrap();
|
||||
|
||||
for champ in data.champions {
|
||||
champs.insert(champ.key.parse::<u32>().unwrap(), vec!["ANY".to_owned()]);
|
||||
|
@ -56,7 +55,6 @@ impl DataSource for PBDataSource {
|
|||
positions: &[String],
|
||||
client: &ureq::Agent,
|
||||
) -> Vec<(String, Vec<Value>, Stat)> {
|
||||
|
||||
let mut builds = vec![];
|
||||
|
||||
let page = client
|
||||
|
@ -79,7 +77,6 @@ impl DataSource for PBDataSource {
|
|||
"type": "Set"
|
||||
})], Stat{win_rate:0.0,games:1,kda:0.0,patch:"".to_string()}));
|
||||
|
||||
|
||||
builds
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue