updates, enables networks on omgxxx
This commit is contained in:
@@ -28,7 +28,6 @@ pub struct OmgxxxProvider {
|
||||
}
|
||||
impl OmgxxxProvider {
|
||||
pub fn new() -> Self {
|
||||
println!("new");
|
||||
let provider = OmgxxxProvider {
|
||||
url: "https://www.omg.xxx".to_string(),
|
||||
sites: Arc::new(RwLock::new(vec![])),
|
||||
@@ -41,7 +40,6 @@ impl OmgxxxProvider {
|
||||
}
|
||||
|
||||
fn spawn_initial_load(&self) {
|
||||
println!("spawn_initial_load");
|
||||
let url = self.url.clone();
|
||||
// let sites = Arc::clone(&self.sites);
|
||||
let networks = Arc::clone(&self.networks);
|
||||
@@ -85,7 +83,6 @@ impl OmgxxxProvider {
|
||||
// }
|
||||
|
||||
async fn load_networks(base_url: &str, networks: Arc<RwLock<Vec<FilterOption>>>) -> Result<()> {
|
||||
println!("load_networks");
|
||||
let mut requester = util::requester::Requester::new();
|
||||
let text = requester.get(&base_url).await.unwrap();
|
||||
let networks_div = text.split("class=\"sites__list\"").collect::<Vec<&str>>()[1]
|
||||
@@ -199,11 +196,14 @@ impl OmgxxxProvider {
|
||||
sort: &str,
|
||||
options: ServerOptions,
|
||||
) -> Result<Vec<VideoItem>> {
|
||||
let sort_string = match sort {
|
||||
"top-rated" => "top-rated",
|
||||
"most-popular" => "most-popular",
|
||||
_ => "latest-updates",
|
||||
let mut sort_string:String = match sort {
|
||||
"top-rated" => "top-rated".to_string(),
|
||||
"most-popular" => "most-popular".to_string(),
|
||||
_ => "latest-updates".to_string(),
|
||||
};
|
||||
if options.network.is_some() && !options.network.as_ref().unwrap().is_empty(){
|
||||
sort_string = format!("networks/{}",options.network.as_ref().unwrap());
|
||||
}
|
||||
let video_url = format!("{}/{}/{}/", self.url, sort_string, page);
|
||||
let old_items = match cache.get(&video_url) {
|
||||
Some((time, items)) => {
|
||||
@@ -219,6 +219,7 @@ impl OmgxxxProvider {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
let mut requester = options.requester.clone().unwrap();
|
||||
let text = requester.get(&video_url).await.unwrap();
|
||||
let video_items: Vec<VideoItem> = self.get_video_items_from_html(text.clone());
|
||||
@@ -427,10 +428,6 @@ impl Provider for OmgxxxProvider {
|
||||
}
|
||||
}
|
||||
fn get_channel(&self, clientversion: ClientVersion) -> crate::status::Channel {
|
||||
println!(
|
||||
"Getting channel for omgxxx with client version: {:?}",
|
||||
clientversion
|
||||
);
|
||||
self.build_channel(clientversion)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user