fixed the unlikely ocurence of slow gogo uploads

This commit is contained in:
Zastian Pretorius
2022-10-18 17:09:45 +01:00
parent 115d7e790f
commit d436e69a64

View File

@@ -79,15 +79,12 @@ pub fn anime_link(title: &str, ep: u64) -> (String, String) {
let url = format!("https://animixplay.to/v1/{}", title); let url = format!("https://animixplay.to/v1/{}", title);
let html = get_anime_html(&url); let html = get_anime_html(&url);
let re = Regex::new(r#"(?m)\?id=([^&]+)"#).unwrap(); let re = Regex::new(r#"(?m)\?id=([^&]+)"#).unwrap();
let id1 = re let id1 = match re.captures_iter(&html).nth(ep as usize - 1) {
.captures_iter(&html) Some(cap) => cap.get(1).unwrap().as_str().trim().to_string(),
.nth(ep as usize - 1) None => "".to_string(),
.unwrap() };
.get(1)
.unwrap() if id1 != "" {
.as_str()
.trim()
.to_string();
let title = format!("{} Episode {}", title.replace('-', " "), ep); let title = format!("{} Episode {}", title.replace('-', " "), ep);
let encoded_id1 = encode(&id1); let encoded_id1 = encode(&id1);
let anime_id = encode(format!("{}LTXs3GrU8we9O{}", id1, encoded_id1)); let anime_id = encode(format!("{}LTXs3GrU8we9O{}", id1, encoded_id1));
@@ -97,5 +94,21 @@ pub fn anime_link(title: &str, ep: u64) -> (String, String) {
let url = std::str::from_utf8(&decode(url).unwrap()) let url = std::str::from_utf8(&decode(url).unwrap())
.unwrap() .unwrap()
.to_string(); .to_string();
(url, title) return (url, title);
} else {
let re = Regex::new(r#"(?m)r\.html#(.*)""#).unwrap();
let id2 = re
.captures_iter(&html)
.next()
.unwrap()
.get(1)
.unwrap()
.as_str()
.trim()
.to_string();
let url = decode(id2).unwrap();
let url = std::str::from_utf8(&url).unwrap().to_string();
let title = format!("{} Episode {}", title.replace('-', " "), ep);
return (url, title);
}
} }