sxyprn update (no formats)
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -20,3 +20,5 @@ migrations/.keep
|
||||
.mcp.json
|
||||
*.mp4*
|
||||
prompts/new-channel.md
|
||||
graphify-out/**
|
||||
CLAUDE.md
|
||||
|
||||
1
.graphifyignore
Normal file
1
.graphifyignore
Normal file
@@ -0,0 +1 @@
|
||||
.*/
|
||||
@@ -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<String> = 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<String> = 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
|
||||
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::<u32>().unwrap_or(0))
|
||||
.formats(formats);
|
||||
.http_headers(headers);
|
||||
|
||||
// Add tags if any were found
|
||||
if !tags.is_empty() {
|
||||
|
||||
@@ -117,6 +117,8 @@ pub struct VideoItem {
|
||||
pub aspectRatio: Option<f32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub playbackMethod: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub http_headers: Option<HashMap<String, String>>,
|
||||
}
|
||||
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<Self, serde_json::Error> {
|
||||
@@ -202,6 +205,11 @@ impl VideoItem {
|
||||
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
|
||||
/// (its `url`, `preview`, and each format's `url`). Cached items may have been
|
||||
/// built without a host; see [`crate::providers::ensure_proxy_url_host`].
|
||||
|
||||
Reference in New Issue
Block a user