views and tags on pornhat

This commit is contained in:
Simon
2025-08-14 18:38:23 +00:00
parent ca44f08393
commit e67025e104

View File

@@ -193,7 +193,7 @@ impl PornhatProvider {
return vec![];
}
let mut items: Vec<VideoItem> = Vec::new();
let raw_videos = html
let raw_videos = html.split("<div class=\"pagination\"").collect::<Vec<&str>>()[0]
.split("<div class=\"item thumb-bl thumb-bl-video video_")
.collect::<Vec<&str>>()[1..]
.to_vec();
@@ -233,26 +233,33 @@ impl PornhatProvider {
if video_segment.contains("href=\"/sites/"){
let raw_tags = video_segment.split("href=\"/sites/").collect::<Vec<&str>>()[1..]
.iter()
.map(|s| s.split("\"").collect::<Vec<&str>>()[0].to_string())
.map(|s| s.split("/\"").collect::<Vec<&str>>()[0].to_string())
.collect::<Vec<String>>();
for tag in raw_tags {
if !tag.is_empty() {
tags.push(tag);
tags.push(format!("@sites:{}",tag));
}
}
}
if video_segment.contains("href=\"/models/"){
let raw_tags = video_segment.split("href=\"/models/").collect::<Vec<&str>>()[1..]
.iter()
.map(|s| s.split("\"").collect::<Vec<&str>>()[0].to_string())
.map(|s| s.split("/\"").collect::<Vec<&str>>()[0].to_string())
.collect::<Vec<String>>();
for tag in raw_tags {
if !tag.is_empty() {
tags.push(tag);
tags.push(format!("@models:{}",tag));
}
}
}
let views_part = video_segment.split("fa fa-eye").collect::<Vec<&str>>()[1]
.split("<span>").collect::<Vec<&str>>()[1]
.split("<")
.collect::<Vec<&str>>()[0]
.to_string();
let views = parse_abbreviated_number(&views_part).unwrap_or(0) as u32;
let video_item = VideoItem::new(
id,
title,
@@ -262,6 +269,8 @@ impl PornhatProvider {
duration,
)
.preview(preview_url)
.views(views)
.tags(tags)
;
items.push(video_item);
}