more bugfixes for viewcount
This commit is contained in:
@@ -180,9 +180,16 @@ impl PornhubProvider {
|
||||
// for (index, line) in vid.iter().enumerate() {
|
||||
// println!("Line {}: {}", index, line);
|
||||
// }
|
||||
let url = format!("{}{}", self.url, video_segment.split("<a href=\"").collect::<Vec<&str>>()[1]
|
||||
if video_segment.contains("wrapVideoBlock"){
|
||||
continue; // Skip if the segment is a wrapVideoBlock
|
||||
}
|
||||
let url_part = video_segment.split("<a href=\"").collect::<Vec<&str>>()[1]
|
||||
.split("\"")
|
||||
.collect::<Vec<&str>>()[0]);
|
||||
.collect::<Vec<&str>>()[0];
|
||||
if url_part.is_empty() || url_part == "javascript:void(0)" {
|
||||
continue;
|
||||
}
|
||||
let url = format!("{}{}", self.url, url_part);
|
||||
if url == "https://www.pornhub.comjavascript:void(0)".to_string() {
|
||||
continue;
|
||||
}
|
||||
@@ -201,7 +208,12 @@ impl PornhubProvider {
|
||||
.collect::<Vec<&str>>()[0]
|
||||
.to_string();
|
||||
let duration = parse_time_to_seconds(&raw_duration).unwrap_or(0) as u32;
|
||||
let views = parse_abbreviated_number(video_segment.split("iews\">").collect::<Vec<&str>>()[1]
|
||||
let view_part = match video_segment.split("iews\">").collect::<Vec<&str>>().len(){
|
||||
2 => video_segment.split("iews\">").collect::<Vec<&str>>()[1],
|
||||
3 => video_segment.split("iews\">").collect::<Vec<&str>>()[2],
|
||||
_ => continue, // Skip if the format is unexpected
|
||||
};
|
||||
let views = parse_abbreviated_number(view_part
|
||||
.split("<var>").collect::<Vec<&str>>()[1]
|
||||
.split("<")
|
||||
.collect::<Vec<&str>>()[0]).unwrap_or(0);
|
||||
|
||||
Reference in New Issue
Block a user