more bugfixes

This commit is contained in:
Simon
2025-07-19 15:38:08 +00:00
parent 7d933384c4
commit 441780f29b

View File

@@ -54,8 +54,12 @@ impl PornhubProvider {
let proxy = Proxy::all("http://192.168.0.103:8081").unwrap(); let proxy = Proxy::all("http://192.168.0.103:8081").unwrap();
let client = Client::builder().cert_verification(false).emulation(Emulation::Firefox136).build()?; let client = Client::builder().cert_verification(false).emulation(Emulation::Firefox136).build()?;
let response = client.get(url.clone()).proxy(proxy).send().await?; let mut response = client.get(url.clone()).proxy(proxy.clone()).send().await?;
if response.status().is_success() || response.status().is_redirection() { if response.status().is_redirection(){
response = client.get(self.url.clone() + response.headers()["Location"].to_str().unwrap()).proxy(proxy).send().await?;
}
if response.status().is_success() {
let text = response.text().await?; let text = response.text().await?;
let video_items: Vec<VideoItem> = self.get_video_items_from_html(text.clone(),"<ul id=\"video"); let video_items: Vec<VideoItem> = self.get_video_items_from_html(text.clone(),"<ul id=\"video");
if !video_items.is_empty() { if !video_items.is_empty() {
@@ -145,7 +149,13 @@ impl PornhubProvider {
let proxy = Proxy::all("http://192.168.0.103:8081").unwrap(); let proxy = Proxy::all("http://192.168.0.103:8081").unwrap();
let client = Client::builder().cert_verification(false).emulation(Emulation::Firefox136).build()?; let client = Client::builder().cert_verification(false).emulation(Emulation::Firefox136).build()?;
let response = client.get(url.clone()).proxy(proxy).send().await?; let mut response = client.get(url.clone()).proxy(proxy.clone()).send().await?;
if response.status().is_redirection(){
response = client.get(self.url.clone() + response.headers()["Location"].to_str().unwrap()).proxy(proxy).send().await?;
}
if response.status().is_success() { if response.status().is_success() {
let text = response.text().await?; let text = response.text().await?;
let video_items: Vec<VideoItem> = self.get_video_items_from_html(text.clone(),split_string); let video_items: Vec<VideoItem> = self.get_video_items_from_html(text.clone(),split_string);