sxyprn bugfix time and preview
This commit is contained in:
@@ -129,16 +129,16 @@ impl SxyprnProvider {
|
||||
return vec![];
|
||||
}
|
||||
let raw_videos = html
|
||||
.split("post_el_small'")
|
||||
.collect::<Vec<&str>>()[1..]
|
||||
.split("<script async").collect::<Vec<&str>>()[0]
|
||||
.split("post_el_small'").collect::<Vec<&str>>()[1..]
|
||||
.to_vec();
|
||||
let mut items: Vec<VideoItem> = Vec::new();
|
||||
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.to_string().trim());
|
||||
// }
|
||||
// println!("\n\n\n");
|
||||
let vid = video_segment.split("\n").collect::<Vec<&str>>();
|
||||
for (index, line) in vid.iter().enumerate() {
|
||||
println!("Line {}: {}", index, line.to_string().trim());
|
||||
}
|
||||
println!("\n\n\n");
|
||||
|
||||
let video_url = format!("https://hottub.spacemoehre.de/proxy/sxyprn/post/{}",video_segment.split("/post/").collect::<Vec<&str>>()[1]
|
||||
.split("'").collect::<Vec<&str>>()[0]
|
||||
@@ -161,6 +161,7 @@ impl SxyprnProvider {
|
||||
let mut title = texts[0].clone();
|
||||
// html decode
|
||||
title = decode(title.as_bytes()).to_string().unwrap_or(title).replace(" "," ");
|
||||
title = title.replace(" + ", " ").replace(" ", " ");
|
||||
|
||||
// println!("Title: {}", title);
|
||||
let id = video_url.split("/").collect::<Vec<&str>>()[6].to_string();
|
||||
@@ -171,12 +172,15 @@ impl SxyprnProvider {
|
||||
.collect::<Vec<&str>>()[0]
|
||||
.to_string());
|
||||
|
||||
let preview = format!("https:{}",video_segment
|
||||
let preview = match video_segment.contains("class='hvp_player'"){
|
||||
true => Some(format!("https:{}",video_segment
|
||||
.split("class='hvp_player'").collect::<Vec<&str>>()[1]
|
||||
.split(" src='").collect::<Vec<&str>>()[1]
|
||||
.split("'")
|
||||
.collect::<Vec<&str>>()[0]
|
||||
.to_string());
|
||||
.to_string())),
|
||||
false => None
|
||||
};
|
||||
|
||||
let views= video_segment
|
||||
.split("<strong>·</strong> ").collect::<Vec<&str>>()[1]
|
||||
@@ -186,12 +190,15 @@ impl SxyprnProvider {
|
||||
|
||||
let raw_duration = video_segment
|
||||
.split("duration_small").collect::<Vec<&str>>()[1]
|
||||
.split("title='").collect::<Vec<&str>>()[1]
|
||||
.split("'").collect::<Vec<&str>>()[1]
|
||||
.split(">").collect::<Vec<&str>>()[1]
|
||||
.split("<").collect::<Vec<&str>>()[0]
|
||||
.to_string();
|
||||
println!("Duration: {}", raw_duration);
|
||||
let duration = parse_time_to_seconds(&raw_duration).unwrap_or(0) as u32;
|
||||
|
||||
let video_item = VideoItem::new(
|
||||
let mut video_item = VideoItem::new(
|
||||
id,
|
||||
title,
|
||||
video_url.to_string(),
|
||||
@@ -199,9 +206,11 @@ impl SxyprnProvider {
|
||||
thumb,
|
||||
duration,
|
||||
)
|
||||
.preview(preview)
|
||||
.views(views.parse::<u32>().unwrap_or(0))
|
||||
;
|
||||
if let Some(p) = preview {
|
||||
video_item = video_item.preview(p);
|
||||
}
|
||||
items.push(video_item);
|
||||
}
|
||||
return items;
|
||||
|
||||
Reference in New Issue
Block a user