diff --git a/src/providers/hqporner.rs b/src/providers/hqporner.rs index c539f4b..e86e8e4 100644 --- a/src/providers/hqporner.rs +++ b/src/providers/hqporner.rs @@ -206,7 +206,6 @@ impl HqpornerProvider { if let Some(cat) = self.categories.read().unwrap().iter().find(|c| c.title.to_ascii_lowercase() == search_string.to_ascii_lowercase()) { video_url = format!("{}/category/{}/{}", self.url, cat.id, page); } - println!("Searching URL: {}", video_url); // 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)) => { @@ -310,7 +309,10 @@ impl HqpornerProvider { .to_string(); let duration = parse_time_to_seconds(raw_duration.as_str()).unwrap_or(0) as u32; - let (tags, formats) = self.extract_media(&video_url, &mut requester).await; + let (tags, formats) = match self.extract_media(&video_url, &mut requester).await{ + Ok((t, f)) => (t, f), + Err(_) => return Err(Error::from("Video media extraction failed")), + }; if formats.is_empty() { return Err(Error::from("No formats found for video")); } @@ -331,12 +333,13 @@ impl HqpornerProvider { &self, video_page_url: &str, requester: &mut Requester, - ) -> (Vec, Vec) { + ) -> Result<(Vec, Vec)> { let mut formats = vec![]; let mut tags = vec![]; - let text = requester.get(&video_page_url).await.unwrap(); + let text = requester.get_raw_with_headers(&video_page_url, vec![("Referer".to_string(), "https://hqporner.com".to_string())]) + .await.unwrap().text().await.unwrap(); if text.contains("Why do I see it?") { - return (tags, formats); + return Ok((tags, formats)); } let stars_elements = text.split("icon fa-star-o").collect::>()[1] .split("") @@ -392,6 +395,10 @@ impl HqpornerProvider { .text() .await .unwrap(); + match text2.split("