Compare commits

..

3 commits

Author SHA1 Message Date
9743b3f9dc
feat: add http3 support
All checks were successful
CI / Test (push) Successful in 4m40s
2024-03-16 19:59:58 +01:00
edb5ab0abb
chore: update base64 to v0.22
All checks were successful
CI / Test (push) Successful in 2m40s
2024-03-16 19:23:11 +01:00
eecabffd18
tests: remove tokio_test::block_on 2024-03-16 19:21:30 +01:00
4 changed files with 520 additions and 336 deletions

View file

@ -15,7 +15,7 @@ include = ["/src", "README.md", "LICENSE", "!snapshots"]
members = [".", "codegen", "downloader", "cli"] members = [".", "codegen", "downloader", "cli"]
[features] [features]
default = ["default-tls"] default = ["rustls-tls-native-roots"]
rss = ["quick-xml"] rss = ["quick-xml"]
@ -27,6 +27,9 @@ native-tls-vendored = ["reqwest/native-tls-vendored"]
rustls-tls-webpki-roots = ["reqwest/rustls-tls-webpki-roots"] rustls-tls-webpki-roots = ["reqwest/rustls-tls-webpki-roots"]
rustls-tls-native-roots = ["reqwest/rustls-tls-native-roots"] rustls-tls-native-roots = ["reqwest/rustls-tls-native-roots"]
# Requires RUSTFLAGS='--cfg reqwest_unstable'
http3 = ["reqwest/http3"]
[dependencies] [dependencies]
quick-js-dtp = { version = "0.4.1", default-features = false, features = [ quick-js-dtp = { version = "0.4.1", default-features = false, features = [
"patch-dateparser", "patch-dateparser",
@ -58,7 +61,7 @@ time = { version = "0.3.15", features = [
futures = "0.3.21" futures = "0.3.21"
ress = "0.11.4" ress = "0.11.4"
phf = "0.11.1" phf = "0.11.1"
base64 = "0.21.0" base64 = "0.22.0"
urlencoding = "2.1.2" urlencoding = "2.1.2"
quick-xml = { version = "0.31.0", features = ["serialize"], optional = true } quick-xml = { version = "0.31.0", features = ["serialize"], optional = true }
tracing = { version = "0.1.37", features = ["log"] } tracing = { version = "0.1.37", features = ["log"] }

View file

@ -466,6 +466,11 @@ impl RustyPipeBuilder {
.brotli(true) .brotli(true)
.redirect(reqwest::redirect::Policy::none()); .redirect(reqwest::redirect::Policy::none());
#[cfg(feature = "http3")]
{
client_builder = client_builder.http3_prior_knowledge();
}
if let Some(timeout) = self.timeout.or_default(|| Duration::from_secs(20)) { if let Some(timeout) = self.timeout.or_default(|| Duration::from_secs(20)) {
client_builder = client_builder.timeout(timeout); client_builder = client_builder.timeout(timeout);
} }
@ -1602,24 +1607,24 @@ mod tests {
parts[0].parse().unwrap() parts[0].parse().unwrap()
} }
#[test] #[tokio::test]
fn t_extract_desktop_client_version() { async fn t_extract_desktop_client_version() {
let rp = RustyPipe::new(); let rp = RustyPipe::new();
let version = tokio_test::block_on(rp.extract_desktop_client_version()).unwrap(); let version = rp.extract_desktop_client_version().await.unwrap();
assert!(get_major_version(&version) >= 2); assert!(get_major_version(&version) >= 2);
} }
#[test] #[tokio::test]
fn t_extract_music_client_version() { async fn t_extract_music_client_version() {
let rp = RustyPipe::new(); let rp = RustyPipe::new();
let version = tokio_test::block_on(rp.extract_music_client_version()).unwrap(); let version = rp.extract_music_client_version().await.unwrap();
assert!(get_major_version(&version) >= 1); assert!(get_major_version(&version) >= 1);
} }
#[test] #[tokio::test]
fn t_get_visitor_data() { async fn t_get_visitor_data() {
let rp = RustyPipe::new(); let rp = RustyPipe::new();
let visitor_data = tokio_test::block_on(rp.get_visitor_data()).unwrap(); let visitor_data = rp.get_visitor_data().await.unwrap();
assert!( assert!(
visitor_data.starts_with("Cg") && visitor_data.len() > 23, visitor_data.starts_with("Cg") && visitor_data.len() > 23,

View file

@ -426,18 +426,18 @@ c[36](c[8],c[32]),c[20](c[25],c[10]),c[2](c[22],c[8]),c[32](c[20],c[16]),c[32](c
assert_eq!(res, "nrkec0fwgTWolw"); assert_eq!(res, "nrkec0fwgTWolw");
} }
#[test] #[tokio::test]
fn t_get_player_js_url() { async fn t_get_player_js_url() {
let client = Client::new(); let client = Client::new();
let url = tokio_test::block_on(get_player_js_url(&client)).unwrap(); let url = get_player_js_url(&client).await.unwrap();
assert!(url.starts_with("https://www.youtube.com/s/player")); assert!(url.starts_with("https://www.youtube.com/s/player"));
assert_eq!(url.len(), 73); assert_eq!(url.len(), 73);
} }
#[test] #[tokio::test]
fn t_update() { async fn t_update() {
let client = Client::new(); let client = Client::new();
let deobf_data = tokio_test::block_on(DeobfData::extract(client, None)).unwrap(); let deobf_data = DeobfData::extract(client, None).await.unwrap();
let deobf = Deobfuscator::new(&deobf_data).unwrap(); let deobf = Deobfuscator::new(&deobf_data).unwrap();
let deobf_sig = deobf.deobfuscate_sig("GOqGOqGOq0QJ8wRAIgaryQHfplJ9xJSKFywyaSMHuuwZYsoMTAvRvfm51qIGECIA5061zWeyfMPX9hEl_U6f9J0tr7GTJMKyPf5XNrJb5fb5i").unwrap(); let deobf_sig = deobf.deobfuscate_sig("GOqGOqGOq0QJ8wRAIgaryQHfplJ9xJSKFywyaSMHuuwZYsoMTAvRvfm51qIGECIA5061zWeyfMPX9hEl_U6f9J0tr7GTJMKyPf5XNrJb5fb5i").unwrap();

File diff suppressed because it is too large Load diff