upgrades
This commit is contained in:
@@ -59,10 +59,7 @@ async fn main() -> std::io::Result<()> {
|
||||
let mut requester = util::requester::Requester::new();
|
||||
let proxy_enabled = env::var("PROXY").unwrap_or("0".to_string()) != "0".to_string();
|
||||
requester.set_proxy(proxy_enabled);
|
||||
crate::flow_debug!(
|
||||
"requester initialized proxy_enabled={}",
|
||||
proxy_enabled
|
||||
);
|
||||
crate::flow_debug!("requester initialized proxy_enabled={}", proxy_enabled);
|
||||
|
||||
let cache: util::cache::VideoCache = crate::util::cache::VideoCache::new()
|
||||
.max_size(100_000)
|
||||
|
||||
1171
src/providers/arabpornxxx.rs
Normal file
1171
src/providers/arabpornxxx.rs
Normal file
File diff suppressed because it is too large
Load Diff
1298
src/providers/pornhd3x.rs
Normal file
1298
src/providers/pornhd3x.rs
Normal file
File diff suppressed because it is too large
Load Diff
1241
src/providers/pornmz.rs
Normal file
1241
src/providers/pornmz.rs
Normal file
File diff suppressed because it is too large
Load Diff
1210
src/providers/sextb.rs
Normal file
1210
src/providers/sextb.rs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -14,8 +14,7 @@ const FIREFOX_USER_AGENT: &str =
|
||||
"Mozilla/5.0 (X11; Linux x86_64; rv:147.0) Gecko/20100101 Firefox/147.0";
|
||||
const HTML_ACCEPT: &str =
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8";
|
||||
const IMAGE_ACCEPT: &str =
|
||||
"image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5";
|
||||
const IMAGE_ACCEPT: &str = "image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5";
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct NoodlemagazineProxy {}
|
||||
@@ -321,11 +320,7 @@ pub async fn get_image(
|
||||
|
||||
if needs_warmup {
|
||||
let _ = requester
|
||||
.get_with_headers(
|
||||
image_url.as_str(),
|
||||
headers.clone(),
|
||||
Some(Version::HTTP_11),
|
||||
)
|
||||
.get_with_headers(image_url.as_str(), headers.clone(), Some(Version::HTTP_11))
|
||||
.await;
|
||||
headers = NoodlemagazineProxy::image_headers(&requester, image_url.as_str());
|
||||
upstream = requester
|
||||
|
||||
@@ -51,7 +51,10 @@ impl PimpbunnyProxy {
|
||||
fn html_headers_with_referer(referer: &str) -> Vec<(String, String)> {
|
||||
vec![
|
||||
("Referer".to_string(), referer.to_string()),
|
||||
("User-Agent".to_string(), Self::FIREFOX_USER_AGENT.to_string()),
|
||||
(
|
||||
"User-Agent".to_string(),
|
||||
Self::FIREFOX_USER_AGENT.to_string(),
|
||||
),
|
||||
("Accept".to_string(), Self::HTML_ACCEPT.to_string()),
|
||||
("Accept-Language".to_string(), "en-US,en;q=0.9".to_string()),
|
||||
]
|
||||
@@ -80,7 +83,8 @@ impl PimpbunnyProxy {
|
||||
}
|
||||
|
||||
fn extract_json_ld_video(text: &str) -> Option<Value> {
|
||||
let script_regex = Regex::new(r#"(?s)<script[^>]+application/ld\+json[^>]*>(.*?)</script>"#).ok()?;
|
||||
let script_regex =
|
||||
Regex::new(r#"(?s)<script[^>]+application/ld\+json[^>]*>(.*?)</script>"#).ok()?;
|
||||
|
||||
for captures in script_regex.captures_iter(text) {
|
||||
let raw = captures.get(1).map(|value| value.as_str().trim())?;
|
||||
@@ -228,7 +232,8 @@ mod tests {
|
||||
</script>
|
||||
"#;
|
||||
|
||||
let json_ld = PimpbunnyProxy::extract_json_ld_video(html).expect("video object should parse");
|
||||
let json_ld =
|
||||
PimpbunnyProxy::extract_json_ld_video(html).expect("video object should parse");
|
||||
assert_eq!(
|
||||
PimpbunnyProxy::extract_stream_url(&json_ld).as_deref(),
|
||||
Some("https://cdn.example/graph.mp4")
|
||||
|
||||
@@ -12,8 +12,7 @@ const FIREFOX_USER_AGENT: &str =
|
||||
"Mozilla/5.0 (X11; Linux x86_64; rv:147.0) Gecko/20100101 Firefox/147.0";
|
||||
const HTML_ACCEPT: &str =
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8";
|
||||
const IMAGE_ACCEPT: &str =
|
||||
"image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5";
|
||||
const IMAGE_ACCEPT: &str = "image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5";
|
||||
|
||||
fn root_referer() -> &'static str {
|
||||
"https://pimpbunny.com/"
|
||||
@@ -157,7 +156,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn rejects_non_thumb_or_non_pimpbunny_urls() {
|
||||
assert!(!is_allowed_thumb_url("http://pimpbunny.com/contents/videos_screenshots/x.jpg"));
|
||||
assert!(!is_allowed_thumb_url(
|
||||
"http://pimpbunny.com/contents/videos_screenshots/x.jpg"
|
||||
));
|
||||
assert!(!is_allowed_thumb_url(
|
||||
"https://pimpbunny.com/videos/example-video/"
|
||||
));
|
||||
|
||||
@@ -563,10 +563,8 @@ mod tests {
|
||||
let b = Requester::new();
|
||||
let origin = "https://shared-cookie-requester-test.invalid/";
|
||||
|
||||
a.cookie_jar.add_cookie_str(
|
||||
"shared_cookie=1; Path=/; SameSite=Lax",
|
||||
origin,
|
||||
);
|
||||
a.cookie_jar
|
||||
.add_cookie_str("shared_cookie=1; Path=/; SameSite=Lax", origin);
|
||||
|
||||
let cookie_header = b
|
||||
.cookie_header_for_url("https://shared-cookie-requester-test.invalid/path")
|
||||
|
||||
Reference in New Issue
Block a user