fixed anime provider

This commit is contained in:
Zastian Pretorius
2022-11-03 22:58:03 +00:00
parent a5f0ef0e40
commit 1fc1b7e867

View File

@@ -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())
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 (url, title);
return (result, title);
} else {
let re = Regex::new(r#"(?m)r\.html#(.*)""#).unwrap();
let id2 = re