sxyprn fix
This commit is contained in:
@@ -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,
|
||||
Err(e) => {
|
||||
crate::providers::report_provider_error(
|
||||
@@ -200,7 +200,6 @@ impl SxyprnProvider {
|
||||
}
|
||||
Ok(video_items)
|
||||
}
|
||||
|
||||
async fn query(
|
||||
&self,
|
||||
cache: VideoCache,
|
||||
@@ -299,16 +298,16 @@ impl SxyprnProvider {
|
||||
}
|
||||
|
||||
// take content before "<script async"
|
||||
let before_script = html
|
||||
.split("<script async")
|
||||
.next()
|
||||
.ok_or_else(|| ErrorKind::Parse("missing '<script async' split point".into()))?;
|
||||
let blog_posts = html
|
||||
.split("blog_posts")
|
||||
.nth(1)
|
||||
.ok_or_else(|| ErrorKind::Parse("missing 'blog_posts' split point".into()))?;
|
||||
|
||||
// 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() {
|
||||
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();
|
||||
@@ -319,7 +318,7 @@ impl SxyprnProvider {
|
||||
.split("/post/")
|
||||
.nth(1)
|
||||
.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();
|
||||
|
||||
let video_url =
|
||||
|
||||
Reference in New Issue
Block a user