implemented tags for videos
This commit is contained in:
@@ -152,15 +152,17 @@ impl PerverzijaProvider {
|
||||
.split("video-item post")
|
||||
.collect::<Vec<&str>>()[1..]
|
||||
.to_vec();
|
||||
// println!("Raw Videos: {:?}", raw_videos);
|
||||
for video_segment in &raw_videos {
|
||||
let vid = video_segment.split("\n").collect::<Vec<&str>>();
|
||||
// let mut index = 0;
|
||||
if vid.len() > 20 {
|
||||
println!("Skipping video segment with unexpected length: {}", vid.len());
|
||||
continue;
|
||||
}
|
||||
|
||||
for (i, line) in vid.iter().enumerate() {
|
||||
if line.trim().is_empty() {
|
||||
println!("Empty line at index {}: {}", i, line);
|
||||
}
|
||||
}
|
||||
let mut title = vid[1].split(">").collect::<Vec<&str>>()[1]
|
||||
.split("<")
|
||||
.collect::<Vec<&str>>()[0]
|
||||
@@ -208,6 +210,17 @@ impl PerverzijaProvider {
|
||||
.collect::<Vec<&str>>()[0]
|
||||
.to_string();
|
||||
let embed = Video_Embed::new(embed_html, url.clone());
|
||||
|
||||
let mut tags: Vec<String> = Vec::new(); // Placeholder for tags, adjust as needed
|
||||
for tag in vid[0].split(" ").collect::<Vec<&str>>(){
|
||||
if tag.starts_with("tag-") {
|
||||
let tag_name = tag.split("tag-").collect::<Vec<&str>>()[1]
|
||||
.to_string();
|
||||
if !tag_name.is_empty() {
|
||||
tags.push(tag_name.replace("-", " ").to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut video_item = Video_Item::new(
|
||||
id,
|
||||
title,
|
||||
@@ -215,8 +228,8 @@ impl PerverzijaProvider {
|
||||
"perverzija".to_string(),
|
||||
thumb,
|
||||
duration,
|
||||
);
|
||||
video_item.embed = Some(embed);
|
||||
).tags(tags)
|
||||
.embed(embed.clone());
|
||||
let mut format =
|
||||
videos::Video_Format::new(url.clone(), "1080".to_string(), "m3u8".to_string());
|
||||
format.add_http_header("Referer".to_string(), referer_url.clone());
|
||||
@@ -268,7 +281,6 @@ impl PerverzijaProvider {
|
||||
18 => 14,
|
||||
13 => 8,
|
||||
_ => {
|
||||
println!("Unexpected video segment length: {}", vid.len());
|
||||
continue;
|
||||
}
|
||||
};
|
||||
@@ -296,6 +308,17 @@ impl PerverzijaProvider {
|
||||
.collect::<Vec<&str>>()[0]
|
||||
.to_string();
|
||||
let embed = Video_Embed::new(embed_html, url.clone());
|
||||
let mut tags: Vec<String> = Vec::new(); // Placeholder for tags, adjust as needed
|
||||
for tag in vid[0].split(" ").collect::<Vec<&str>>(){
|
||||
if tag.starts_with("tag-") {
|
||||
let tag_name = tag.split("tag-").collect::<Vec<&str>>()[1]
|
||||
.to_string();
|
||||
if !tag_name.is_empty() {
|
||||
tags.push(tag_name.replace("-", " ").to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mut video_item = Video_Item::new(
|
||||
id,
|
||||
title,
|
||||
@@ -303,8 +326,9 @@ impl PerverzijaProvider {
|
||||
"perverzija".to_string(),
|
||||
thumb,
|
||||
duration,
|
||||
);
|
||||
video_item.embed = Some(embed);
|
||||
)
|
||||
.tags(tags)
|
||||
.embed(embed.clone());
|
||||
let mut format =
|
||||
videos::Video_Format::new(url.clone(), "1080".to_string(), "m3u8".to_string());
|
||||
format.add_http_header("Referer".to_string(), referer_url.clone());
|
||||
|
||||
Reference in New Issue
Block a user