better tag system
This commit is contained in:
@@ -84,7 +84,10 @@ impl OmgxxxProvider {
|
|||||||
let mut requester = util::requester::Requester::new();
|
let mut requester = util::requester::Requester::new();
|
||||||
for page in [1..10].into_iter().flatten() {
|
for page in [1..10].into_iter().flatten() {
|
||||||
let text = requester
|
let text = requester
|
||||||
.get(format!("{}/models/total-videos/{}/?gender_id=0", &base_url, page).as_str(), None)
|
.get(
|
||||||
|
format!("{}/models/total-videos/{}/?gender_id=0", &base_url, page).as_str(),
|
||||||
|
None,
|
||||||
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
if text.contains("404 Not Found") || text.is_empty() {
|
if text.contains("404 Not Found") || text.is_empty() {
|
||||||
@@ -92,7 +95,9 @@ impl OmgxxxProvider {
|
|||||||
}
|
}
|
||||||
let stars_div = text
|
let stars_div = text
|
||||||
.split("<div class=\"list-models\">")
|
.split("<div class=\"list-models\">")
|
||||||
.collect::<Vec<&str>>().last().unwrap()
|
.collect::<Vec<&str>>()
|
||||||
|
.last()
|
||||||
|
.unwrap()
|
||||||
.split("custom_list_models_models_list_pagination")
|
.split("custom_list_models_models_list_pagination")
|
||||||
.collect::<Vec<&str>>()[0];
|
.collect::<Vec<&str>>()[0];
|
||||||
for stars_element in stars_div.split("<a ").collect::<Vec<&str>>()[1..].to_vec() {
|
for stars_element in stars_div.split("<a ").collect::<Vec<&str>>()[1..].to_vec() {
|
||||||
@@ -100,7 +105,9 @@ impl OmgxxxProvider {
|
|||||||
.split("\"")
|
.split("\"")
|
||||||
.collect::<Vec<&str>>()[0];
|
.collect::<Vec<&str>>()[0];
|
||||||
let star_id = star_url.split("/").collect::<Vec<&str>>()[4].to_string();
|
let star_id = star_url.split("/").collect::<Vec<&str>>()[4].to_string();
|
||||||
let star_name = stars_element.split("<strong class=\"title\">").collect::<Vec<&str>>()[1]
|
let star_name = stars_element
|
||||||
|
.split("<strong class=\"title\">")
|
||||||
|
.collect::<Vec<&str>>()[1]
|
||||||
.split("<")
|
.split("<")
|
||||||
.collect::<Vec<&str>>()[0]
|
.collect::<Vec<&str>>()[0]
|
||||||
.to_string();
|
.to_string();
|
||||||
@@ -363,18 +370,34 @@ impl OmgxxxProvider {
|
|||||||
options: ServerOptions,
|
options: ServerOptions,
|
||||||
) -> Result<Vec<VideoItem>> {
|
) -> Result<Vec<VideoItem>> {
|
||||||
let mut search_type = "search";
|
let mut search_type = "search";
|
||||||
let mut search_string = query.to_string().to_lowercase().trim().replace(" ", "-");
|
let mut search_string = query.to_string().to_ascii_lowercase().trim().to_string();
|
||||||
if query.starts_with("@") {
|
match self
|
||||||
search_type = query.split(":").collect::<Vec<&str>>()[0].trim_start_matches("@");
|
.stars
|
||||||
search_string = search_string.split(":").collect::<Vec<&str>>()[1].to_string();
|
.read()
|
||||||
|
.unwrap()
|
||||||
|
.iter()
|
||||||
|
.find(|s| s.title.to_ascii_lowercase() == search_string)
|
||||||
|
{
|
||||||
|
Some(star) => {
|
||||||
|
search_type = "models";
|
||||||
|
search_string = star.id.clone();
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
let video_url = format!(
|
match self
|
||||||
"{}/{}/{}/{}/",
|
.sites
|
||||||
self.url,
|
.read()
|
||||||
search_type,
|
.unwrap()
|
||||||
search_string,
|
.iter()
|
||||||
page
|
.find(|s| s.title.to_ascii_lowercase() == search_string)
|
||||||
);
|
{
|
||||||
|
Some(site) => {
|
||||||
|
search_type = "sites";
|
||||||
|
search_string = site.id.clone();
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
let video_url = format!("{}/{}/{}/{}/", self.url, search_type, search_string, page);
|
||||||
// Check our Video Cache. If the result is younger than 1 hour, we return it.
|
// Check our Video Cache. If the result is younger than 1 hour, we return it.
|
||||||
let old_items = match cache.get(&video_url) {
|
let old_items = match cache.get(&video_url) {
|
||||||
Some((time, items)) => {
|
Some((time, items)) => {
|
||||||
@@ -516,17 +539,36 @@ impl OmgxxxProvider {
|
|||||||
.collect::<Vec<&str>>()[1..]
|
.collect::<Vec<&str>>()[1..]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|s| {
|
.map(|s| {
|
||||||
format!(
|
Self::push_unique(
|
||||||
"@models:{}",
|
&self.stars,
|
||||||
s.split("/").collect::<Vec<&str>>()[4].to_string()
|
FilterOption {
|
||||||
)
|
id: s.split("/").collect::<Vec<&str>>()[4].to_string(),
|
||||||
|
title: s.split(">").collect::<Vec<&str>>()[1]
|
||||||
|
.split("<")
|
||||||
|
.collect::<Vec<&str>>()[0]
|
||||||
|
.trim()
|
||||||
|
.to_string(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
s.split(">").collect::<Vec<&str>>()[1]
|
||||||
|
.split("<")
|
||||||
|
.collect::<Vec<&str>>()[0]
|
||||||
|
.trim()
|
||||||
|
.to_string()
|
||||||
})
|
})
|
||||||
.collect::<Vec<String>>()
|
.collect::<Vec<String>>()
|
||||||
.to_vec(),
|
.to_vec(),
|
||||||
false => vec![],
|
false => vec![],
|
||||||
};
|
};
|
||||||
if !site_id.is_empty() {
|
if !site_id.is_empty() {
|
||||||
tags.push(format!("@sites:{}", site_id));
|
Self::push_unique(
|
||||||
|
&self.sites,
|
||||||
|
FilterOption {
|
||||||
|
id: site_id,
|
||||||
|
title: site_name.to_string(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
tags.push(site_name.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
let video_item = VideoItem::new(
|
let video_item = VideoItem::new(
|
||||||
|
|||||||
Reference in New Issue
Block a user