diff --git a/src/providers/pornhub.rs b/src/providers/pornhub.rs
index a0c4a9d..5a02155 100644
--- a/src/providers/pornhub.rs
+++ b/src/providers/pornhub.rs
@@ -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(">()[1]
+ if video_segment.contains("wrapVideoBlock"){
+ continue; // Skip if the segment is a wrapVideoBlock
+ }
+ let url_part = video_segment.split(">()[1]
.split("\"")
- .collect::>()[0]);
+ .collect::>()[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::>()[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::>()[1]
+ let view_part = match video_segment.split("iews\">").collect::>().len(){
+ 2 => video_segment.split("iews\">").collect::>()[1],
+ 3 => video_segment.split("iews\">").collect::>()[2],
+ _ => continue, // Skip if the format is unexpected
+ };
+ let views = parse_abbreviated_number(view_part
.split("").collect::>()[1]
.split("<")
.collect::>()[0]).unwrap_or(0);