sxyprn fix

This commit is contained in:
Simon
2026-05-15 09:07:39 +00:00
committed by ForgeCode
parent eef08401ab
commit 1aaa388f9e

View File

@@ -156,7 +156,7 @@ impl SxyprnProvider {
} }
}; };
let text = match requester.get(&url_str, None).await { let text = match requester.get_with_headers(&url_str, vec![("Referer".to_string(), self.url.clone())],None).await {
Ok(text) => text, Ok(text) => text,
Err(e) => { Err(e) => {
crate::providers::report_provider_error( crate::providers::report_provider_error(
@@ -200,7 +200,6 @@ impl SxyprnProvider {
} }
Ok(video_items) Ok(video_items)
} }
async fn query( async fn query(
&self, &self,
cache: VideoCache, cache: VideoCache,
@@ -299,16 +298,16 @@ impl SxyprnProvider {
} }
// take content before "<script async" // take content before "<script async"
let before_script = html let blog_posts = html
.split("<script async") .split("blog_posts")
.next() .nth(1)
.ok_or_else(|| ErrorKind::Parse("missing '<script async' split point".into()))?; .ok_or_else(|| ErrorKind::Parse("missing 'blog_posts' split point".into()))?;
// split into video segments (skip the first chunk) // split into video segments (skip the first chunk)
let raw_videos: Vec<&str> = before_script.split("post_el_small'").skip(1).collect(); let raw_videos: Vec<&str> = blog_posts.split("post_el_small'").skip(1).collect();
if raw_videos.is_empty() { if raw_videos.is_empty() {
return Err(ErrorKind::Parse("no 'post_el_small\\'' segments found".into()).into()); return Err(ErrorKind::Parse("no 'post_el_small\'' segments found".into()).into());
} }
let mut items = Vec::new(); let mut items = Vec::new();
@@ -319,7 +318,7 @@ impl SxyprnProvider {
.split("/post/") .split("/post/")
.nth(1) .nth(1)
.and_then(|s| s.split('\'').next()) .and_then(|s| s.split('\'').next())
.ok_or_else(|| ErrorKind::Parse("failed to extract /post/ url".into()))? .ok_or_else(|| ErrorKind::Parse(format!("failed to extract /post/ url")))?
.to_string(); .to_string();
let video_url = let video_url =