sxyprn update (no formats)

This commit is contained in:
Simon
2026-06-25 20:53:51 +00:00
parent e4a84f34ee
commit 82d22e99f7
4 changed files with 29 additions and 55 deletions

2
.gitignore vendored
View File

@@ -20,3 +20,5 @@ migrations/.keep
.mcp.json .mcp.json
*.mp4* *.mp4*
prompts/new-channel.md prompts/new-channel.md
graphify-out/**
CLAUDE.md

1
.graphifyignore Normal file
View File

@@ -0,0 +1 @@
.*/

View File

@@ -9,7 +9,6 @@ use crate::util::hoster_proxy::{proxy_name_for_url, rewrite_hoster_url};
use crate::util::requester::Requester; use crate::util::requester::Requester;
use crate::util::time::parse_time_to_seconds; use crate::util::time::parse_time_to_seconds;
use crate::videos::ServerOptions; use crate::videos::ServerOptions;
use crate::videos::VideoFormat;
use crate::videos::VideoItem; use crate::videos::VideoItem;
use async_trait::async_trait; use async_trait::async_trait;
use error_chain::error_chain; use error_chain::error_chain;
@@ -471,79 +470,43 @@ impl SxyprnProvider {
let duration = parse_time_to_seconds(&raw_duration).unwrap_or(0) as u32; let duration = parse_time_to_seconds(&raw_duration).unwrap_or(0) as u32;
// stream urls - collect both lulustream and vidara.so URLs // Start with the sxyprn proxy URL; doodstream or vidara overwrite it if present.
let mut formats = vec![];
// Add sxyprn format
let sxyprn_url = format!( let sxyprn_url = format!(
"{}/proxy/sxyprn/post/{}", "{}/proxy/sxyprn/post/{}",
options.public_url_base.as_deref().unwrap_or(""), options.public_url_base.as_deref().unwrap_or(""),
id id
); );
formats.push( let mut video_url = sxyprn_url;
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 doodstream_urls: Vec<String> = title_links if let Some(dood_url) = title_links
.iter() .iter()
.filter(|url| proxy_name_for_url(url).as_deref() == Some("doodstream")) .find(|u| proxy_name_for_url(u).as_deref() == Some("doodstream"))
.map(|url| rewrite_hoster_url(options, url)) .map(|u| rewrite_hoster_url(options, u))
.collect(); {
video_url = dood_url;
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()),
);
} }
// let lulustream_urls: Vec<String> = title_links if let Some(vidara_url) = 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<String> = title_links
.iter() .iter()
.filter(|url| proxy_name_for_url(url).as_deref() == Some("vidara")) .find(|u| proxy_name_for_url(u).as_deref() == Some("vidara"))
.map(|url| rewrite_hoster_url(options, url)) .map(|u| rewrite_hoster_url(options, u))
.collect(); {
video_url = vidara_url;
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()),
);
} }
let mut headers = std::collections::HashMap::new();
headers.insert("Referer".to_string(), "https://sxyprn.com/".to_string());
let mut video_item = VideoItem::new( let mut video_item = VideoItem::new(
id.clone(), id.clone(),
title, title,
format!("https://sxyprn.com/post/{}", url.clone()), video_url,
"sxyprn".to_string(), "sxyprn".to_string(),
thumb, thumb,
duration, duration,
) )
.views(views.parse::<u32>().unwrap_or(0)) .views(views.parse::<u32>().unwrap_or(0))
.formats(formats); .http_headers(headers);
// Add tags if any were found // Add tags if any were found
if !tags.is_empty() { if !tags.is_empty() {

View File

@@ -117,6 +117,8 @@ pub struct VideoItem {
pub aspectRatio: Option<f32>, pub aspectRatio: Option<f32>,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub playbackMethod: Option<String>, pub playbackMethod: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub http_headers: Option<HashMap<String, String>>,
} }
impl VideoItem { impl VideoItem {
pub fn new( pub fn new(
@@ -148,6 +150,7 @@ impl VideoItem {
preview: None, preview: None,
aspectRatio: None, aspectRatio: None,
playbackMethod: None, playbackMethod: None,
http_headers: None,
} }
} }
pub fn from(s: String) -> Result<Self, serde_json::Error> { pub fn from(s: String) -> Result<Self, serde_json::Error> {
@@ -202,6 +205,11 @@ impl VideoItem {
self self
} }
pub fn http_headers(mut self, headers: HashMap<String, String>) -> Self {
self.http_headers = Some(headers);
self
}
/// Re-applies the request host to every host-relative proxy URL on this item /// 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 /// (its `url`, `preview`, and each format's `url`). Cached items may have been
/// built without a host; see [`crate::providers::ensure_proxy_url_host`]. /// built without a host; see [`crate::providers::ensure_proxy_url_host`].