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