upgrades
This commit is contained in:
@@ -5,7 +5,7 @@ use crate::status::*;
|
||||
use crate::util::cache::VideoCache;
|
||||
use crate::util::parse_abbreviated_number;
|
||||
use crate::util::time::parse_time_to_seconds;
|
||||
use crate::videos::{ServerOptions, VideoItem};
|
||||
use crate::videos::{ServerOptions, VideoFormat, VideoItem};
|
||||
use async_trait::async_trait;
|
||||
use error_chain::error_chain;
|
||||
use htmlentity::entity::{ICodedDataTrait, decode};
|
||||
@@ -299,8 +299,20 @@ impl XxthotsProvider {
|
||||
.unwrap_or_default()
|
||||
.to_string();
|
||||
let views = parse_abbreviated_number(&views_part).unwrap_or(0) as u32;
|
||||
let preview = video_segment
|
||||
.split("data-preview=\"")
|
||||
.collect::<Vec<&str>>()
|
||||
.get(1)
|
||||
.copied()
|
||||
.unwrap_or_default()
|
||||
.split('"')
|
||||
.collect::<Vec<&str>>()
|
||||
.first()
|
||||
.copied()
|
||||
.unwrap_or_default()
|
||||
.to_string();
|
||||
|
||||
let video_item = VideoItem::new(
|
||||
let mut video_item = VideoItem::new(
|
||||
id,
|
||||
title,
|
||||
video_url.to_string(),
|
||||
@@ -309,6 +321,15 @@ impl XxthotsProvider {
|
||||
duration,
|
||||
)
|
||||
.views(views);
|
||||
if !preview.is_empty() {
|
||||
let mut format = VideoFormat::new(
|
||||
preview.clone(),
|
||||
"preview".to_string(),
|
||||
"video/mp4".to_string(),
|
||||
);
|
||||
format.add_http_header("Referer".to_string(), video_url.clone());
|
||||
video_item = video_item.preview(preview).formats(vec![format]);
|
||||
}
|
||||
items.push(video_item);
|
||||
}
|
||||
return items;
|
||||
|
||||
Reference in New Issue
Block a user