mirror of
https://github.com/mrfluffy-dev/kami.git
synced 2026-01-17 04:50:32 +00:00
some scraper stuff
This commit is contained in:
@@ -82,7 +82,7 @@ pub fn get_episode_link(ep_id: &str, provider: &str) -> (String, String) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let json = req.send().unwrap().text().unwrap();
|
let json = req.send().unwrap().text().unwrap();
|
||||||
let json: serde_json::Value = serde_json::from_str(&json).unwrap();
|
let json: serde_json::Value = serde_json::from_str(&json).unwrap();
|
||||||
let url = "";
|
let mut url = String::new();
|
||||||
std::fs::write("test.json", json.to_string()).unwrap();
|
std::fs::write("test.json", json.to_string()).unwrap();
|
||||||
let mut subtitle = String::new();
|
let mut subtitle = String::new();
|
||||||
let _error_vec = Vec::new();
|
let _error_vec = Vec::new();
|
||||||
@@ -98,16 +98,17 @@ pub fn get_episode_link(ep_id: &str, provider: &str) -> (String, String) {
|
|||||||
subtitle = subtitle.replace(":", "\\:");
|
subtitle = subtitle.replace(":", "\\:");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let mut highest_quality = 0;
|
||||||
for i in 0..json["sources"].as_array().unwrap().len() {
|
for i in 0..json["sources"].as_array().unwrap().len() {
|
||||||
if json["sources"][i]["quality"]
|
let quality = json["sources"][i]["quality"]
|
||||||
.as_str()
|
.as_str()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.contains("1080")
|
.replace("p", "")
|
||||||
{
|
.parse::<i32>()
|
||||||
return (
|
.unwrap_or(0);
|
||||||
json["sources"][i]["url"].as_str().unwrap().to_string(),
|
if quality > highest_quality {
|
||||||
subtitle,
|
highest_quality = quality;
|
||||||
);
|
url = json["sources"][i]["url"].as_str().unwrap().to_string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(url.to_string(), subtitle)
|
(url.to_string(), subtitle)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ fn main() {
|
|||||||
let mut chapter: u32 = 0;
|
let mut chapter: u32 = 0;
|
||||||
//let search = option string
|
//let search = option string
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
let mut provider: String = "gogo".to_string();
|
let mut provider: String = "zoro".to_string();
|
||||||
let mut cast = (false, "0".to_string());
|
let mut cast = (false, "0".to_string());
|
||||||
for arg in std::env::args() {
|
for arg in std::env::args() {
|
||||||
if arg == "--help" || arg == "-h" {
|
if arg == "--help" || arg == "-h" {
|
||||||
@@ -36,10 +36,10 @@ fn main() {
|
|||||||
provider = "gogoanime".to_string();
|
provider = "gogoanime".to_string();
|
||||||
count += 1;
|
count += 1;
|
||||||
} else {
|
} else {
|
||||||
provider = "zoro".to_string();
|
provider = "gogo".to_string();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
provider = "zoro".to_string();
|
provider = "gogo".to_string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if arg == "--cast" || arg == "-C" {
|
if arg == "--cast" || arg == "-C" {
|
||||||
|
|||||||
Reference in New Issue
Block a user