implemented hanime
This commit is contained in:
@@ -26,7 +26,7 @@ impl PerverzijaProvider {
|
||||
url: "https://tube.perverzija.com/".to_string(),
|
||||
}
|
||||
}
|
||||
async fn get(&self, cache:VideoCache ,page: &u8, featured: String) -> Result<Vec<Video_Item>> {
|
||||
async fn get(&self, cache:VideoCache ,page: u8, featured: String) -> Result<Vec<Video_Item>> {
|
||||
println!("get");
|
||||
|
||||
//TODO
|
||||
@@ -41,7 +41,7 @@ impl PerverzijaProvider {
|
||||
prefix_uri = "featured-scenes/".to_string();
|
||||
}
|
||||
let mut url = format!("{}{}page/{}/", self.url, prefix_uri, page);
|
||||
if page == &1 {
|
||||
if page == 1 {
|
||||
url = format!("{}{}", self.url, prefix_uri);
|
||||
}
|
||||
|
||||
@@ -116,14 +116,14 @@ impl PerverzijaProvider {
|
||||
Ok(video_items)
|
||||
}
|
||||
}
|
||||
async fn query(&self, cache: VideoCache, page: &u8, query: &str) -> Result<Vec<Video_Item>> {
|
||||
async fn query(&self, cache: VideoCache, page: u8, query: &str) -> Result<Vec<Video_Item>> {
|
||||
println!("query: {}", query);
|
||||
let search_string = query.replace(" ", "+");
|
||||
let mut url = format!(
|
||||
"{}advanced-search/?_sf_s={}&sf_paged={}",
|
||||
self.url, search_string, page
|
||||
);
|
||||
if page == &1 {
|
||||
if page == 1 {
|
||||
url = format!("{}advanced-search/?_sf_s={}", self.url, search_string);
|
||||
}
|
||||
|
||||
@@ -216,11 +216,6 @@ impl PerverzijaProvider {
|
||||
println!("Skipping video segment with unexpected length: {}", vid.len());
|
||||
continue;
|
||||
}
|
||||
for (i, line) in vid.iter().enumerate() {
|
||||
if line.trim().is_empty() {
|
||||
println!("Empty line at index {}: {}", i, line);
|
||||
}
|
||||
}
|
||||
let mut title = vid[1].split(">").collect::<Vec<&str>>()[1]
|
||||
.split("<")
|
||||
.collect::<Vec<&str>>()[0]
|
||||
@@ -283,7 +278,7 @@ impl PerverzijaProvider {
|
||||
let mut video_item = Video_Item::new(
|
||||
id,
|
||||
title,
|
||||
url.clone(),
|
||||
embed.source.clone(),
|
||||
"perverzija".to_string(),
|
||||
thumb,
|
||||
duration,
|
||||
@@ -343,15 +338,8 @@ impl PerverzijaProvider {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let thumb = match vid[thumb_index].contains("srcset=") {
|
||||
true => vid[thumb_index].split("sizes=").collect::<Vec<&str>>()[1]
|
||||
.split("w, ")
|
||||
.collect::<Vec<&str>>()
|
||||
.last()
|
||||
.unwrap()
|
||||
.to_string()
|
||||
.split(" ")
|
||||
.collect::<Vec<&str>>()[0]
|
||||
let thumb = match vid[thumb_index].contains("srcset=\"") {
|
||||
true => vid[thumb_index].split(" ").collect::<Vec<&str>>()[0]
|
||||
.to_string(),
|
||||
false => vid[thumb_index].split("src=\"").collect::<Vec<&str>>()[1]
|
||||
.split("\"")
|
||||
@@ -418,8 +406,8 @@ impl Provider for PerverzijaProvider {
|
||||
let _ = per_page;
|
||||
let _ = sort;
|
||||
let videos: std::result::Result<Vec<Video_Item>, Error> = match query {
|
||||
Some(q) => self.query(cache, &page.parse::<u8>().unwrap_or(1), &q).await,
|
||||
None => self.get(cache, &page.parse::<u8>().unwrap_or(1), featured).await,
|
||||
Some(q) => self.query(cache, page.parse::<u8>().unwrap_or(1), &q).await,
|
||||
None => self.get(cache, page.parse::<u8>().unwrap_or(1), featured).await,
|
||||
};
|
||||
match videos {
|
||||
Ok(v) => v,
|
||||
|
||||
Reference in New Issue
Block a user