This commit is contained in:
Simon
2025-09-03 12:15:08 +00:00
parent c3f994ccbb
commit ff18f3eb34
8 changed files with 279 additions and 132 deletions

41
src/proxies/mod.rs Normal file
View File

@@ -0,0 +1,41 @@
use ntex::web;
use crate::{proxies::sxyprn::SxyprnProxy, util::{cache::VideoCache, requester::Requester}};
pub mod sxyprn;
#[derive(Debug, Clone)]
pub enum AnyProxy {
Sxyprn(SxyprnProxy),
}
pub trait Proxy {
async fn get_video_url(
&self,
url: String,
requester: web::types::State<Requester>,
) -> String;
}
impl Proxy for AnyProxy {
async fn get_video_url(
&self,
url: String,
requester: web::types::State<Requester>,
) -> String {
println!(
"/proxy/video_url: url={:?}, provider={:?}",
url, self
);
match self {
AnyProxy::Sxyprn(p) => {
p.get_video_url(
url,
requester,
).await
}
}
}
}