missav upgrade

This commit is contained in:
Simon
2025-08-20 13:40:16 +00:00
parent 87965d4659
commit 79b833b857
3 changed files with 156 additions and 38 deletions

View File

@@ -471,6 +471,7 @@ async fn status(req: HttpRequest) -> Result<impl web::Responder, web::Error> {
nsfw: true, nsfw: true,
}); });
// Redtube
status.add_channel(Channel { status.add_channel(Channel {
id: "redtube".to_string(), id: "redtube".to_string(),
name: "Redtube".to_string(), name: "Redtube".to_string(),
@@ -483,6 +484,7 @@ async fn status(req: HttpRequest) -> Result<impl web::Responder, web::Error> {
nsfw: true, nsfw: true,
}); });
// ok.porn
status.add_channel(Channel { status.add_channel(Channel {
id: "okporn".to_string(), id: "okporn".to_string(),
name: "Ok.porn".to_string(), name: "Ok.porn".to_string(),
@@ -516,7 +518,8 @@ async fn status(req: HttpRequest) -> Result<impl web::Responder, web::Error> {
nsfw: true, nsfw: true,
}); });
status.add_channel(Channel { // pornhat
status.add_channel(Channel {
id: "pornhat".to_string(), id: "pornhat".to_string(),
name: "Pornhat".to_string(), name: "Pornhat".to_string(),
description: "free HD porn videos".to_string(), description: "free HD porn videos".to_string(),
@@ -549,7 +552,8 @@ async fn status(req: HttpRequest) -> Result<impl web::Responder, web::Error> {
nsfw: true, nsfw: true,
}); });
status.add_channel(Channel { //perfectgirls
status.add_channel(Channel {
id: "perfectgirls".to_string(), id: "perfectgirls".to_string(),
name: "Perfectgirls".to_string(), name: "Perfectgirls".to_string(),
description: "Perfect Girls Tube".to_string(), description: "Perfect Girls Tube".to_string(),
@@ -582,6 +586,7 @@ async fn status(req: HttpRequest) -> Result<impl web::Responder, web::Error> {
nsfw: true, nsfw: true,
}); });
// okxxx
status.add_channel(Channel { status.add_channel(Channel {
id: "okxxx".to_string(), id: "okxxx".to_string(),
name: "Ok.xxx".to_string(), name: "Ok.xxx".to_string(),
@@ -615,7 +620,8 @@ async fn status(req: HttpRequest) -> Result<impl web::Responder, web::Error> {
nsfw: true, nsfw: true,
}); });
status.add_channel(Channel { // homoxxx
status.add_channel(Channel {
id: "homoxxx".to_string(), id: "homoxxx".to_string(),
name: "Homo.xxx".to_string(), name: "Homo.xxx".to_string(),
description: "Best Gay Porn".to_string(), description: "Best Gay Porn".to_string(),
@@ -648,6 +654,7 @@ async fn status(req: HttpRequest) -> Result<impl web::Responder, web::Error> {
nsfw: true, nsfw: true,
}); });
// hentaimoon
status.add_channel(Channel { status.add_channel(Channel {
id: "hentaimoon".to_string(), id: "hentaimoon".to_string(),
name: "Hentai Moon".to_string(), name: "Hentai Moon".to_string(),
@@ -681,6 +688,7 @@ async fn status(req: HttpRequest) -> Result<impl web::Responder, web::Error> {
nsfw: true, nsfw: true,
}); });
//missav
status.add_channel(Channel { status.add_channel(Channel {
id: "missav".to_string(), id: "missav".to_string(),
name: "MissAV".to_string(), name: "MissAV".to_string(),
@@ -690,28 +698,124 @@ async fn status(req: HttpRequest) -> Result<impl web::Responder, web::Error> {
status: "active".to_string(), status: "active".to_string(),
categories: vec![], categories: vec![],
options: vec![ options: vec![
// ChannelOption { ChannelOption {
// id: "sort".to_string(), id: "sort".to_string(),
// title: "Sort".to_string(), title: "Sort".to_string(),
// description: "Sort the Videos".to_string(), //"Sort the videos by Date or Name.".to_string(), description: "Sort the Videos".to_string(), //"Sort the videos by Date or Name.".to_string(),
// systemImage: "list.number".to_string(), systemImage: "list.number".to_string(),
// colorName: "blue".to_string(), colorName: "blue".to_string(),
// options: vec![ options: vec![
// FilterOption { FilterOption {
// id: "new".to_string(), id: "released_at".to_string(),
// title: "New".to_string(), title: "Release Date".to_string(),
// }, },
// FilterOption { FilterOption {
// id: "popular".to_string(), id: "published_at".to_string(),
// title: "Popular".to_string(), title: "Recent Update".to_string(),
// }, },
// FilterOption { FilterOption {
// id: "top-rated".to_string(), id: "today_views".to_string(),
// title: "Top Rated".to_string(), title: "Today Views".to_string(),
// }, },
// ], FilterOption {
// multiSelect: false, id: "weekly_views".to_string(),
// } title: "Weekly Views".to_string(),
},
FilterOption {
id: "monthly_views".to_string(),
title: "Monthly Views".to_string(),
},
FilterOption {
id: "views".to_string(),
title: "Total Views".to_string(),
},
],
multiSelect: false,
},
ChannelOption {
id: "filter".to_string(),
title: "Filter".to_string(),
description: "Filter the Videos".to_string(), //"Sort the videos by Date or Name.".to_string(),
systemImage: "line.horizontal.3.decrease.circle".to_string(),
colorName: "green".to_string(),
options: vec![
FilterOption {
id: "new".to_string(),
title: "Recent update".to_string(),
},
FilterOption {
id: "release".to_string(),
title: "New Releases".to_string(),
},
FilterOption {
id: "uncensored-leak".to_string(),
title: "Uncensored".to_string(),
},
FilterOption {
id: "english-subtitle".to_string(),
title: "English subtitle".to_string(),
},
],
multiSelect: false,
},
ChannelOption {
id: "language".to_string(),
title: "Language".to_string(),
description: "What Language to fetch".to_string(), //"Sort the videos by Date or Name.".to_string(),
systemImage: "flag.fill".to_string(),
colorName: "white".to_string(),
options: vec![
FilterOption {
id: "en".to_string(),
title: "English".to_string(),
},
FilterOption {
id: "cn".to_string(),
title: "简体中文".to_string(),
},
FilterOption {
id: "ja".to_string(),
title: "日本語".to_string(),
},
FilterOption {
id: "ko".to_string(),
title: "한국의".to_string(),
},
FilterOption {
id: "ms".to_string(),
title: "Melayu".to_string(),
},
FilterOption {
id: "th".to_string(),
title: "ไทย".to_string(),
},
FilterOption {
id: "de".to_string(),
title: "Deutsch".to_string(),
},
FilterOption {
id: "fr".to_string(),
title: "Français".to_string(),
},
FilterOption {
id: "vi".to_string(),
title: "Tiếng Việt".to_string(),
},
FilterOption {
id: "id".to_string(),
title: "Bahasa Indonesia".to_string(),
},
FilterOption {
id: "fil".to_string(),
title: "Filipino".to_string(),
},
FilterOption {
id: "pt".to_string(),
title: "Português".to_string(),
},
],
multiSelect: false,
}
], ],
nsfw: true, nsfw: true,
}); });
@@ -780,7 +884,17 @@ async fn videos_post(
.as_deref() .as_deref()
.unwrap_or("") .unwrap_or("")
.to_string(); .to_string();
let options = ServerOptions { featured: Some(featured), category: Some(category), sites: Some(sites) }; let filter = video_request
.filter
.as_deref()
.unwrap_or("new")
.to_string();
let language = video_request
.language
.as_deref()
.unwrap_or("en")
.to_string();
let options = ServerOptions { featured: Some(featured), category: Some(category), sites: Some(sites), filter: Some(filter), language: Some(language) };
let video_items = provider let video_items = provider
.get_videos( .get_videos(
cache.get_ref().clone(), cache.get_ref().clone(),

View File

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

View File

@@ -28,6 +28,8 @@ pub struct VideosRequest {
pub featured: Option<String>, // "featured", pub featured: Option<String>, // "featured",
pub category: Option<String>, // "pmv" pub category: Option<String>, // "pmv"
pub sites: Option<String>, // pub sites: Option<String>, //
pub filter: Option<String>, //
pub language: Option<String>, //
} }
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
@@ -35,6 +37,8 @@ pub struct ServerOptions{
pub featured: Option<String>, // "featured", pub featured: Option<String>, // "featured",
pub category: Option<String>, // "pmv" pub category: Option<String>, // "pmv"
pub sites: Option<String>, // pub sites: Option<String>, //
pub filter: Option<String>,
pub language: Option<String>, // "en"
} }
#[derive(serde::Serialize, Debug)] #[derive(serde::Serialize, Debug)]