omgxxx bugfix
This commit is contained in:
@@ -10,8 +10,8 @@ use async_trait::async_trait;
|
||||
use error_chain::error_chain;
|
||||
use htmlentity::entity::{ICodedDataTrait, decode};
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::thread;
|
||||
use std::vec;
|
||||
use std::{thread};
|
||||
|
||||
error_chain! {
|
||||
foreign_links {
|
||||
@@ -91,11 +91,11 @@ impl OmgxxxProvider {
|
||||
break;
|
||||
}
|
||||
let stars_div = text
|
||||
.split("id=\"list_models_models_list_items\"").collect::<Vec<&str>>()[1]
|
||||
.split("class=\"pagination\"").collect::<Vec<&str>>()[0];
|
||||
for stars_element in
|
||||
stars_div.split("<a ").collect::<Vec<&str>>()[1..].to_vec()
|
||||
{
|
||||
.split("id=\"list_models_models_list_items\"")
|
||||
.collect::<Vec<&str>>()[1]
|
||||
.split("class=\"pagination\"")
|
||||
.collect::<Vec<&str>>()[0];
|
||||
for stars_element in stars_div.split("<a ").collect::<Vec<&str>>()[1..].to_vec() {
|
||||
let star_url = stars_element.split("href=\"").collect::<Vec<&str>>()[1]
|
||||
.split("\"")
|
||||
.collect::<Vec<&str>>()[0];
|
||||
@@ -129,8 +129,10 @@ impl OmgxxxProvider {
|
||||
break;
|
||||
}
|
||||
let sites_div = text
|
||||
.split("id=\"list_content_sources_sponsors_list_items\"").collect::<Vec<&str>>()[1]
|
||||
.split("class=\"pagination\"").collect::<Vec<&str>>()[0];
|
||||
.split("id=\"list_content_sources_sponsors_list_items\"")
|
||||
.collect::<Vec<&str>>()[1]
|
||||
.split("class=\"pagination\"")
|
||||
.collect::<Vec<&str>>()[0];
|
||||
for sites_element in
|
||||
sites_div.split("class=\"headline\"").collect::<Vec<&str>>()[1..].to_vec()
|
||||
{
|
||||
@@ -301,19 +303,31 @@ impl OmgxxxProvider {
|
||||
&& !options.network.as_ref().unwrap().is_empty()
|
||||
&& options.network.as_ref().unwrap() != "all"
|
||||
{
|
||||
sort_string = format!("networks/{}{}", options.network.as_ref().unwrap(), alt_sort_string);
|
||||
sort_string = format!(
|
||||
"networks/{}{}",
|
||||
options.network.as_ref().unwrap(),
|
||||
alt_sort_string
|
||||
);
|
||||
}
|
||||
if options.sites.is_some()
|
||||
&& !options.sites.as_ref().unwrap().is_empty()
|
||||
&& options.sites.as_ref().unwrap() != "all"
|
||||
{
|
||||
sort_string = format!("sites/{}{}", options.sites.as_ref().unwrap(), alt_sort_string);
|
||||
sort_string = format!(
|
||||
"sites/{}{}",
|
||||
options.sites.as_ref().unwrap(),
|
||||
alt_sort_string
|
||||
);
|
||||
}
|
||||
if options.stars.is_some()
|
||||
&& !options.stars.as_ref().unwrap().is_empty()
|
||||
&& options.stars.as_ref().unwrap() != "all"
|
||||
{
|
||||
sort_string = format!("models/{}{}", options.stars.as_ref().unwrap(), alt_sort_string);
|
||||
sort_string = format!(
|
||||
"models/{}{}",
|
||||
options.stars.as_ref().unwrap(),
|
||||
alt_sort_string
|
||||
);
|
||||
}
|
||||
let video_url = format!("{}/{}/{}/", self.url, sort_string, page);
|
||||
let old_items = match cache.get(&video_url) {
|
||||
@@ -350,18 +364,16 @@ impl OmgxxxProvider {
|
||||
options: ServerOptions,
|
||||
) -> Result<Vec<VideoItem>> {
|
||||
let mut search_type = "search";
|
||||
let mut search_string = query.to_string().to_lowercase().trim().replace(" ", "-");
|
||||
if query.starts_with("@") {
|
||||
search_type = query.split(":").collect::<Vec<&str>>()[0].trim_start_matches("@");
|
||||
search_string = search_string.split(":").collect::<Vec<&str>>()[1].to_string();
|
||||
}
|
||||
let video_url = format!(
|
||||
"{}/{}/{}/{}/",
|
||||
self.url,
|
||||
search_type,
|
||||
query
|
||||
.split(":").collect::<Vec<&str>>()[1]
|
||||
.to_lowercase()
|
||||
.trim()
|
||||
.replace(" ", "-"),
|
||||
search_string,
|
||||
page
|
||||
);
|
||||
// Check our Video Cache. If the result is younger than 1 hour, we return it.
|
||||
@@ -395,7 +407,13 @@ impl OmgxxxProvider {
|
||||
fn get_site_id_from_name(&self, site_name: &str) -> Option<String> {
|
||||
// site_name.to_lowercase().replace(" ", "")
|
||||
for site in self.sites.read().unwrap().iter() {
|
||||
if site.title.to_lowercase().replace(" ", "").replace(".com", "") == site_name.to_lowercase().replace(" ", "") {
|
||||
if site
|
||||
.title
|
||||
.to_lowercase()
|
||||
.replace(" ", "")
|
||||
.replace(".com", "")
|
||||
== site_name.to_lowercase().replace(" ", "")
|
||||
{
|
||||
return Some(site.id.clone());
|
||||
}
|
||||
}
|
||||
@@ -479,9 +497,15 @@ impl OmgxxxProvider {
|
||||
.split("\"")
|
||||
.collect::<Vec<&str>>()[0]
|
||||
.to_string();
|
||||
let site_name = title.split("]").collect::<Vec<&str>>().first().unwrap_or(&"").trim_start_matches("[");
|
||||
let site_id = self.get_site_id_from_name(site_name).unwrap_or("".to_string());
|
||||
println!("Site: {}\nTitle: {}", site_id, title);
|
||||
let site_name = title
|
||||
.split("]")
|
||||
.collect::<Vec<&str>>()
|
||||
.first()
|
||||
.unwrap_or(&"")
|
||||
.trim_start_matches("[");
|
||||
let site_id = self
|
||||
.get_site_id_from_name(site_name)
|
||||
.unwrap_or("".to_string());
|
||||
let mut tags = match video_segment.contains("class=\"models\">") {
|
||||
true => video_segment
|
||||
.split("class=\"models\">")
|
||||
|
||||
Reference in New Issue
Block a user