diff --git a/src/providers/javtiful.rs b/src/providers/javtiful.rs index cef301b..bfde36f 100644 --- a/src/providers/javtiful.rs +++ b/src/providers/javtiful.rs @@ -428,10 +428,17 @@ impl JavtifulProvider { .unwrap_or(0); let quality = "1080p".to_string(); + let stripped_url = crate::providers::strip_url_scheme(url); + let proxy_target = stripped_url + .strip_prefix("www.javtiful.com/") + .or_else(|| stripped_url.strip_prefix("javtiful.com/")) + .unwrap_or(stripped_url.as_str()) + .trim_start_matches('/') + .to_string(); let video_url = crate::providers::build_proxy_url( options, "javtiful", - &crate::providers::strip_url_scheme(url), + &proxy_target, ); Ok(( tags, diff --git a/src/proxies/javtiful.rs b/src/proxies/javtiful.rs index 7d56cac..92fedbd 100644 --- a/src/proxies/javtiful.rs +++ b/src/proxies/javtiful.rs @@ -17,12 +17,21 @@ impl JavtifulProxy { requester: web::types::State, ) -> String { let mut requester = requester.get_ref().clone(); - let url = "https://javtiful.com/".to_string() + &url; - let text = requester.get(&url, None).await.unwrap_or("".to_string()); + let endpoint = url + .trim_start_matches('/') + .strip_prefix("https://") + .or_else(|| url.trim_start_matches('/').strip_prefix("http://")) + .unwrap_or(url.trim_start_matches('/')) + .trim_start_matches("www.javtiful.com/") + .trim_start_matches("javtiful.com/") + .trim_start_matches('/') + .to_string(); + let detail_url = format!("https://javtiful.com/{endpoint}"); + let text = requester.get(&detail_url, None).await.unwrap_or_default(); if text.is_empty() { return "".to_string(); } - let video_id = url.split('/').nth(4).unwrap_or("").to_string(); + let video_id = endpoint.split('/').nth(1).unwrap_or("").to_string(); let token = text .split("data-csrf-token=\"") @@ -39,7 +48,7 @@ impl JavtifulProxy { .post_multipart( "https://javtiful.com/ajax/get_cdn", form, - vec![("Referer".to_string(), url.to_string())], + vec![("Referer".to_string(), detail_url)], Some(Version::HTTP_11), ) .await