diff --git a/Cargo.toml b/Cargo.toml index f7d68a4..4fe485e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,20 @@ include = ["/src", "README.md", "LICENSE", "!snapshots"] [workspace] members = [".", "codegen", "downloader", "cli"] -[workspace.dependencies] +[features] +default = ["default-tls"] + +rss = ["quick-xml"] + +# Reqwest TLS options +default-tls = ["reqwest/default-tls"] +native-tls = ["reqwest/native-tls"] +native-tls-alpn = ["reqwest/native-tls-alpn"] +native-tls-vendored = ["reqwest/native-tls-vendored"] +rustls-tls-webpki-roots = ["reqwest/rustls-tls-webpki-roots"] +rustls-tls-native-roots = ["reqwest/rustls-tls-native-roots"] + +[dependencies] quick-js-dtp = { version = "0.4.1", default-features = false, features = [ "patch-dateparser", ] } @@ -23,8 +36,12 @@ regex = "1.6.0" fancy-regex = "0.13.0" thiserror = "1.0.36" url = "2.2.2" -reqwest = { version = "0.12.0", default-features = false } -tokio = "1.20.0" +reqwest = { version = "0.11.11", default-features = false, features = [ + "json", + "gzip", + "brotli", +] } +tokio = { version = "1.20.0", features = ["macros", "time"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.82" serde_with = { version = "3.0.0", default-features = false, features = [ @@ -41,64 +58,13 @@ time = { version = "0.3.15", features = [ futures = "0.3.21" ress = "0.11.4" phf = "0.11.1" -phf_codegen = "0.11.1" base64 = "0.22.0" urlencoding = "2.1.2" -quick-xml = { version = "0.31.0", features = ["serialize"] } +quick-xml = { version = "0.31.0", features = ["serialize"], optional = true } tracing = { version = "0.1.37", features = ["log"] } -# CLI -indicatif = "0.17.0" -anyhow = "1.0" -clap = { version = "4.0.29", features = ["derive"] } -tracing-subscriber = "0.3.17" -serde_yaml = "0.9.19" -dirs = "5.0.0" -filenamify = "0.1.0" - -# Testing +[dev-dependencies] rstest = "0.18.1" tokio-test = "0.4.2" insta = { version = "1.17.1", features = ["ron", "redactions"] } path_macro = "1.0.0" - -[features] -default = ["default-tls"] - -rss = ["quick-xml"] - -# Reqwest TLS options -default-tls = ["reqwest/default-tls"] -native-tls = ["reqwest/native-tls"] -native-tls-alpn = ["reqwest/native-tls-alpn"] -native-tls-vendored = ["reqwest/native-tls-vendored"] -rustls-tls-webpki-roots = ["reqwest/rustls-tls-webpki-roots"] -rustls-tls-native-roots = ["reqwest/rustls-tls-native-roots"] - -[dependencies] -quick-js-dtp.workspace = true -once_cell.workspace = true -regex.workspace = true -fancy-regex.workspace = true -thiserror.workspace = true -url.workspace = true -reqwest = { workspace = true, features = ["json", "gzip", "brotli"] } -tokio = { workspace = true, features = ["macros", "time"] } -serde.workspace = true -serde_json.workspace = true -serde_with.workspace = true -serde_plain.workspace = true -rand.workspace = true -time.workspace = true -ress.workspace = true -phf.workspace = true -base64.workspace = true -urlencoding.workspace = true -tracing.workspace = true -quick-xml = { workspace = true, optional = true } - -[dev-dependencies] -rstest.workspace = true -tokio-test.workspace = true -insta.workspace = true -path_macro.workspace = true diff --git a/cli/Cargo.toml b/cli/Cargo.toml index f6d6053..8f2fa8c 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -41,15 +41,14 @@ rustls-tls-native-roots = [ [dependencies] rustypipe = { path = "../", default-features = false } rustypipe-downloader = { path = "../downloader", default-features = false } -reqwest.workspace = true -tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } -futures.workspace = true -serde.workspace = true -serde_json.workspace = true - -indicatif.workspace = true -anyhow.workspace = true -clap.workspace = true -tracing-subscriber.workspace = true -serde_yaml.workspace = true -dirs.workspace = true +reqwest = { version = "0.11.11", default_features = false } +tokio = { version = "1.20.0", features = ["macros", "rt-multi-thread"] } +indicatif = "0.17.0" +futures = "0.3.21" +anyhow = "1.0" +clap = { version = "4.0.29", features = ["derive"] } +tracing-subscriber = "0.3.17" +serde = "1.0" +serde_json = "1.0.82" +serde_yaml = "0.9.19" +dirs = "5.0.0" diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 4d50480..e3bfff8 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -6,23 +6,24 @@ publish = false [dependencies] rustypipe = { path = "../" } -reqwest.workspace = true -tokio = { workspace = true, features = ["rt-multi-thread"] } -futures.workspace = true -serde.workspace = true -serde_json.workspace = true -serde_with.workspace = true -once_cell.workspace = true -regex.workspace = true -path_macro.workspace = true -anyhow.workspace = true -tracing.workspace = true -tracing-subscriber.workspace = true -clap.workspace = true -phf_codegen.workspace = true -indicatif.workspace = true - -num_enum = "0.7.2" +reqwest = "0.11.11" +tokio = { version = "1.20.0", features = ["macros", "rt-multi-thread"] } +futures = "0.3.21" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0.82" +serde_with = { version = "3.0.0", default-features = false, features = [ + "macros", +] } +anyhow = "1.0" +log = "0.4.17" +env_logger = "0.10.0" +clap = { version = "4.0.29", features = ["derive"] } +phf_codegen = "0.11.1" +once_cell = "1.12.0" +regex = "1.7.1" +indicatif = "0.17.0" +num_enum = "0.6.1" +path_macro = "1.0.0" intl_pluralrules = "7.0.2" unic-langid = "0.9.1" -ordered_hash_map = { version = "0.4.0", features = ["serde"] } +ordered_hash_map = { version = "0.2.0", features = ["serde"] } diff --git a/codegen/src/main.rs b/codegen/src/main.rs index 7c8a5f2..bbc8fa8 100644 --- a/codegen/src/main.rs +++ b/codegen/src/main.rs @@ -46,7 +46,7 @@ enum Commands { #[tokio::main] async fn main() { - tracing_subscriber::fmt::init(); + env_logger::init(); let cli = Cli::parse(); match cli.command { diff --git a/downloader/Cargo.toml b/downloader/Cargo.toml index 58b9cae..5e32056 100644 --- a/downloader/Cargo.toml +++ b/downloader/Cargo.toml @@ -29,14 +29,16 @@ rustls-tls-native-roots = [ ] [dependencies] -rustypipe = { path = "../", default-features = false } -once_cell.workspace = true -regex.workspace = true -thiserror.workspace = true -futures.workspace = true -reqwest = { workspace = true, features = ["stream"] } -rand.workspace = true -tokio = { workspace = true, features = ["macros", "fs", "process"] } -indicatif.workspace = true -filenamify.workspace = true -tracing.workspace = true +rustypipe = { path = "..", default-features = false } +once_cell = "1.12.0" +regex = "1.6.0" +thiserror = "1.0.36" +futures = "0.3.21" +indicatif = "0.17.0" +filenamify = "0.1.0" +log = "0.4.17" +reqwest = { version = "0.11.11", default-features = false, features = [ + "stream", +] } +rand = "0.8.5" +tokio = { version = "1.20.0", features = ["macros", "fs", "process"] } diff --git a/downloader/src/lib.rs b/downloader/src/lib.rs index a706c3c..6377289 100644 --- a/downloader/src/lib.rs +++ b/downloader/src/lib.rs @@ -8,6 +8,7 @@ use std::{borrow::Cow, cmp::Ordering, ffi::OsString, ops::Range, path::PathBuf, use futures::stream::{self, StreamExt}; use indicatif::{ProgressBar, ProgressStyle}; +use log::{debug, info}; use once_cell::sync::Lazy; use rand::Rng; use regex::Regex; @@ -21,7 +22,6 @@ use tokio::{ io::AsyncWriteExt, process::Command, }; -use tracing::{debug, info}; use util::DownloadError; diff --git a/tests/youtube.rs b/tests/youtube.rs index b528385..1cb2458 100644 --- a/tests/youtube.rs +++ b/tests/youtube.rs @@ -1578,12 +1578,20 @@ async fn music_playlist_not_found(rp: RustyPipe) { #[case::no_artist("no_artist", "MPREb_bqWA6mAZFWS")] #[tokio::test] async fn music_album(#[case] name: &str, #[case] id: &str, rp: RustyPipe, unlocalized: bool) { - let album = rp.query().music_album(id).await.unwrap(); + // TODO: remove visitor data if A/B#13 is stabilized + let album = rp + .query() + .visitor_data_opt( + Some("Cgs1bHFWMlhmM1ZFNCi9jK6vBjIKCgJERRIEEgAgIw%3D%3D") + .filter(|_| name == "one_artist"), + ) + .music_album(id) + .await + .unwrap(); assert!(!album.cover.is_empty(), "got no cover"); - // TODO: check full snapshot if A/B#13 is stabilized - if unlocalized && name != "one_artist" { + if unlocalized { insta::assert_ron_snapshot!(format!("music_album_{name}"), album, {".cover" => "[cover]", ".tracks[].view_count" => "[view_count]"} ); @@ -2169,6 +2177,11 @@ async fn music_search_playlists_community(rp: RustyPipe) { assert_eq!(channel.id, "UCs72iRpTEuwV3y6pdWYLgiw"); assert_eq!(channel.name, "Redlist - Just Hits"); assert!(!playlist.from_ytm); + + assert!( + res.items.items.iter().all(|p| !p.from_ytm), + "ytm items found" + ) } /// The YouTube Music search sometimes shows genre radio items. They should be skipped.