This commit is contained in:
Simon
2025-08-16 18:46:10 +00:00
parent 2248d11d3e
commit 49ca76ab48
3 changed files with 85 additions and 23 deletions

View File

@@ -1,3 +1,4 @@
use crate::schema::videos::url;
use crate::util::parse_abbreviated_number;
use crate::DbPool;
use crate::providers::Provider;
@@ -192,10 +193,10 @@ impl HentaihavenProvider {
.to_vec()
;
for video_segment in &raw_videos {
// let vid = video_segment.split("\n").collect::<Vec<&str>>();
// for (index, line) in vid.iter().enumerate() {
// println!("Line {}: {}", index, line);
// }
let vid = video_segment.split("\n").collect::<Vec<&str>>();
for (index, line) in vid.iter().enumerate() {
println!("Line {}: {}", index, line);
}
let episode_count = video_segment.split("chapter font-meta").collect::<Vec<&str>>()[1]
.split("class=\"btn-link\">").collect::<Vec<&str>>()[1]
@@ -206,12 +207,24 @@ impl HentaihavenProvider {
.split("class=\"btn-link\">").collect::<Vec<&str>>()[1]
.split("<").collect::<Vec<&str>>()[0]
.split(" ").collect::<Vec<&str>>()[1] == "Season" ;
let url_part = video_segment.split("chapter font-meta").collect::<Vec<&str>>()[1]
println!("{:?}",video_segment.split("chapter font-meta").collect::<Vec<&str>>()[1]
.split("href=\"").collect::<Vec<&str>>()[1]
.split("\"").collect::<Vec<&str>>()[0]
.split("/").collect::<Vec<&str>>()[4];
.split("/").collect::<Vec<&str>>()[4]);
let mut url_part_list = video_segment.split("chapter font-meta").collect::<Vec<&str>>()[1]
.split("href=\"").collect::<Vec<&str>>()[1]
.split("\"").collect::<Vec<&str>>()[0]
.split("/").collect::<Vec<&str>>()[4]
.split("-").collect::<Vec<&str>>();
if url_part_list.len() > 5 {
if let Some(pos) = url_part_list.iter().rposition(|x| *x == "no") {
url_part_list.remove(pos);
}
}
url_part_list.truncate(5);
let url_part = url_part_list.join("-");
for i in 1..=episode_count {
let mut video_url = format!("https://master-lengs.org/api/v3/hh/{}-{}-eng/master.m3u8", url_part, i);
if season {
video_url = format!("https://master-lengs.org/api/v3/hh/{}-season-eng/master.m3u8", url_part);
@@ -220,19 +233,28 @@ impl HentaihavenProvider {
.split("\"").collect::<Vec<&str>>()[0]
.to_string(), i);
let id = format!("{}-{}", url_part, i);
let mut thumb = format!("https://himg.nl/images/hh/{}-{}-eng/poster.jpg", url_part, i);
if season {
thumb = format!("https://himg.nl/images/hh/{}-season-eng/poster.jpg", url_part);
}
let thumb = match video_segment.split("<img").collect::<Vec<&str>>()[1]
.split("").collect::<Vec<&str>>()[0].contains("data-src=\"") {
true => video_segment.split("<img ").collect::<Vec<&str>>()[1]
.split("data-src=\"").collect::<Vec<&str>>()[1]
.split("\"").collect::<Vec<&str>>()[0]
.to_string(),
false =>video_segment.split("<img ").collect::<Vec<&str>>()[1]
.split("src=\"").collect::<Vec<&str>>()[1]
.split("\"").collect::<Vec<&str>>()[0]
.to_string()
};
items.push(VideoItem::new(
id,
title,
video_url,
"hentaihaven".to_string(),
thumb,
0, // duration is not available
))
;
id,
title,
video_url,
"hentaihaven".to_string(),
thumb,
0, // duration is not available
)
.aspect_ratio(0.73)
);
}
}
return items;