fixes and cleanup
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
use crate::api::ClientVersion;
|
||||
use crate::util::parse_abbreviated_number;
|
||||
use crate::DbPool;
|
||||
use crate::api::ClientVersion;
|
||||
use crate::providers::Provider;
|
||||
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 error_chain::error_chain;
|
||||
use htmlentity::entity::{decode, ICodedDataTrait};
|
||||
use async_trait::async_trait;
|
||||
use error_chain::error_chain;
|
||||
use htmlentity::entity::{ICodedDataTrait, decode};
|
||||
use std::vec;
|
||||
|
||||
error_chain! {
|
||||
@@ -130,14 +130,22 @@ impl PornhubProvider {
|
||||
let mut split_string = "<ul id=\"video";
|
||||
let search_string = query.to_lowercase().trim().replace(' ', "+");
|
||||
|
||||
let mut video_url =
|
||||
format!("{}/video/search?search={}&page={}", self.url, search_string, page);
|
||||
let mut video_url = format!(
|
||||
"{}/video/search?search={}&page={}",
|
||||
self.url, search_string, page
|
||||
);
|
||||
|
||||
if query.starts_with('@') {
|
||||
let mut parts = query[1..].split(':');
|
||||
let a = parts.next().unwrap_or("");
|
||||
let b = parts.next().unwrap_or("");
|
||||
video_url = format!("{}/{}/{}/videos?page={}", self.url, a, b.replace(' ', "-"), page);
|
||||
video_url = format!(
|
||||
"{}/{}/{}/videos?page={}",
|
||||
self.url,
|
||||
a,
|
||||
b.replace(' ', "-"),
|
||||
page
|
||||
);
|
||||
|
||||
if query.contains("@model") || query.contains("@pornstar") {
|
||||
split_string = "mostRecentVideosSection";
|
||||
@@ -207,7 +215,9 @@ impl PornhubProvider {
|
||||
.and_then(|s| s.split('"').next());
|
||||
|
||||
let video_url = match url_part {
|
||||
Some(u) if !u.is_empty() && u != "javascript:void(0)" => format!("{}{}", self.url, u),
|
||||
Some(u) if !u.is_empty() && u != "javascript:void(0)" => {
|
||||
format!("{}{}", self.url, u)
|
||||
}
|
||||
_ => continue,
|
||||
};
|
||||
|
||||
@@ -274,14 +284,7 @@ impl PornhubProvider {
|
||||
(None, None)
|
||||
};
|
||||
|
||||
let mut item = VideoItem::new(
|
||||
id,
|
||||
title,
|
||||
video_url,
|
||||
"pornhub".into(),
|
||||
thumb,
|
||||
duration,
|
||||
);
|
||||
let mut item = VideoItem::new(id, title, video_url, "pornhub".into(), thumb, duration);
|
||||
|
||||
if views > 0 {
|
||||
item = item.views(views);
|
||||
|
||||
Reference in New Issue
Block a user