fix duration

This commit is contained in:
Simon
2025-09-03 12:20:05 +00:00
parent ff18f3eb34
commit edb23b62ba

View File

@@ -12,6 +12,7 @@ use crate::providers::Provider;
use crate::util::cache::VideoCache;
use crate::util::flaresolverr::{FlareSolverrRequest, Flaresolverr};
use crate::util::requester;
use crate::util::time::parse_time_to_seconds;
use crate::videos::ServerOptions;
use crate::videos::{VideoItem};
use crate::DbPool;
@@ -155,7 +156,6 @@ impl SxyprnProvider {
.split("</div>")
.collect::<Vec<&str>>()[0]
;
println!("Title parts: {}", title_parts);
let document = Html::parse_document(title_parts);
let selector = Selector::parse("*").unwrap();
@@ -166,9 +166,6 @@ impl SxyprnProvider {
texts.push(text.trim().to_string());
}
}
println!("Texts: {:?}", texts);
let mut title = texts[0].clone();
// html decode
title = decode(title.as_bytes()).to_string().unwrap_or(title).replace(" "," ");
@@ -195,13 +192,20 @@ impl SxyprnProvider {
.collect::<Vec<&str>>()[0]
.to_string();
let raw_duration = video_segment
.split("duration_small").collect::<Vec<&str>>()[1]
.split(">").collect::<Vec<&str>>()[1]
.split("<").collect::<Vec<&str>>()[0]
.to_string();
let duration = parse_time_to_seconds(&raw_duration).unwrap_or(0) as u32;
let video_item = VideoItem::new(
id,
title,
video_url.to_string(),
"sxyprn".to_string(),
thumb,
0,
duration,
)
.preview(preview)
.views(views.parse::<u32>().unwrap_or(0))