This commit is contained in:
Simon
2026-02-23 17:34:33 +00:00
parent 61840b7ec5
commit 718e7c3f78
2 changed files with 35 additions and 49 deletions

View File

@@ -42,7 +42,7 @@ pub mod hypnotube;
pub mod freepornvideosxxx; pub mod freepornvideosxxx;
pub mod hentaihaven; pub mod hentaihaven;
pub mod chaturbate; pub mod chaturbate;
// pub mod tube8; pub mod tube8;
// convenient alias // convenient alias
pub type DynProvider = Arc<dyn Provider>; pub type DynProvider = Arc<dyn Provider>;
@@ -64,7 +64,7 @@ pub static ALL_PROVIDERS: Lazy<HashMap<&'static str, DynProvider>> = Lazy::new(|
m.insert("freepornvideosxxx", Arc::new(freepornvideosxxx::FreepornvideosxxxProvider::new()) as DynProvider); m.insert("freepornvideosxxx", Arc::new(freepornvideosxxx::FreepornvideosxxxProvider::new()) as DynProvider);
m.insert("hentaihaven", Arc::new(hentaihaven::HentaihavenProvider::new()) as DynProvider); m.insert("hentaihaven", Arc::new(hentaihaven::HentaihavenProvider::new()) as DynProvider);
m.insert("chaturbate", Arc::new(chaturbate::ChaturbateProvider::new()) as DynProvider); m.insert("chaturbate", Arc::new(chaturbate::ChaturbateProvider::new()) as DynProvider);
// m.insert("tube8", Arc::new(tube8::Tube8Provider::new()) as DynProvider); m.insert("tube8", Arc::new(tube8::Tube8Provider::new()) as DynProvider);
// add more here as you migrate them // add more here as you migrate them
m m
}); });

View File

@@ -89,15 +89,15 @@ impl Tube8Provider {
title: "Rating".into(), title: "Rating".into(),
}, },
FilterOption { FilterOption {
id: "mostviewed.html".into(), id: "mostviewed".into(),
title: "Most Viewed".into(), title: "Most Viewed".into(),
}, },
FilterOption { FilterOption {
id: "longest.html".into(), id: "longest".into(),
title: "Duration".into(), title: "Duration".into(),
}, },
FilterOption { FilterOption {
id: "newest.html".into(), id: "newest".into(),
title: "Newest".into(), title: "Newest".into(),
}, },
], ],
@@ -135,10 +135,10 @@ impl Tube8Provider {
options: ServerOptions, options: ServerOptions,
) -> Result<Vec<VideoItem>> { ) -> Result<Vec<VideoItem>> {
let mut sort_string: String = match sort { let mut sort_string: String = match sort {
"mostviewed.html" => "mostviewed.html/".to_string(), "mostviewed" => "most-viewed/page/".to_string(),
"longest.html" => "longest.html/".to_string(), "longest" => "longest/page/".to_string(),
"newest.html" => "newest.html/".to_string(), "newest" => "newest/page/".to_string(),
_ => "".to_string(), _ => "top/page/".to_string(),
}; };
if options.sites.is_some() if options.sites.is_some()
&& !options.sites.as_ref().unwrap().is_empty() && !options.sites.as_ref().unwrap().is_empty()
@@ -175,7 +175,7 @@ impl Tube8Provider {
vec![] vec![]
} }
}; };
println!("Video URL {:?}", video_url);
let mut requester = options.requester.clone().unwrap(); let mut requester = options.requester.clone().unwrap();
let text = requester.get(&video_url, None).await.unwrap(); let text = requester.get(&video_url, None).await.unwrap();
let video_items: Vec<VideoItem> = self.get_video_items_from_html(text.clone()); let video_items: Vec<VideoItem> = self.get_video_items_from_html(text.clone());
@@ -283,7 +283,7 @@ impl Tube8Provider {
let raw_videos = html.split("id=\"pagination\"").collect::<Vec<&str>>()[0] let raw_videos = html.split("id=\"pagination\"").collect::<Vec<&str>>()[0]
.split("-thumbs") .split("-thumbs")
.collect::<Vec<&str>>()[1] .collect::<Vec<&str>>()[1]
.split("video-box ") .split("\"video-box ")
.collect::<Vec<&str>>()[1..] .collect::<Vec<&str>>()[1..]
.to_vec(); .to_vec();
for video_segment in &raw_videos { for video_segment in &raw_videos {
@@ -291,6 +291,9 @@ impl Tube8Provider {
// for (index, line) in vid.iter().enumerate() { // for (index, line) in vid.iter().enumerate() {
// println!("Line {}: {}", index, line); // println!("Line {}: {}", index, line);
// } // }
if video_segment.contains("adsbytrafficjunky"){
continue;
}
let video_url: String = format!("{}{}", self.url, video_segment.split("<a href=\"").collect::<Vec<&str>>()[1] let video_url: String = format!("{}{}", self.url, video_segment.split("<a href=\"").collect::<Vec<&str>>()[1]
.split("\"") .split("\"")
.collect::<Vec<&str>>()[0] .collect::<Vec<&str>>()[0]
@@ -342,67 +345,50 @@ impl Tube8Provider {
.as_str(), .as_str(),
) )
.unwrap_or(0) as u32; .unwrap_or(0) as u32;
let site_name = title let mut tags = match video_segment.contains("info-views-container block") {
.split("]")
.collect::<Vec<&str>>()
.first()
.unwrap_or(&"")
.trim_start_matches("[");
let site_id = self
.get_site_id_from_name(site_name)
.unwrap_or("".to_string());
let mut tags = match video_segment.contains("class=\"models\">") {
true => video_segment true => video_segment
.split("class=\"models\">") .split("info-views-container block")
.collect::<Vec<&str>>()[1] .collect::<Vec<&str>>()[1]
.split("</div>") .split("view-rating-container")
.collect::<Vec<&str>>()[0] .collect::<Vec<&str>>()[0]
.split("href=\"") .split("<a ")
.collect::<Vec<&str>>()[1..] .collect::<Vec<&str>>()[1..]
.into_iter() .into_iter()
.map(|s| { .map(|s| {
let mut target = &self.stars;
if s.contains("author-title-text "){
target = &self.sites
}
let id = s.split("href=\"")
.collect::<Vec<&str>>()[1]
.split("\"")
.collect::<Vec<&str>>()[0];
let title = s.split(">")
.collect::<Vec<&str>>()[1]
.split("</a")
.collect::<Vec<&str>>()[0];
Self::push_unique( Self::push_unique(
&self.stars, target,
FilterOption { FilterOption {
id: s.split("/").collect::<Vec<&str>>()[4].to_string(), id: id.to_string(),
title: s.split(">").collect::<Vec<&str>>()[1] title: title.to_string(),
.split("<")
.collect::<Vec<&str>>()[0]
.trim()
.to_string(),
}, },
); );
s.split(">").collect::<Vec<&str>>()[1] title.to_string()
.split("<")
.collect::<Vec<&str>>()[0]
.trim()
.to_string()
}) })
.collect::<Vec<String>>() .collect::<Vec<String>>()
.to_vec(), .to_vec(),
false => vec![], false => vec![],
}; };
if !site_id.is_empty() {
Self::push_unique(
&self.sites,
FilterOption {
id: site_id,
title: site_name.to_string(),
},
);
tags.push(site_name.to_string());
}
let video_item = VideoItem::new( let video_item = VideoItem::new(
id, id,
title, title,
video_url.to_string(), video_url.to_string(),
"omgxxx".to_string(), "tube8".to_string(),
thumb, thumb,
duration, duration,
) )
.views(views) .views(views)
.preview(preview)
.tags(tags); .tags(tags);
items.push(video_item); items.push(video_item);
} }