missav upgrade
This commit is contained in:
@@ -33,9 +33,9 @@ impl MissavProvider {
|
||||
url: "https://missav.ws".to_string(),
|
||||
}
|
||||
}
|
||||
async fn get(&self, cache:VideoCache, pool:DbPool, page: u8) -> Result<Vec<VideoItem>> {
|
||||
async fn get(&self, cache:VideoCache, pool:DbPool, page: u8, sort: String, options: ServerOptions) -> Result<Vec<VideoItem>> {
|
||||
|
||||
let url_str = format!("{}/en/new?page={}", self.url, page);
|
||||
let url_str = format!("{}/{}/{}?page={}&sort={}", self.url, options.language.unwrap(), options.filter.unwrap(), page, sort);
|
||||
|
||||
let old_items = match cache.get(&url_str) {
|
||||
Some((time, items)) => {
|
||||
@@ -103,11 +103,11 @@ impl MissavProvider {
|
||||
Ok(video_items)
|
||||
}
|
||||
}
|
||||
async fn query(&self, cache: VideoCache, pool:DbPool, page: u8, query: &str) -> Result<Vec<VideoItem>> {
|
||||
async fn query(&self, cache: VideoCache, pool:DbPool, page: u8, query: &str, sort: String, options: ServerOptions) -> Result<Vec<VideoItem>> {
|
||||
let search_string = query.replace(" ", "%20");
|
||||
let url_str = format!(
|
||||
"{}/en/search/{}?page={}",
|
||||
self.url, search_string, page
|
||||
"{}/{}/search/{}?page={}&sort={}",
|
||||
self.url, options.language.unwrap(), search_string, page, sort
|
||||
);
|
||||
// Check our Video Cache. If the result is younger than 1 hour, we return it.
|
||||
let old_items = match cache.get(&url_str) {
|
||||
@@ -245,10 +245,12 @@ impl MissavProvider {
|
||||
}
|
||||
let mut title = vid.split("<meta property=\"og:title\" content=\"").collect::<Vec<&str>>()[1]
|
||||
.split("\"")
|
||||
.collect::<Vec<&str>>()[0]
|
||||
.collect::<Vec<&str>>()[0].trim()
|
||||
.to_string();
|
||||
title = decode(title.as_bytes()).to_string().unwrap_or(title);
|
||||
|
||||
if url_str.contains("uncensored") {
|
||||
title = format!("[Uncensored] {}", title);
|
||||
}
|
||||
let thumb = vid.split("<meta property=\"og:image\" content=\"").collect::<Vec<&str>>()[1]
|
||||
.split("\"")
|
||||
.collect::<Vec<&str>>()[0]
|
||||
@@ -294,7 +296,7 @@ impl MissavProvider {
|
||||
tags.push(format!("@genre:{}", tag));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if vid.contains("<span>Genre:</span>"){
|
||||
for tag_snippet in vid.split("<span>Genre:</span>").collect::<Vec<&str>>()[1]
|
||||
@@ -357,12 +359,10 @@ impl Provider for MissavProvider {
|
||||
per_page: String,
|
||||
options: ServerOptions,
|
||||
) -> Vec<VideoItem> {
|
||||
let _ = options;
|
||||
let _ = per_page;
|
||||
let _ = sort;
|
||||
let videos: std::result::Result<Vec<VideoItem>, Error> = match query {
|
||||
Some(q) => self.query(cache, pool, page.parse::<u8>().unwrap_or(1), &q).await,
|
||||
None => self.get(cache, pool, page.parse::<u8>().unwrap_or(1)).await,
|
||||
Some(q) => self.query(cache, pool, page.parse::<u8>().unwrap_or(1), &q, sort, options).await,
|
||||
None => self.get(cache, pool, page.parse::<u8>().unwrap_or(1), sort, options).await,
|
||||
};
|
||||
match videos {
|
||||
Ok(v) => v,
|
||||
|
||||
Reference in New Issue
Block a user