sxyprn fixes-ish
This commit is contained in:
@@ -2,7 +2,7 @@ use ntex::web;
|
||||
use url::Url;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::util::requester::Requester;
|
||||
use crate::util::{dean_edwards, requester::Requester};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct LulustreamProxy {}
|
||||
@@ -51,7 +51,7 @@ impl LulustreamProxy {
|
||||
return false;
|
||||
};
|
||||
(host == "lulustream.com" || host == "www.lulustream.com" || host == "luluvdo.com")
|
||||
&& (parsed.path().starts_with("/v/")||parsed.path().starts_with("/e/"))
|
||||
&& !parsed.path().is_empty() && parsed.path() != "/"
|
||||
}
|
||||
|
||||
pub async fn get_video_url(
|
||||
@@ -64,15 +64,19 @@ impl LulustreamProxy {
|
||||
println!("LulustreamProxy: Invalid detail URL: {url}");
|
||||
return String::new();
|
||||
};
|
||||
let text = requester.get(&detail_url, None).await.unwrap_or_default();
|
||||
let video_url = text.split("sources: [{file:\"")
|
||||
let mut text = requester.get(&detail_url, None).await.unwrap_or_default();
|
||||
if !text.contains("[{file:\"") {
|
||||
let packedtext = text.split("<script type='text/javascript'>").nth(1).and_then(|t| t.split("</script>").next()).unwrap_or_default();
|
||||
println!("LulustreamProxy: Found packed text: {packedtext}");
|
||||
text = dean_edwards::unpack(&packedtext).unwrap_or_default();
|
||||
println!("LulustreamProxy: Unpacked text: {text}");
|
||||
}
|
||||
let video_url = text.split("[{file:\"")
|
||||
.nth(1)
|
||||
.and_then(|s| s.split('"').next())
|
||||
.unwrap_or_default()
|
||||
.to_string();
|
||||
if video_url.is_empty() {
|
||||
println!("LulustreamProxy: Failed to extract video URL for video ID: {video_id}");
|
||||
}
|
||||
println!("LulustreamProxy: Extracted video URL: {video_url}");
|
||||
video_url
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,6 @@ impl SxyprnProxy {
|
||||
Ok(None) => println!("No redirect found for {}", sxyprn_video_url),
|
||||
Err(e) => eprintln!("Request failed: {}", e),
|
||||
}
|
||||
|
||||
return "".to_string();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user