sxyprn bugfix time and preview
This commit is contained in:
@@ -6,6 +6,9 @@ services:
|
|||||||
container_name: hottub
|
container_name: hottub
|
||||||
entrypoint: supervisord
|
entrypoint: supervisord
|
||||||
command: ["-c", "/app/supervisord/supervisord.conf"]
|
command: ["-c", "/app/supervisord/supervisord.conf"]
|
||||||
|
# In case you dont want the burpsuite proxy and only wanna run the server in the docker without compiling outside:
|
||||||
|
# entrypoint: cargo
|
||||||
|
# command: ["run"]
|
||||||
volumes:
|
volumes:
|
||||||
- /path/to/hottub:/app # REPLACE
|
- /path/to/hottub:/app # REPLACE
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -129,16 +129,16 @@ impl SxyprnProvider {
|
|||||||
return vec![];
|
return vec![];
|
||||||
}
|
}
|
||||||
let raw_videos = html
|
let raw_videos = html
|
||||||
.split("post_el_small'")
|
.split("<script async").collect::<Vec<&str>>()[0]
|
||||||
.collect::<Vec<&str>>()[1..]
|
.split("post_el_small'").collect::<Vec<&str>>()[1..]
|
||||||
.to_vec();
|
.to_vec();
|
||||||
let mut items: Vec<VideoItem> = Vec::new();
|
let mut items: Vec<VideoItem> = Vec::new();
|
||||||
for video_segment in &raw_videos {
|
for video_segment in &raw_videos {
|
||||||
// let vid = video_segment.split("\n").collect::<Vec<&str>>();
|
let vid = video_segment.split("\n").collect::<Vec<&str>>();
|
||||||
// for (index, line) in vid.iter().enumerate() {
|
for (index, line) in vid.iter().enumerate() {
|
||||||
// println!("Line {}: {}", index, line.to_string().trim());
|
println!("Line {}: {}", index, line.to_string().trim());
|
||||||
// }
|
}
|
||||||
// println!("\n\n\n");
|
println!("\n\n\n");
|
||||||
|
|
||||||
let video_url = format!("https://hottub.spacemoehre.de/proxy/sxyprn/post/{}",video_segment.split("/post/").collect::<Vec<&str>>()[1]
|
let video_url = format!("https://hottub.spacemoehre.de/proxy/sxyprn/post/{}",video_segment.split("/post/").collect::<Vec<&str>>()[1]
|
||||||
.split("'").collect::<Vec<&str>>()[0]
|
.split("'").collect::<Vec<&str>>()[0]
|
||||||
@@ -161,6 +161,7 @@ impl SxyprnProvider {
|
|||||||
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(" "," ");
|
||||||
|
title = title.replace(" + ", " ").replace(" ", " ");
|
||||||
|
|
||||||
// println!("Title: {}", title);
|
// println!("Title: {}", title);
|
||||||
let id = video_url.split("/").collect::<Vec<&str>>()[6].to_string();
|
let id = video_url.split("/").collect::<Vec<&str>>()[6].to_string();
|
||||||
@@ -171,12 +172,15 @@ impl SxyprnProvider {
|
|||||||
.collect::<Vec<&str>>()[0]
|
.collect::<Vec<&str>>()[0]
|
||||||
.to_string());
|
.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("class='hvp_player'").collect::<Vec<&str>>()[1]
|
||||||
.split(" src='").collect::<Vec<&str>>()[1]
|
.split(" src='").collect::<Vec<&str>>()[1]
|
||||||
.split("'")
|
.split("'")
|
||||||
.collect::<Vec<&str>>()[0]
|
.collect::<Vec<&str>>()[0]
|
||||||
.to_string());
|
.to_string())),
|
||||||
|
false => None
|
||||||
|
};
|
||||||
|
|
||||||
let views= video_segment
|
let views= video_segment
|
||||||
.split("<strong>·</strong> ").collect::<Vec<&str>>()[1]
|
.split("<strong>·</strong> ").collect::<Vec<&str>>()[1]
|
||||||
@@ -186,12 +190,15 @@ impl SxyprnProvider {
|
|||||||
|
|
||||||
let raw_duration = video_segment
|
let raw_duration = video_segment
|
||||||
.split("duration_small").collect::<Vec<&str>>()[1]
|
.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>>()[1]
|
||||||
.split("<").collect::<Vec<&str>>()[0]
|
.split("<").collect::<Vec<&str>>()[0]
|
||||||
.to_string();
|
.to_string();
|
||||||
|
println!("Duration: {}", raw_duration);
|
||||||
let duration = parse_time_to_seconds(&raw_duration).unwrap_or(0) as u32;
|
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,
|
id,
|
||||||
title,
|
title,
|
||||||
video_url.to_string(),
|
video_url.to_string(),
|
||||||
@@ -199,9 +206,11 @@ impl SxyprnProvider {
|
|||||||
thumb,
|
thumb,
|
||||||
duration,
|
duration,
|
||||||
)
|
)
|
||||||
.preview(preview)
|
|
||||||
.views(views.parse::<u32>().unwrap_or(0))
|
.views(views.parse::<u32>().unwrap_or(0))
|
||||||
;
|
;
|
||||||
|
if let Some(p) = preview {
|
||||||
|
video_item = video_item.preview(p);
|
||||||
|
}
|
||||||
items.push(video_item);
|
items.push(video_item);
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
|
|||||||
Reference in New Issue
Block a user