From 1fc1b7e867652d69efb703f4ed153054110104d6 Mon Sep 17 00:00:00 2001 From: Zastian Pretorius Date: Thu, 3 Nov 2022 22:58:03 +0000 Subject: [PATCH] fixed anime provider --- src/anime/scraper.rs | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/anime/scraper.rs b/src/anime/scraper.rs index 2dde526..66805ca 100644 --- a/src/anime/scraper.rs +++ b/src/anime/scraper.rs @@ -85,18 +85,28 @@ pub fn anime_link(title: &str, ep: u64) -> (String, String) { Some(cap) => cap.get(1).unwrap().as_str().trim().to_string(), None => "".to_string(), }; - if id1 != "" { let title = format!("{} Episode {}", title.replace('-', " "), ep); let encoded_id1 = encode(&id1); - let anime_id = encode(format!("{}LTXs3GrU8we9O{}", id1, encoded_id1)); - let html = format!("https://animixplay.to/api/live{}", anime_id); - let url = get_ep_location(&html); - let url = url.split('#').nth(1).unwrap(); - let url = std::str::from_utf8(&decode(url).unwrap()) - .unwrap() - .to_string(); - return (url, title); + let encoded_id2 = encode(&encoded_id1); + let mut last_byte = encoded_id1.as_bytes()[encoded_id1.len() - 2]; + last_byte += 1; + let mut new_encoded_id1 = encoded_id1.as_bytes().to_vec(); + new_encoded_id1.pop(); + new_encoded_id1.pop(); + new_encoded_id1.push(last_byte); + let new_encoded_id1 = String::from_utf8(new_encoded_id1).unwrap(); + let ani_id = format!("cW9{}MVFhzM0dyVTh3ZTlP{}", new_encoded_id1, encoded_id2); + let result = get_ep_location(format!("https://animixplay.to/api/{}", ani_id).as_str()); + //split the result into at # and return the second part + let result: String = std::str::from_utf8( + decode(result.split('#').nth(1).unwrap()) + .unwrap() + .as_slice(), + ) + .unwrap() + .to_string(); + return (result, title); } else { let re = Regex::new(r#"(?m)r\.html#(.*)""#).unwrap(); let id2 = re