better tag system

This commit is contained in:
Simon
2025-12-11 11:58:11 +00:00
parent 9789afb12b
commit 6536fb13b3

View File

@@ -84,7 +84,10 @@ impl OmgxxxProvider {
let mut requester = util::requester::Requester::new();
for page in [1..10].into_iter().flatten() {
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
.unwrap();
if text.contains("404 Not Found") || text.is_empty() {
@@ -92,7 +95,9 @@ impl OmgxxxProvider {
}
let stars_div = text
.split("<div class=\"list-models\">")
.collect::<Vec<&str>>().last().unwrap()
.collect::<Vec<&str>>()
.last()
.unwrap()
.split("custom_list_models_models_list_pagination")
.collect::<Vec<&str>>()[0];
for stars_element in stars_div.split("<a ").collect::<Vec<&str>>()[1..].to_vec() {
@@ -100,7 +105,9 @@ impl OmgxxxProvider {
.split("\"")
.collect::<Vec<&str>>()[0];
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("<")
.collect::<Vec<&str>>()[0]
.to_string();
@@ -363,18 +370,34 @@ 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 mut search_string = query.to_string().to_ascii_lowercase().trim().to_string();
match self
.stars
.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!(
"{}/{}/{}/{}/",
self.url,
search_type,
search_string,
page
);
match self
.sites
.read()
.unwrap()
.iter()
.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.
let old_items = match cache.get(&video_url) {
Some((time, items)) => {
@@ -516,17 +539,36 @@ impl OmgxxxProvider {
.collect::<Vec<&str>>()[1..]
.into_iter()
.map(|s| {
format!(
"@models:{}",
s.split("/").collect::<Vec<&str>>()[4].to_string()
)
Self::push_unique(
&self.stars,
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>>()
.to_vec(),
false => vec![],
};
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(