diff --git a/src/providers/omgxxx.rs b/src/providers/omgxxx.rs
index 9b7a2e4..6c4413e 100644
--- a/src/providers/omgxxx.rs
+++ b/src/providers/omgxxx.rs
@@ -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("
")
- .collect::
>().last().unwrap()
+ .collect::>()
+ .last()
+ .unwrap()
.split("custom_list_models_models_list_pagination")
.collect::>()[0];
for stars_element in stars_div.split(">()[1..].to_vec() {
@@ -100,7 +105,9 @@ impl OmgxxxProvider {
.split("\"")
.collect::>()[0];
let star_id = star_url.split("/").collect::>()[4].to_string();
- let star_name = stars_element.split("").collect::>()[1]
+ let star_name = stars_element
+ .split("")
+ .collect::>()[1]
.split("<")
.collect::>()[0]
.to_string();
@@ -363,18 +370,34 @@ impl OmgxxxProvider {
options: ServerOptions,
) -> Result> {
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::>()[0].trim_start_matches("@");
- search_string = search_string.split(":").collect::>()[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::>()[1..]
.into_iter()
.map(|s| {
- format!(
- "@models:{}",
- s.split("/").collect::>()[4].to_string()
- )
+ Self::push_unique(
+ &self.stars,
+ FilterOption {
+ id: s.split("/").collect::>()[4].to_string(),
+ title: s.split(">").collect::>()[1]
+ .split("<")
+ .collect::>()[0]
+ .trim()
+ .to_string(),
+ },
+ );
+ s.split(">").collect::>()[1]
+ .split("<")
+ .collect::>()[0]
+ .trim()
+ .to_string()
})
.collect::>()
.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(