sxyprn hotfix

This commit is contained in:
Simon
2026-05-09 20:59:51 +00:00
committed by ForgeCode
parent 41353782a5
commit b4774a0c0f

View File

@@ -5,9 +5,9 @@ use crate::status::*;
use crate::util::cache::VideoCache;
use crate::util::discord::format_error_chain;
use crate::util::discord::send_discord_error_report;
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::util::hoster_proxy::{proxy_name_for_url, rewrite_hoster_url};
use crate::videos::ServerOptions;
use crate::videos::VideoFormat;
use crate::videos::VideoItem;
@@ -339,7 +339,6 @@ impl SxyprnProvider {
.filter_map(|part| part.split("'").next().map(|u| u.to_string()))
.collect();
let document = Html::parse_document(title_parts);
let selector = Selector::parse("*")
.map_err(|e| ErrorKind::Parse(format!("selector parse failed: {e}")))?;
@@ -373,7 +372,7 @@ impl SxyprnProvider {
let pattern = &words[0..pattern_len];
let mut all_match = true;
let mut idx = pattern_len;
while idx < words.len() {
let end = std::cmp::min(idx + pattern_len, words.len());
if &words[idx..end] != &pattern[0..(end - idx)] {
@@ -382,7 +381,7 @@ impl SxyprnProvider {
}
idx += pattern_len;
}
if all_match && words.len() % pattern_len == 0 {
title = pattern.join(" ");
break;
@@ -477,42 +476,6 @@ impl SxyprnProvider {
let mut formats = vec![];
// Add sxyprn format
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())
.format_note(
sxyprn_url
.split("/")
.nth(4)
.unwrap_or("sxyprn")
.to_string(),
),
);
// Also collect and transform vidara.so URLs to proxy format and add as formats
let vidara_urls: Vec<String> = 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()),
);
}
let doodstream_urls: Vec<String> = title_links
.iter()
@@ -536,13 +499,38 @@ impl SxyprnProvider {
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()),
VideoFormat::m3u8(
lulustream_url.clone(),
"auto".to_string(),
"m3u8".to_string(),
)
.format_note("lulustream".to_string())
.format_id("lulustream".to_string()),
);
}
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())
.format_note(sxyprn_url.split("/").nth(4).unwrap_or("sxyprn").to_string()),
);
// Also collect and transform vidara.so URLs to proxy format and add as formats
let vidara_urls: Vec<String> = 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()),
);
}
let mut video_item = VideoItem::new(
id.clone(),
title,