adjusted requester to supply http::version itself

This commit is contained in:
Simon
2025-11-30 06:53:21 +00:00
parent 2de6a7d42b
commit d856ade32b
30 changed files with 154 additions and 162 deletions

View File

@@ -1,15 +1,13 @@
use ntex::web;
use crate::{proxies::sxyprn::SxyprnProxy, util::requester::Requester, proxies::noodlemagazine::NoodlemagazineProxy};
use crate::{proxies::sxyprn::SxyprnProxy, util::requester::Requester};
pub mod sxyprn;
pub mod hanimecdn;
pub mod noodlemagazine;
#[derive(Debug, Clone)]
pub enum AnyProxy {
Sxyprn(SxyprnProxy),
Noodlemagazine(NoodlemagazineProxy),
}
pub trait Proxy {
@@ -34,12 +32,6 @@ impl Proxy for AnyProxy {
requester,
).await
}
AnyProxy::Noodlemagazine(p) => {
p.get_video_url(
url,
requester,
).await
}
}
}
}

View File

@@ -1,37 +0,0 @@
use ntex::web;
use crate::util::requester::Requester;
#[derive(Debug, Clone)]
pub struct NoodlemagazineProxy {
}
impl NoodlemagazineProxy {
pub fn new() -> Self {
NoodlemagazineProxy {
}
}
pub async fn get_video_url(
&self,
url: String,
requester: web::types::State<Requester>,
) -> String {
let mut requester = requester.get_ref().clone();
let url = "https://noodlemagazine.com/".to_string() + &url;
let text = requester.get(&url).await.unwrap_or("".to_string());
if text.is_empty() {
return "".to_string();
}
let json_str = text.split("window.playlist = ")
.collect::<Vec<&str>>()[1]
.split(";")
.collect::<Vec<&str>>()[0];
let json: serde_json::Value = serde_json::from_str(json_str).unwrap();
let sources = json["sources"].as_array().unwrap();
let video_url = sources[0]["file"].as_str().unwrap().to_string();
return video_url;
}
}

View File

@@ -40,7 +40,7 @@ impl SxyprnProxy {
) -> String {
let mut requester = requester.get_ref().clone();
let url = "https://sxyprn.com/".to_string() + &url;
let text = requester.get(&url).await.unwrap_or("".to_string());
let text = requester.get(&url, None).await.unwrap_or("".to_string());
if text.is_empty() {
return "".to_string();
}