diff --git a/src/providers/xfree.rs b/src/providers/xfree.rs index 73e027b..822614d 100644 --- a/src/providers/xfree.rs +++ b/src/providers/xfree.rs @@ -62,31 +62,28 @@ impl XfreeProvider { ); vec![] }), - options: vec![ - ChannelOption { - id: "sexuality".to_string(), - title: "Sexuality".to_string(), - description: "Sexuality of the Videos".to_string(), - systemImage: "heart".to_string(), - colorName: "red".to_string(), - multiSelect: false, - options: vec![ - FilterOption { - id: "1".to_string(), - title: "Straight".to_string(), - }, - FilterOption { - id: "2".to_string(), - title: "Gay".to_string(), - }, - FilterOption { - id: "3".to_string(), - title: "Trans".to_string(), - }, - ], - - }, - ], + options: vec![ChannelOption { + id: "sexuality".to_string(), + title: "Sexuality".to_string(), + description: "Sexuality of the Videos".to_string(), + systemImage: "heart".to_string(), + colorName: "red".to_string(), + multiSelect: false, + options: vec![ + FilterOption { + id: "1".to_string(), + title: "Straight".to_string(), + }, + FilterOption { + id: "2".to_string(), + title: "Gay".to_string(), + }, + FilterOption { + id: "3".to_string(), + title: "Trans".to_string(), + }, + ], + }], nsfw: true, cacheDuration: None, } @@ -138,13 +135,21 @@ impl XfreeProvider { let mut requester = crate::providers::requester_or_default(&options, module_path!(), "missing_requester"); // let _ = requester.get("https://www.xfree.com/", Some(Version::HTTP_2)).await; - let text = match requester.get_with_headers(&video_url, vec![ - ("Apiversion".to_string(), "1.0".to_string()), - ("Accept".to_string(), "application/json text/plain */*".to_string()), - ("Referer".to_string(), "https://www.xfree.com/".to_string()), - ], - Some(Version::HTTP_2), - ).await { + let text = match requester + .get_with_headers( + &video_url, + vec![ + ("Apiversion".to_string(), "1.0".to_string()), + ( + "Accept".to_string(), + "application/json text/plain */*".to_string(), + ), + ("Referer".to_string(), "https://www.xfree.com/".to_string()), + ], + Some(Version::HTTP_2), + ) + .await + { Ok(text) => text, Err(e) => { crate::providers::report_provider_error( @@ -190,7 +195,9 @@ impl XfreeProvider { } }; - for post in json.get("body").and_then(|v| v.get("posts")) + for post in json + .get("body") + .and_then(|v| v.get("posts")) .and_then(|p| p.as_array()) .unwrap_or(&vec![]) { @@ -239,14 +246,16 @@ impl XfreeProvider { .and_then(|v| v.as_array()) .unwrap_or(&vec![]) .iter() - .filter_map(|t| - t.get("tag").and_then(|n| n.as_str()).map(|s| s.to_string())) + .filter_map(|t| t.get("tag").and_then(|n| n.as_str()).map(|s| s.to_string())) .collect::>(); for tag in tags.iter() { - Self::push_unique(&self.categories, FilterOption { - id: tag.clone(), - title: tag.clone(), - }); + Self::push_unique( + &self.categories, + FilterOption { + id: tag.clone(), + title: tag.clone(), + }, + ); } let uploader = post .get("user") @@ -269,8 +278,7 @@ impl XfreeProvider { .unwrap_or_default() .to_string() .parse::() - .unwrap_or(0.5625) - ; + .unwrap_or(0.5625); let video_item = VideoItem::new( id.to_string(), title, @@ -305,7 +313,16 @@ impl Provider for XfreeProvider { ) -> Vec { let page = page.parse::().unwrap_or(1); - let res = self.to_owned().query(cache, page, &query.unwrap_or("null".to_string()), options, pool).await; + let res = self + .to_owned() + .query( + cache, + page, + &query.unwrap_or("null".to_string()), + options, + pool, + ) + .await; res.unwrap_or_else(|e| { eprintln!("xfree error: {e}"); diff --git a/src/videos.rs b/src/videos.rs index 6df3c24..3871141 100644 --- a/src/videos.rs +++ b/src/videos.rs @@ -50,7 +50,7 @@ pub struct VideosRequest { pub networks: Option, // pub stars: Option, // pub categories: Option, - pub duration: Option + pub duration: Option, } #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] @@ -66,7 +66,7 @@ pub struct ServerOptions { pub categories: Option, // pub duration: Option, // pub sort: Option, // - pub sexuality: Option, // + pub sexuality: Option, // } #[derive(serde::Serialize, Debug)]