views and tags on pornhat
This commit is contained in:
@@ -193,7 +193,7 @@ impl PornhatProvider {
|
|||||||
return vec![];
|
return vec![];
|
||||||
}
|
}
|
||||||
let mut items: Vec<VideoItem> = Vec::new();
|
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_")
|
.split("<div class=\"item thumb-bl thumb-bl-video video_")
|
||||||
.collect::<Vec<&str>>()[1..]
|
.collect::<Vec<&str>>()[1..]
|
||||||
.to_vec();
|
.to_vec();
|
||||||
@@ -233,26 +233,33 @@ impl PornhatProvider {
|
|||||||
if video_segment.contains("href=\"/sites/"){
|
if video_segment.contains("href=\"/sites/"){
|
||||||
let raw_tags = video_segment.split("href=\"/sites/").collect::<Vec<&str>>()[1..]
|
let raw_tags = video_segment.split("href=\"/sites/").collect::<Vec<&str>>()[1..]
|
||||||
.iter()
|
.iter()
|
||||||
.map(|s| s.split("\"").collect::<Vec<&str>>()[0].to_string())
|
.map(|s| s.split("/\"").collect::<Vec<&str>>()[0].to_string())
|
||||||
.collect::<Vec<String>>();
|
.collect::<Vec<String>>();
|
||||||
for tag in raw_tags {
|
for tag in raw_tags {
|
||||||
if !tag.is_empty() {
|
if !tag.is_empty() {
|
||||||
tags.push(tag);
|
tags.push(format!("@sites:{}",tag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if video_segment.contains("href=\"/models/"){
|
if video_segment.contains("href=\"/models/"){
|
||||||
let raw_tags = video_segment.split("href=\"/models/").collect::<Vec<&str>>()[1..]
|
let raw_tags = video_segment.split("href=\"/models/").collect::<Vec<&str>>()[1..]
|
||||||
.iter()
|
.iter()
|
||||||
.map(|s| s.split("\"").collect::<Vec<&str>>()[0].to_string())
|
.map(|s| s.split("/\"").collect::<Vec<&str>>()[0].to_string())
|
||||||
.collect::<Vec<String>>();
|
.collect::<Vec<String>>();
|
||||||
for tag in raw_tags {
|
for tag in raw_tags {
|
||||||
if !tag.is_empty() {
|
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(
|
let video_item = VideoItem::new(
|
||||||
id,
|
id,
|
||||||
title,
|
title,
|
||||||
@@ -262,6 +269,8 @@ impl PornhatProvider {
|
|||||||
duration,
|
duration,
|
||||||
)
|
)
|
||||||
.preview(preview_url)
|
.preview(preview_url)
|
||||||
|
.views(views)
|
||||||
|
.tags(tags)
|
||||||
;
|
;
|
||||||
items.push(video_item);
|
items.push(video_item);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user