From 0a9877eff186d12dc3e2c3ca508013b2b15c9397 Mon Sep 17 00:00:00 2001 From: nyyu Date: Sun, 14 Nov 2021 18:05:45 +0100 Subject: [PATCH] ms: fix parser --- src/ms_data_source.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ms_data_source.rs b/src/ms_data_source.rs index 535c524..db9ca00 100644 --- a/src/ms_data_source.rs +++ b/src/ms_data_source.rs @@ -7,7 +7,7 @@ use crate::Champion; pub struct MSDataSource; -const CHAMP_PATTERN: &str = " href=\"https://www.metasrc.com/5v5/champion/"; +const CHAMP_PATTERN: &str = " href=https://www.metasrc.com/5v5/champion/"; impl DataSource for MSDataSource { fn get_alias(&self) -> &str { @@ -36,11 +36,11 @@ impl DataSource for MSDataSource { while let Some(mut p) = pos { p += CHAMP_PATTERN.len(); let role = - &page[p + page[p..].find('/').unwrap() + 1..p + page[p..].find('"').unwrap()]; + &page[p + page[p..].find('/').unwrap() + 1..p + page[p..].find('>').unwrap()]; - let k = p + page[p..].find("data-search-terms-like=\"").unwrap() + 24; + let k = p + page[p..].find("data-search-terms-like=").unwrap() + 23; let pipe = k + page[k..].find('|').unwrap() + 1; - let key = &page[pipe..pipe + page[pipe..].find('"').unwrap()]; + let key = &page[pipe..pipe + page[pipe..].find(' ').unwrap()].replace("\"", ""); let id = champion.data.get(key).unwrap().key.parse::().unwrap();