From 82d22e99f71df8079b1f52e718ed5827e6caac32 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 25 Jun 2026 20:53:51 +0000 Subject: [PATCH] sxyprn update (no formats) --- .gitignore | 2 ++ .graphifyignore | 1 + src/providers/sxyprn.rs | 73 ++++++++++------------------------------- src/videos.rs | 8 +++++ 4 files changed, 29 insertions(+), 55 deletions(-) create mode 100644 .graphifyignore diff --git a/.gitignore b/.gitignore index b3c7cba..e80f259 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ migrations/.keep .mcp.json *.mp4* prompts/new-channel.md +graphify-out/** +CLAUDE.md diff --git a/.graphifyignore b/.graphifyignore new file mode 100644 index 0000000..f61e320 --- /dev/null +++ b/.graphifyignore @@ -0,0 +1 @@ +.*/ \ No newline at end of file diff --git a/src/providers/sxyprn.rs b/src/providers/sxyprn.rs index 0c12d4e..0056af4 100644 --- a/src/providers/sxyprn.rs +++ b/src/providers/sxyprn.rs @@ -9,7 +9,6 @@ use crate::util::hoster_proxy::{proxy_name_for_url, rewrite_hoster_url}; use crate::util::requester::Requester; use crate::util::time::parse_time_to_seconds; use crate::videos::ServerOptions; -use crate::videos::VideoFormat; use crate::videos::VideoItem; use async_trait::async_trait; use error_chain::error_chain; @@ -471,79 +470,43 @@ impl SxyprnProvider { let duration = parse_time_to_seconds(&raw_duration).unwrap_or(0) as u32; - // stream urls - collect both lulustream and vidara.so URLs - let mut formats = vec![]; - - // Add sxyprn format + // Start with the sxyprn proxy URL; doodstream or vidara overwrite it if present. let sxyprn_url = format!( "{}/proxy/sxyprn/post/{}", options.public_url_base.as_deref().unwrap_or(""), id ); - formats.push( - VideoFormat::new(sxyprn_url.clone(), "auto".to_string(), "mp4".to_string()) - .http_header("Referer".to_string(), "https://sxyprn.com/".to_string()) - .format_note(sxyprn_url.split("/").nth(4).unwrap_or("sxyprn").to_string()), - ); + let mut video_url = sxyprn_url; - let doodstream_urls: Vec = title_links + if let Some(dood_url) = title_links .iter() - .filter(|url| proxy_name_for_url(url).as_deref() == Some("doodstream")) - .map(|url| rewrite_hoster_url(options, url)) - .collect(); - - for dood_url in doodstream_urls { - formats.push( - VideoFormat::new(dood_url.clone(), "auto".to_string(), "doodstream".to_string()) - .format_note("doodstream".to_string()) - .format_id("doodstream".to_string()) - .http_header("Referer".to_string(), "https://sxyprn.com/".to_string()), - ); + .find(|u| proxy_name_for_url(u).as_deref() == Some("doodstream")) + .map(|u| rewrite_hoster_url(options, u)) + { + video_url = dood_url; } - // let lulustream_urls: Vec = title_links - // .iter() - // .filter(|url| proxy_name_for_url(url).as_deref() == Some("lulustream")) - // .map(|url| rewrite_hoster_url(options, url)) - // .collect(); - - // for lulustream_url in lulustream_urls { - // formats.push( - // VideoFormat::m3u8( - // lulustream_url.clone(), - // "auto".to_string(), - // "m3u8".to_string(), - // ) - // .format_note("lulustream".to_string()) - // .format_id("lulustream".to_string()), - // ); - // } - - // Also collect and transform vidara.so URLs to proxy format and add as formats - let vidara_urls: Vec = title_links + if let Some(vidara_url) = title_links .iter() - .filter(|url| proxy_name_for_url(url).as_deref() == Some("vidara")) - .map(|url| rewrite_hoster_url(options, url)) - .collect(); - - for vidara_url in vidara_urls { - formats.push( - VideoFormat::m3u8(vidara_url.clone(), "1080".to_string(), "m3u8".to_string()) - .format_note(vidara_url.split("/").nth(4).unwrap_or("vidara").to_string()) - .format_id("vidara".to_string()) - .http_header("Referer".to_string(), "https://sxyprn.com/".to_string()), - ); + .find(|u| proxy_name_for_url(u).as_deref() == Some("vidara")) + .map(|u| rewrite_hoster_url(options, u)) + { + video_url = vidara_url; } + + let mut headers = std::collections::HashMap::new(); + headers.insert("Referer".to_string(), "https://sxyprn.com/".to_string()); + let mut video_item = VideoItem::new( id.clone(), title, - format!("https://sxyprn.com/post/{}", url.clone()), + video_url, "sxyprn".to_string(), thumb, duration, ) .views(views.parse::().unwrap_or(0)) - .formats(formats); + .http_headers(headers); // Add tags if any were found if !tags.is_empty() { diff --git a/src/videos.rs b/src/videos.rs index 7e61233..f68f9be 100644 --- a/src/videos.rs +++ b/src/videos.rs @@ -117,6 +117,8 @@ pub struct VideoItem { pub aspectRatio: Option, #[serde(skip_serializing_if = "Option::is_none")] pub playbackMethod: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub http_headers: Option>, } impl VideoItem { pub fn new( @@ -148,6 +150,7 @@ impl VideoItem { preview: None, aspectRatio: None, playbackMethod: None, + http_headers: None, } } pub fn from(s: String) -> Result { @@ -202,6 +205,11 @@ impl VideoItem { self } + pub fn http_headers(mut self, headers: HashMap) -> Self { + self.http_headers = Some(headers); + self + } + /// Re-applies the request host to every host-relative proxy URL on this item /// (its `url`, `preview`, and each format's `url`). Cached items may have been /// built without a host; see [`crate::providers::ensure_proxy_url_host`].