This commit is contained in:
parent
7bdcf52c47
commit
e1ce928083
2 changed files with 8 additions and 9 deletions
|
@ -90,12 +90,11 @@ impl CGGDataSource {
|
|||
}
|
||||
|
||||
fn extract_json(pattern: &str, page: &str) -> String {
|
||||
|
||||
let json = page[page.find(pattern).unwrap()+pattern.len()..].to_owned();
|
||||
json[..json.find("};").unwrap()+1].replace("undefined", "null").to_owned()
|
||||
let json = page[page.find(pattern).unwrap() + pattern.len()..].to_owned();
|
||||
json[..json.find("};").unwrap() + 1]
|
||||
.replace("undefined", "null")
|
||||
}
|
||||
|
||||
|
||||
impl DataSource for CGGDataSource {
|
||||
fn get_alias(&self) -> &str {
|
||||
"CGG"
|
||||
|
@ -116,8 +115,8 @@ impl DataSource for CGGDataSource {
|
|||
serde_json::from_str(&extract_json("window.__PRELOADED_STATE__ = ", &page)).unwrap();
|
||||
|
||||
let champs_stats: HashMap<String, ChampStat> =
|
||||
serde_json::from_str(&extract_json("window.__FLASH_CMS_APOLLO_STATE__ = ", &page)).unwrap();
|
||||
|
||||
serde_json::from_str(&extract_json("window.__FLASH_CMS_APOLLO_STATE__ = ", &page))
|
||||
.unwrap();
|
||||
for entry in champs_stats.iter() {
|
||||
CHAMPIONS_STATS
|
||||
.lock()
|
||||
|
|
|
@ -114,15 +114,15 @@ impl KBDataSource {
|
|||
None => return None,
|
||||
};
|
||||
bundle = (&bundle[(auth_position + 13)..]).to_string();
|
||||
let q_position = match bundle.find("\"") {
|
||||
let q_position = match bundle.find('"') {
|
||||
Some(position) => position,
|
||||
None => return None,
|
||||
};
|
||||
bundle = (&bundle[(q_position + 1)..]).to_string();
|
||||
return match bundle.find("\"") {
|
||||
match bundle.find('"') {
|
||||
Some(position) => Some((&bundle[..position]).to_string()),
|
||||
None => None,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
fn get_classname_mapping(&self, client: &ureq::Agent) -> IndexMap<String, String> {
|
||||
|
|
Loading…
Add table
Reference in a new issue