Compare commits

..

No commits in common. "bb4c92c70b631edc70686d5f161907747ff1be7f" and "29a7db231a182bb74c8219ff73ba5dbcf3619f3b" have entirely different histories.

14 changed files with 460 additions and 588 deletions

View file

@ -10,6 +10,8 @@ jobs:
steps:
- name: 📦 Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🦀 Setup Rust cache
uses: https://github.com/Swatinem/rust-cache@v2
@ -20,13 +22,4 @@ jobs:
run: cargo clippy --all --features=rss -- -D warnings
- name: 🧪 Test
run: cargo nextest run --config-file ~/.config/nextest.toml --profile ci --features rss --workspace
- name: 💌 Upload test report
if: always()
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with:
name: test
path: |
target/nextest/ci/junit.xml
rustypipe_reports/*
run: cargo test --features=rss --workspace

View file

@ -1,3 +0,0 @@
{
"rust-analyzer.cargo.features": ["rss"]
}

View file

@ -1,15 +1,14 @@
test:
# cargo test --features=rss
cargo nextest run --features=rss --no-fail-fast --failure-output final
cargo test --features=rss
unittest:
cargo nextest run --features=rss --no-fail-fast --failure-output final --lib
cargo test --features=rss --lib
testyt:
cargo nextest run --features=rss --no-fail-fast --failure-output final --test youtube
cargo test --features=rss --test youtube
testyt-localized:
YT_LANG=th cargo nextest run --features=rss --no-fail-fast --failure-output final --test youtube
YT_LANG=th cargo test --features=rss --test youtube
testintl:
#!/usr/bin/env bash

View file

@ -79,6 +79,7 @@ pub async fn run_test(
let rp = RustyPipe::new();
let pb = ProgressBar::new(n as u64);
let http = reqwest::Client::default();
pb.set_style(
ProgressStyle::with_template(
"{msg} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {pos}/{len}",
@ -90,8 +91,9 @@ pub async fn run_test(
.map(|_| {
let rp = rp.clone();
let pb = pb.clone();
let http = http.clone();
async move {
let visitor_data = rp.query().get_visitor_data().await.unwrap();
let visitor_data = get_visitor_data(&http).await;
let query = rp.query().visitor_data(&visitor_data);
let is_present = match ab {
ABTest::AttributedTextDescription => attributed_text_description(&query).await,
@ -131,6 +133,22 @@ pub async fn run_test(
(count, vd_present, vd_absent)
}
async fn get_visitor_data(http: &reqwest::Client) -> String {
let resp = http.get("https://www.youtube.com").send().await.unwrap();
resp.headers()
.get_all(reqwest::header::SET_COOKIE)
.iter()
.find_map(|c| {
if let Ok(cookie) = c.to_str() {
if let Some(after) = cookie.strip_prefix("__Secure-YEC=") {
return after.split_once(';').map(|s| s.0.to_owned());
}
}
None
})
.unwrap()
}
pub async fn run_all_tests(n: usize, concurrency: usize) -> Vec<ABTestRes> {
let mut results = Vec::new();

View file

@ -26,7 +26,6 @@ to the new feature.
**Status:**
- Discontinued (0%)
- Experimental (<3%)
- Common (>3%)
- Frequent (>40%)
@ -489,7 +488,7 @@ looks needlessly complex but contains the same parsing-relevant data as the old
- **Encountered on:** 29.01.2024
- **Impact:** 🟢 Low
- **Endpoint:** browse
- **Status:** Frequent (55%)
- **Status:** Experimental (<1%)
YouTube introduced a new data model for channel headers, based on a
`"pageHeaderRenderer"`. The new model comes with more needless complexity that needs to
@ -598,7 +597,7 @@ be accomodated. There are also no mobile/TV header images available any more.
- **Encountered on:** 29.02.2024
- **Impact:** 🟢 Low
- **Endpoint:** browse
- **Status:** Discontinued (0%)
- **Status:** Common (6%)
![A/B test 13 screenshot](./_img/ab_13.png)
@ -610,7 +609,7 @@ cover on the left side of the playlist content.
- **Encountered on:** 31.01.2024
- **Impact:** 🟢 Low
- **Endpoint:** next
- **Status:** Frequent (98%)
- **Status:** Common (50%)
YouTube changed the data model for YouTube comments, now putting the content into a
seperate framework update object

View file

@ -1259,7 +1259,7 @@ impl RustyPipeQuery {
}
/// Get a YouTube visitor data cookie, which is necessary for certain requests
pub async fn get_visitor_data(&self) -> Result<String, Error> {
async fn get_visitor_data(&self) -> Result<String, Error> {
match &self.opts.visitor_data {
Some(vd) => Ok(vd.clone()),
None => self.client.get_visitor_data().await,

View file

@ -3,36 +3,32 @@ source: tests/youtube.rs
expression: album
---
MusicAlbum(
id: "MPREb_Z81wHtF9fhC",
playlist_id: Some("OLAK5uy_l4sJyKllp77ht_HPYCUFo-sA6N8fNFNsY"),
name: "June Compilation",
id: "MPREb_bqWA6mAZFWS",
playlist_id: Some("OLAK5uy_mUiRbMqeQXFUH6h9KB87RcEmNtm45Qvs0"),
name: "Pedha Rasi Peddamma Katha",
cover: "[cover]",
artists: [],
artist_id: None,
description: None,
album_type: Album,
year: Some(2024),
by_va: true,
album_type: Ep,
year: Some(1968),
by_va: false,
tracks: [
TrackItem(
id: "ilNEztApdjI",
name: "Shanghai",
duration: Some(259),
id: "EX7-pOQHPyE",
name: "Siva Manoranjani",
duration: Some(267),
cover: [],
artists: [
ArtistId(
id: Some("UC9MB9dkvCCpM3qVF71TZL7g"),
name: "Crubbixz",
),
ArtistId(
id: Some("UCMYTb0sib5ppwQL9FAGmYTw"),
name: "Tank",
id: Some("UC1C05NyYICFB2mVGn9_ttEw"),
name: "Dr. M. Balamuralikrishna",
),
],
artist_id: Some("UC9MB9dkvCCpM3qVF71TZL7g"),
artist_id: Some("UC1C05NyYICFB2mVGn9_ttEw"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "June Compilation",
id: "MPREb_bqWA6mAZFWS",
name: "Pedha Rasi Peddamma Katha",
)),
view_count: "[view_count]",
is_video: false,
@ -40,20 +36,20 @@ MusicAlbum(
by_va: false,
),
TrackItem(
id: "s-qSnZyyvzs",
name: "Always Be With UExtended Mix",
duration: Some(165),
id: "0AyWB-Quj4A",
name: "Kuluku Nadakula",
duration: Some(179),
cover: [],
artists: [
ArtistId(
id: Some("UCpAZ1Ap_nuAEk9RiT-nUsWQ"),
name: "陈海择HeizerChan",
id: Some("UCDqpyYkgWy2h03HamIfODjw"),
name: "Ghantasala, Chorus",
),
],
artist_id: Some("UCpAZ1Ap_nuAEk9RiT-nUsWQ"),
artist_id: Some("UCDqpyYkgWy2h03HamIfODjw"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "June Compilation",
id: "MPREb_bqWA6mAZFWS",
name: "Pedha Rasi Peddamma Katha",
)),
view_count: "[view_count]",
is_video: false,
@ -61,20 +57,20 @@ MusicAlbum(
by_va: false,
),
TrackItem(
id: "4jXoRBcQ8PY",
name: "Elude (Extended Mix)",
duration: Some(329),
id: "s0Sb-GZLXSM",
name: "Gulabi Buggalunna",
duration: Some(155),
cover: [],
artists: [
ArtistId(
id: None,
name: "Julius Beat & SinDj",
id: Some("UC_KQPMiRQl3CFAIKTVfCHwA"),
name: "L.r. Eswari",
),
],
artist_id: Some("UCCRiYE0dTFA_pc23-97GfSg"),
artist_id: Some("UC_KQPMiRQl3CFAIKTVfCHwA"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "June Compilation",
id: "MPREb_bqWA6mAZFWS",
name: "Pedha Rasi Peddamma Katha",
)),
view_count: "[view_count]",
is_video: false,
@ -82,252 +78,57 @@ MusicAlbum(
by_va: false,
),
TrackItem(
id: "DRES9S4VQI8",
name: "Venus (Extended Mix)",
duration: Some(202),
id: "P4XAaXjlCDA",
name: "Oh Javaraala",
duration: Some(229),
cover: [],
artists: [
ArtistId(
id: Some("UC_y8p7fi6t3z10R2UEMQG_A"),
name: "Andymion",
id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
name: "S.p. Balasubrahmanyam, S. Janaki",
),
],
artist_id: Some("UC_y8p7fi6t3z10R2UEMQG_A"),
artist_id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "June Compilation",
id: "MPREb_bqWA6mAZFWS",
name: "Pedha Rasi Peddamma Katha",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(4),
by_va: false,
),
TrackItem(
id: "yhZVimwD4B4",
name: "Arise",
duration: Some(213),
cover: [],
artists: [
ArtistId(
id: Some("UCYAzELapKjDUHMGRbzjJtgw"),
name: "Takahiro Yoshihira",
],
variants: [
AlbumItem(
id: "MPREb_h8ltx5oKvyY",
name: "Pedha Rasi Peddamma Katha",
cover: [
Thumbnail(
url: "https://lh3.googleusercontent.com/iZtBdPWBGNB-GAWvOp9seuYj5QqKrUYGSe-B5J026yxHqFSWv4zsxHy-LxX5LbFlnepOPRWNLrajO-_-=w226-h226-l90-rj",
width: 226,
height: 226,
),
ArtistId(
id: Some("UCN2Ji-D6Tzn5CTC7iCWoX8w"),
name: "TOMI-NORI",
Thumbnail(
url: "https://lh3.googleusercontent.com/iZtBdPWBGNB-GAWvOp9seuYj5QqKrUYGSe-B5J026yxHqFSWv4zsxHy-LxX5LbFlnepOPRWNLrajO-_-=w544-h544-l90-rj",
width: 544,
height: 544,
),
],
artist_id: Some("UCYAzELapKjDUHMGRbzjJtgw"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "June Compilation",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(5),
by_va: false,
),
TrackItem(
id: "5d6YiFkdzLM",
name: "Acid Rave (Extended Mix)",
duration: Some(191),
cover: [],
artists: [
ArtistId(
id: Some("UCFqaoKXGfCsd9VRQNXzhIjQ"),
name: "SteelDrum",
id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
name: "S P Balasubramaniam",
),
ArtistId(
id: Some("UCWgAqlYG7mXTUxrFiLyDSsg"),
name: "S Janaki",
),
],
artist_id: Some("UCFqaoKXGfCsd9VRQNXzhIjQ"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "June Compilation",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(6),
by_va: false,
),
TrackItem(
id: "3Qe7-uN2PjU",
name: "Destiny (Extended Mix)",
duration: Some(446),
cover: [],
artists: [
ArtistId(
id: Some("UCjqRwXhXgFW7RDDPn_TlAbw"),
name: "Tyranix",
),
ArtistId(
id: Some("UCy69bQ95ovXIquWzY5jfAIA"),
name: "Jawzcirclesix",
),
],
artist_id: Some("UCjqRwXhXgFW7RDDPn_TlAbw"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "June Compilation",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(7),
by_va: false,
),
TrackItem(
id: "SKZ_MTsXFP4",
name: "Darksiders (Extended Mix)",
duration: Some(376),
cover: [],
artists: [
ArtistId(
id: Some("UCEUUFTUZpm1MmANCfLN5_9Q"),
name: "Kruky",
),
],
artist_id: Some("UCEUUFTUZpm1MmANCfLN5_9Q"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "June Compilation",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(8),
by_va: false,
),
TrackItem(
id: "n5-ujUwazDA",
name: "Mind Game (Extended Mix)",
duration: Some(335),
cover: [],
artists: [
ArtistId(
id: Some("UCxByvsK9hDZk2MnnF9jsFGw"),
name: "Herbrido",
),
],
artist_id: Some("UCxByvsK9hDZk2MnnF9jsFGw"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "June Compilation",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(9),
by_va: false,
),
TrackItem(
id: "VaREivfDJeY",
name: "Caronte (Extended Mix)",
duration: Some(268),
cover: [],
artists: [
ArtistId(
id: Some("UCG2o9g3Yl6jBL21_z7XBMVw"),
name: "Foodydrop",
),
],
artist_id: Some("UCG2o9g3Yl6jBL21_z7XBMVw"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "June Compilation",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(10),
by_va: false,
),
TrackItem(
id: "cWcD0WIK2PA",
name: "Left Right Go (Extended Mix)",
duration: Some(198),
cover: [],
artists: [
ArtistId(
id: Some("UCiIDz3M3cDn2QeYjLbhIdBQ"),
name: "Fly飞",
),
ArtistId(
id: Some("UChLPGmjYa8bmKShqMBFP_DA"),
name: "MARSJONE 鸡万",
),
],
artist_id: Some("UCiIDz3M3cDn2QeYjLbhIdBQ"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "June Compilation",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(11),
by_va: false,
),
TrackItem(
id: "QRELvH564T4",
name: "Terminal Zero (Extended Mix)",
duration: Some(325),
cover: [],
artists: [
ArtistId(
id: Some("UCbiVmjdLA5PKZcUnZMExqCA"),
name: "Reivax",
),
],
artist_id: Some("UCbiVmjdLA5PKZcUnZMExqCA"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "June Compilation",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(12),
by_va: false,
),
TrackItem(
id: "eCY0-GyG46s",
name: "The Unknown (Extended Mix)",
duration: Some(198),
cover: [],
artists: [
ArtistId(
id: Some("UC-thVg_PSz894f5mVqMFMeQ"),
name: "Elia Akita",
),
],
artist_id: Some("UC-thVg_PSz894f5mVqMFMeQ"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "June Compilation",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(13),
by_va: false,
),
TrackItem(
id: "UIrHYTEyUfA",
name: "This is Acid (Extended Mix)",
duration: Some(213),
cover: [],
artists: [
ArtistId(
id: Some("UC2pJL-Kp6yJtARS8MC0N8Ag"),
name: "Monored",
),
ArtistId(
id: Some("UCpmZakvqLLUZ4G_YkKjoy6g"),
name: "Egemen Kızıltekin",
),
],
artist_id: Some("UC2pJL-Kp6yJtARS8MC0N8Ag"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "June Compilation",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(14),
artist_id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
album_type: Ep,
year: None,
by_va: false,
),
],
variants: [],
)

View file

@ -3,35 +3,31 @@ source: tests/youtube.rs
expression: album
---
MusicAlbum(
id: "MPREb_Z81wHtF9fhC",
playlist_id: Some("OLAK5uy_l4sJyKllp77ht_HPYCUFo-sA6N8fNFNsY"),
id: "MPREb_bqWA6mAZFWS",
playlist_id: Some("OLAK5uy_mUiRbMqeQXFUH6h9KB87RcEmNtm45Qvs0"),
name: "[name]",
cover: "[cover]",
artists: [],
artist_id: None,
description: "[description]",
album_type: Album,
year: Some(2024),
by_va: true,
album_type: Ep,
year: Some(1968),
by_va: false,
tracks: [
TrackItem(
id: "ilNEztApdjI",
id: "EX7-pOQHPyE",
name: "[name]",
duration: Some(259),
duration: Some(267),
cover: [],
artists: [
ArtistId(
id: Some("UC9MB9dkvCCpM3qVF71TZL7g"),
name: "[name]",
),
ArtistId(
id: Some("UCMYTb0sib5ppwQL9FAGmYTw"),
id: Some("UC1C05NyYICFB2mVGn9_ttEw"),
name: "[name]",
),
],
artist_id: Some("UC9MB9dkvCCpM3qVF71TZL7g"),
artist_id: Some("UC1C05NyYICFB2mVGn9_ttEw"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
id: "MPREb_bqWA6mAZFWS",
name: "[name]",
)),
view_count: "[view_count]",
@ -40,19 +36,19 @@ MusicAlbum(
by_va: false,
),
TrackItem(
id: "s-qSnZyyvzs",
id: "0AyWB-Quj4A",
name: "[name]",
duration: Some(165),
duration: Some(179),
cover: [],
artists: [
ArtistId(
id: Some("UCpAZ1Ap_nuAEk9RiT-nUsWQ"),
id: Some("UCDqpyYkgWy2h03HamIfODjw"),
name: "[name]",
),
],
artist_id: Some("UCpAZ1Ap_nuAEk9RiT-nUsWQ"),
artist_id: Some("UCDqpyYkgWy2h03HamIfODjw"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
id: "MPREb_bqWA6mAZFWS",
name: "[name]",
)),
view_count: "[view_count]",
@ -61,19 +57,19 @@ MusicAlbum(
by_va: false,
),
TrackItem(
id: "4jXoRBcQ8PY",
id: "s0Sb-GZLXSM",
name: "[name]",
duration: Some(329),
duration: Some(155),
cover: [],
artists: [
ArtistId(
id: None,
id: Some("UC_KQPMiRQl3CFAIKTVfCHwA"),
name: "[name]",
),
],
artist_id: Some("UCCRiYE0dTFA_pc23-97GfSg"),
artist_id: Some("UC_KQPMiRQl3CFAIKTVfCHwA"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
id: "MPREb_bqWA6mAZFWS",
name: "[name]",
)),
view_count: "[view_count]",
@ -82,19 +78,19 @@ MusicAlbum(
by_va: false,
),
TrackItem(
id: "DRES9S4VQI8",
id: "P4XAaXjlCDA",
name: "[name]",
duration: Some(202),
duration: Some(229),
cover: [],
artists: [
ArtistId(
id: Some("UC_y8p7fi6t3z10R2UEMQG_A"),
id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
name: "[name]",
),
],
artist_id: Some("UC_y8p7fi6t3z10R2UEMQG_A"),
artist_id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
id: "MPREb_bqWA6mAZFWS",
name: "[name]",
)),
view_count: "[view_count]",
@ -102,232 +98,37 @@ MusicAlbum(
track_nr: Some(4),
by_va: false,
),
TrackItem(
id: "yhZVimwD4B4",
name: "[name]",
duration: Some(213),
cover: [],
],
variants: [
AlbumItem(
id: "MPREb_h8ltx5oKvyY",
name: "Pedha Rasi Peddamma Katha",
cover: [
Thumbnail(
url: "https://lh3.googleusercontent.com/iZtBdPWBGNB-GAWvOp9seuYj5QqKrUYGSe-B5J026yxHqFSWv4zsxHy-LxX5LbFlnepOPRWNLrajO-_-=w226-h226-l90-rj",
width: 226,
height: 226,
),
Thumbnail(
url: "https://lh3.googleusercontent.com/iZtBdPWBGNB-GAWvOp9seuYj5QqKrUYGSe-B5J026yxHqFSWv4zsxHy-LxX5LbFlnepOPRWNLrajO-_-=w544-h544-l90-rj",
width: 544,
height: 544,
),
],
artists: [
ArtistId(
id: Some("UCYAzELapKjDUHMGRbzjJtgw"),
id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
name: "[name]",
),
ArtistId(
id: Some("UCN2Ji-D6Tzn5CTC7iCWoX8w"),
id: Some("UCWgAqlYG7mXTUxrFiLyDSsg"),
name: "[name]",
),
],
artist_id: Some("UCYAzELapKjDUHMGRbzjJtgw"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "[name]",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(5),
by_va: false,
),
TrackItem(
id: "5d6YiFkdzLM",
name: "[name]",
duration: Some(191),
cover: [],
artists: [
ArtistId(
id: Some("UCFqaoKXGfCsd9VRQNXzhIjQ"),
name: "[name]",
),
],
artist_id: Some("UCFqaoKXGfCsd9VRQNXzhIjQ"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "[name]",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(6),
by_va: false,
),
TrackItem(
id: "3Qe7-uN2PjU",
name: "[name]",
duration: Some(446),
cover: [],
artists: [
ArtistId(
id: Some("UCjqRwXhXgFW7RDDPn_TlAbw"),
name: "[name]",
),
ArtistId(
id: Some("UCy69bQ95ovXIquWzY5jfAIA"),
name: "[name]",
),
],
artist_id: Some("UCjqRwXhXgFW7RDDPn_TlAbw"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "[name]",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(7),
by_va: false,
),
TrackItem(
id: "SKZ_MTsXFP4",
name: "[name]",
duration: Some(376),
cover: [],
artists: [
ArtistId(
id: Some("UCEUUFTUZpm1MmANCfLN5_9Q"),
name: "[name]",
),
],
artist_id: Some("UCEUUFTUZpm1MmANCfLN5_9Q"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "[name]",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(8),
by_va: false,
),
TrackItem(
id: "n5-ujUwazDA",
name: "[name]",
duration: Some(335),
cover: [],
artists: [
ArtistId(
id: Some("UCxByvsK9hDZk2MnnF9jsFGw"),
name: "[name]",
),
],
artist_id: Some("UCxByvsK9hDZk2MnnF9jsFGw"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "[name]",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(9),
by_va: false,
),
TrackItem(
id: "VaREivfDJeY",
name: "[name]",
duration: Some(268),
cover: [],
artists: [
ArtistId(
id: Some("UCG2o9g3Yl6jBL21_z7XBMVw"),
name: "[name]",
),
],
artist_id: Some("UCG2o9g3Yl6jBL21_z7XBMVw"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "[name]",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(10),
by_va: false,
),
TrackItem(
id: "cWcD0WIK2PA",
name: "[name]",
duration: Some(198),
cover: [],
artists: [
ArtistId(
id: Some("UCiIDz3M3cDn2QeYjLbhIdBQ"),
name: "[name]",
),
ArtistId(
id: Some("UChLPGmjYa8bmKShqMBFP_DA"),
name: "[name]",
),
],
artist_id: Some("UCiIDz3M3cDn2QeYjLbhIdBQ"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "[name]",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(11),
by_va: false,
),
TrackItem(
id: "QRELvH564T4",
name: "[name]",
duration: Some(325),
cover: [],
artists: [
ArtistId(
id: Some("UCbiVmjdLA5PKZcUnZMExqCA"),
name: "[name]",
),
],
artist_id: Some("UCbiVmjdLA5PKZcUnZMExqCA"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "[name]",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(12),
by_va: false,
),
TrackItem(
id: "eCY0-GyG46s",
name: "[name]",
duration: Some(198),
cover: [],
artists: [
ArtistId(
id: Some("UC-thVg_PSz894f5mVqMFMeQ"),
name: "[name]",
),
],
artist_id: Some("UC-thVg_PSz894f5mVqMFMeQ"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "[name]",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(13),
by_va: false,
),
TrackItem(
id: "UIrHYTEyUfA",
name: "[name]",
duration: Some(213),
cover: [],
artists: [
ArtistId(
id: Some("UC2pJL-Kp6yJtARS8MC0N8Ag"),
name: "[name]",
),
ArtistId(
id: Some("UCpmZakvqLLUZ4G_YkKjoy6g"),
name: "[name]",
),
],
artist_id: Some("UC2pJL-Kp6yJtARS8MC0N8Ag"),
album: Some(AlbumId(
id: "MPREb_Z81wHtF9fhC",
name: "[name]",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(14),
artist_id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
album_type: Ep,
year: None,
by_va: false,
),
],
variants: [],
)

View file

@ -0,0 +1,138 @@
---
source: tests/youtube.rs
expression: album
---
MusicAlbum(
id: "MPREb_h8ltx5oKvyY",
playlist_id: Some("OLAK5uy_lIDfTi_k8V1RJ54MeJJGK_BduAeYbm-0s"),
name: "Pedha Rasi Peddamma Katha",
cover: "[cover]",
artists: [
ArtistId(
id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
name: "S P Balasubramaniam",
),
ArtistId(
id: Some("UCWgAqlYG7mXTUxrFiLyDSsg"),
name: "S Janaki",
),
],
artist_id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
description: None,
album_type: Ep,
year: Some(1968),
by_va: false,
tracks: [
TrackItem(
id: "AKJ3IJZKPWc",
name: "Oh Javaraala",
duration: Some(229),
cover: [],
artists: [
ArtistId(
id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
name: "S P Balasubramaniam",
),
ArtistId(
id: Some("UCWgAqlYG7mXTUxrFiLyDSsg"),
name: "S Janaki",
),
],
artist_id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
album: Some(AlbumId(
id: "MPREb_h8ltx5oKvyY",
name: "Pedha Rasi Peddamma Katha",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(1),
by_va: false,
),
TrackItem(
id: "WnpZuHNB33E",
name: "Siva Manoranjani",
duration: Some(267),
cover: [],
artists: [
ArtistId(
id: Some("UC1C05NyYICFB2mVGn9_ttEw"),
name: "M Balamuralikrishna",
),
],
artist_id: Some("UC1C05NyYICFB2mVGn9_ttEw"),
album: Some(AlbumId(
id: "MPREb_h8ltx5oKvyY",
name: "Pedha Rasi Peddamma Katha",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(2),
by_va: false,
),
TrackItem(
id: "pRqoDGXg1-I",
name: "Gulabi Buggalunna",
duration: Some(155),
cover: [],
artists: [
ArtistId(
id: Some("UC_KQPMiRQl3CFAIKTVfCHwA"),
name: "L R Eswari",
),
],
artist_id: Some("UC_KQPMiRQl3CFAIKTVfCHwA"),
album: Some(AlbumId(
id: "MPREb_h8ltx5oKvyY",
name: "Pedha Rasi Peddamma Katha",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(3),
by_va: false,
),
TrackItem(
id: "20vIKLJxjBY",
name: "Kuluku Nadakula",
duration: Some(179),
cover: [],
artists: [
ArtistId(
id: None,
name: "Ghantasala & Chorus",
),
],
artist_id: Some("UCDqpyYkgWy2h03HamIfODjw"),
album: Some(AlbumId(
id: "MPREb_h8ltx5oKvyY",
name: "Pedha Rasi Peddamma Katha",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(4),
by_va: false,
),
],
variants: [
AlbumItem(
id: "MPREb_bqWA6mAZFWS",
name: "Pedha Rasi Peddamma Katha",
cover: [
Thumbnail(
url: "https://lh3.googleusercontent.com/cyKTDdyucqYv8xfv0t3Vs9CkhmvssXRKsGzlWN_DU6A9uapXvovV0Ys2fXc9-r7Jv7V4UB1OD48iYH5z=w226-h226-l90-rj",
width: 226,
height: 226,
),
Thumbnail(
url: "https://lh3.googleusercontent.com/cyKTDdyucqYv8xfv0t3Vs9CkhmvssXRKsGzlWN_DU6A9uapXvovV0Ys2fXc9-r7Jv7V4UB1OD48iYH5z=w544-h544-l90-rj",
width: 544,
height: 544,
),
],
artists: [],
artist_id: None,
album_type: Ep,
year: None,
by_va: true,
),
],
)

View file

@ -0,0 +1,138 @@
---
source: tests/youtube.rs
expression: album
---
MusicAlbum(
id: "MPREb_h8ltx5oKvyY",
playlist_id: Some("OLAK5uy_lIDfTi_k8V1RJ54MeJJGK_BduAeYbm-0s"),
name: "[name]",
cover: "[cover]",
artists: [
ArtistId(
id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
name: "[name]",
),
ArtistId(
id: Some("UCWgAqlYG7mXTUxrFiLyDSsg"),
name: "[name]",
),
],
artist_id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
description: "[description]",
album_type: Ep,
year: Some(1968),
by_va: false,
tracks: [
TrackItem(
id: "AKJ3IJZKPWc",
name: "[name]",
duration: Some(229),
cover: [],
artists: [
ArtistId(
id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
name: "[name]",
),
ArtistId(
id: Some("UCWgAqlYG7mXTUxrFiLyDSsg"),
name: "[name]",
),
],
artist_id: Some("UCl4iPtukwe7m0kIxUMskkgA"),
album: Some(AlbumId(
id: "MPREb_h8ltx5oKvyY",
name: "[name]",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(1),
by_va: false,
),
TrackItem(
id: "WnpZuHNB33E",
name: "[name]",
duration: Some(267),
cover: [],
artists: [
ArtistId(
id: Some("UC1C05NyYICFB2mVGn9_ttEw"),
name: "[name]",
),
],
artist_id: Some("UC1C05NyYICFB2mVGn9_ttEw"),
album: Some(AlbumId(
id: "MPREb_h8ltx5oKvyY",
name: "[name]",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(2),
by_va: false,
),
TrackItem(
id: "pRqoDGXg1-I",
name: "[name]",
duration: Some(155),
cover: [],
artists: [
ArtistId(
id: Some("UC_KQPMiRQl3CFAIKTVfCHwA"),
name: "[name]",
),
],
artist_id: Some("UC_KQPMiRQl3CFAIKTVfCHwA"),
album: Some(AlbumId(
id: "MPREb_h8ltx5oKvyY",
name: "[name]",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(3),
by_va: false,
),
TrackItem(
id: "20vIKLJxjBY",
name: "[name]",
duration: Some(179),
cover: [],
artists: [
ArtistId(
id: None,
name: "[name]",
),
],
artist_id: Some("UCDqpyYkgWy2h03HamIfODjw"),
album: Some(AlbumId(
id: "MPREb_h8ltx5oKvyY",
name: "[name]",
)),
view_count: "[view_count]",
is_video: false,
track_nr: Some(4),
by_va: false,
),
],
variants: [
AlbumItem(
id: "MPREb_bqWA6mAZFWS",
name: "Pedha Rasi Peddamma Katha",
cover: [
Thumbnail(
url: "https://lh3.googleusercontent.com/cyKTDdyucqYv8xfv0t3Vs9CkhmvssXRKsGzlWN_DU6A9uapXvovV0Ys2fXc9-r7Jv7V4UB1OD48iYH5z=w226-h226-l90-rj",
width: 226,
height: 226,
),
Thumbnail(
url: "https://lh3.googleusercontent.com/cyKTDdyucqYv8xfv0t3Vs9CkhmvssXRKsGzlWN_DU6A9uapXvovV0Ys2fXc9-r7Jv7V4UB1OD48iYH5z=w544-h544-l90-rj",
width: 544,
height: 544,
),
],
artists: [],
artist_id: None,
album_type: Ep,
year: None,
by_va: true,
),
],
)

View file

@ -6,7 +6,7 @@ MusicArtist(
id: "UC7cl4MmM6ZZ2TcFyMk_b4pg",
name: "Unheilig",
header_image: "[header_image]",
description: Some("Unheilig is a German band that draws from a variety of influences, including various pop and electronic styles as well as heavier, nihilistic hard rock. The band was founded in Aachen in 1999 and principally consisted of singer Bernd Heinrich \"Der Graf\" along with various musical partners. He was accompanied for live shows with musicians Christoph \"Licky\" Termühlen, Henning Verlage, and Martin \"Potti\" Potthoff. The group\'s debut, Phosphor, came out in 2000.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Unheilig) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"),
description: Some("Unheilig was a German band that featured a variety of influences, including various pop and electronic styles as well as harder, nihilistic hard rock. The band was founded in 1999 and principally consisted of singer Bernd Heinrich \"Der Graf\" along with various musical partners. He was accompanied for live shows with musicians Christoph \"Licky\" Termühlen, Henning Verlage, and Martin \"Potti\" Potthoff. The group\'s debut, Phosphor, came out in 2000.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Unheilig) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"),
wikipedia_url: Some("https://en.wikipedia.org/wiki/Unheilig"),
subscriber_count: "[subscriber_count]",
tracks: "[tracks]",
@ -56,6 +56,21 @@ MusicArtist(
year: Some(2008),
by_va: false,
),
AlbumItem(
id: "MPREb_88p7e6nBtgz",
name: "Lichter der Stadt",
cover: "[cover]",
artists: [
ArtistId(
id: Some("UC7cl4MmM6ZZ2TcFyMk_b4pg"),
name: "Unheilig",
),
],
artist_id: Some("UC7cl4MmM6ZZ2TcFyMk_b4pg"),
album_type: Single,
year: Some(2012),
by_va: false,
),
AlbumItem(
id: "MPREb_Md2aZrjaqHX",
name: "Stille Winternacht",
@ -86,21 +101,6 @@ MusicArtist(
year: Some(2018),
by_va: false,
),
AlbumItem(
id: "MPREb_QEClJsuO9xM",
name: "So wie Du warst",
cover: "[cover]",
artists: [
ArtistId(
id: Some("UC7cl4MmM6ZZ2TcFyMk_b4pg"),
name: "Unheilig",
),
],
artist_id: Some("UC7cl4MmM6ZZ2TcFyMk_b4pg"),
album_type: Single,
year: Some(2012),
by_va: false,
),
AlbumItem(
id: "MPREb_QyGCcLWExXj",
name: "Als wär\'s das erste Mal (Exklusive Piano Version)",

View file

@ -56,6 +56,21 @@ MusicArtist(
year: Some(2008),
by_va: false,
),
AlbumItem(
id: "MPREb_88p7e6nBtgz",
name: "[name]",
cover: "[cover]",
artists: [
ArtistId(
id: Some("UC7cl4MmM6ZZ2TcFyMk_b4pg"),
name: "[name]",
),
],
artist_id: Some("UC7cl4MmM6ZZ2TcFyMk_b4pg"),
album_type: Single,
year: Some(2012),
by_va: false,
),
AlbumItem(
id: "MPREb_Md2aZrjaqHX",
name: "[name]",
@ -86,21 +101,6 @@ MusicArtist(
year: Some(2018),
by_va: false,
),
AlbumItem(
id: "MPREb_QEClJsuO9xM",
name: "[name]",
cover: "[cover]",
artists: [
ArtistId(
id: Some("UC7cl4MmM6ZZ2TcFyMk_b4pg"),
name: "[name]",
),
],
artist_id: Some("UC7cl4MmM6ZZ2TcFyMk_b4pg"),
album_type: Single,
year: Some(2012),
by_va: false,
),
AlbumItem(
id: "MPREb_QyGCcLWExXj",
name: "[name]",

View file

@ -6,7 +6,7 @@ MusicArtist(
id: "UCfwCE5VhPMGxNPFxtVv7lRw",
name: "Sulli",
header_image: "[header_image]",
description: Some("Choi Jin-ri, known professionally as Sulli, was a South Korean singer and actress. She first made her debut as a child actress, appearing as a supporting cast member on the SBS historical drama Ballad of Seodong. Following this, she earned a number of guest roles, appearing in the television series Love Needs a Miracle and Drama City, and the film Vacation. She then subsequently appeared in the independent films Punch Lady and BA:BO, the former being her first time cast in a substantial dramatic role.\nAfter signing a record deal with SM Entertainment, Sulli rose to prominence as a member of the girl group f(x) formed in 2009. The group achieved both critical and commercial success, with four Korean number-one singles and international recognition after becoming the first K-pop act to perform at SXSW. Concurrently with her music career, Sulli returned to acting by starring in the SBS romantic comedy series, To the Beautiful You, a Korean adaptation of the shōjo manga Hana-Kimi where her performance was positively received and earned her two SBS Drama Awards and a nomination at the 49th Paeksang Arts Awards.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Sulli) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"),
description: Some("Choi Jin-ri, better known by her stage name Sulli, was a South Korean singer and actress. She first made her debut as a child actress, appearing as a supporting cast member on the SBS historical drama Ballad of Seodong. Following this, she earned a number of guest roles, appearing in the television series Love Needs a Miracle and Drama City, and the film Vacation. She then subsequently appeared in the independent films Punch Lady and BA:BO, the former being her first time cast in a substantial dramatic role.\nAfter signing a record deal with SM Entertainment, Sulli rose to prominence as a member of the girl group f(x) formed in 2009. The group achieved both critical and commercial success, with four Korean number-one singles and international recognition after becoming the first K-pop act to perform at SXSW. Concurrently with her music career, Sulli returned to acting by starring in the SBS romantic comedy series, To the Beautiful You, a Korean adaptation of the shōjo manga Hana-Kimi where her performance was positively received and earned her two SBS Drama Awards and a nomination at the 49th Paeksang Arts Awards.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Sulli) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"),
wikipedia_url: Some("https://en.wikipedia.org/wiki/Sulli"),
subscriber_count: "[subscriber_count]",
tracks: "[tracks]",

View file

@ -14,7 +14,7 @@ use rustypipe::model::{
richtext::ToPlaintext,
traits::{FromYtItem, YtStream},
AlbumType, AudioCodec, AudioFormat, AudioTrackType, Channel, Frameset, MusicGenre, MusicItem,
UrlTarget, Verification, VideoCodec, VideoFormat, VideoId, YouTubeItem,
UrlTarget, Verification, VideoCodec, VideoFormat, YouTubeItem,
};
use rustypipe::param::{
search_filter::{self, SearchFilter},
@ -67,8 +67,8 @@ async fn get_player_from_client(#[case] client_type: ClientType, rp: RustyPipe)
let video = player_data
.video_only_streams
.into_iter()
.find(|s| s.itag == 136)
.expect("video #136");
.find(|s| s.itag == 247)
.expect("video #247");
let audio = player_data
.audio_streams
.into_iter()
@ -76,17 +76,17 @@ async fn get_player_from_client(#[case] client_type: ClientType, rp: RustyPipe)
.expect("audio #140");
// Bitrates may change between requests
assert_approx(video.bitrate, 2_341_408);
assert_eq!(video.average_bitrate, 1_660_210);
assert_eq!(video.size, Some(53_754_490));
assert_approx(video.bitrate, 1_500_162);
assert_eq!(video.average_bitrate, 1_360_266);
assert_eq!(video.size, Some(44_042_868));
assert_eq!(video.width, 1280);
assert_eq!(video.height, 720);
assert_eq!(video.fps, 30);
assert_eq!(video.quality, "720p");
assert!(!video.hdr);
assert_eq!(video.mime, "video/mp4; codecs=\"avc1.4D401F\"");
assert_eq!(video.format, VideoFormat::Mp4);
assert_eq!(video.codec, VideoCodec::Avc1);
assert_eq!(video.mime, "video/webm; codecs=\"vp09.00.31.08\"");
assert_eq!(video.format, VideoFormat::Webm);
assert_eq!(video.codec, VideoCodec::Vp9);
assert_approx(audio.bitrate, 130_685);
assert_approx(audio.average_bitrate, 129_496);
@ -418,8 +418,6 @@ async fn playlist_cont(rp: RustyPipe) {
.extend_pages(rp.query(), usize::MAX)
.await
.unwrap();
check_duplicates(&playlist.videos.items);
assert_gte(playlist.videos.items.len(), 101, "video items");
assert_gteo(playlist.videos.count, 101, "video count");
}
@ -434,7 +432,6 @@ async fn playlist_cont2(rp: RustyPipe) {
.unwrap();
playlist.videos.extend_limit(rp.query(), 101).await.unwrap();
check_duplicates(&playlist.videos.items);
assert_gte(playlist.videos.items.len(), 101, "video items");
assert_gteo(playlist.videos.count, 101, "video count");
}
@ -1530,8 +1527,6 @@ async fn music_playlist_cont(#[case] id: &str, rp: RustyPipe) {
playlist.tracks.extend_pages(rp.query(), 5).await.unwrap();
check_duplicates(&playlist.tracks.items);
let track_count = playlist.track_count.unwrap();
assert_gte(track_count, 100, "tracks");
@ -1581,11 +1576,12 @@ async fn music_playlist_not_found(rp: RustyPipe) {
#[case::various_artists("various_artists", "MPREb_8QkDeEIawvX")]
#[case::single("single", "MPREb_bHfHGoy7vuv")]
#[case::ep("ep", "MPREb_u1I69lSAe5v")]
#[case::audiobook("audiobook", "MPREb_gaoNzsQHedo")]
// #[case::audiobook("audiobook", "MPREb_gaoNzsQHedo")]
#[case::show("show", "MPREb_aDDw2kVEFtM")]
#[case::unavailable("unavailable", "MPREb_AzuWg8qAVVl")]
#[case::no_year("no_year", "MPREb_F3Af9UZZVxX")]
#[case::no_artist("no_artist", "MPREb_Z81wHtF9fhC")]
#[case::version_no_artist("version_no_artist", "MPREb_h8ltx5oKvyY")]
#[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();
@ -1631,7 +1627,8 @@ async fn music_album_not_found(rp: RustyPipe) {
#[rstest]
#[case::basic_all("basic_all", "UCFKUUtHjT4iq3p0JJA13SOA", true, 15, 1)]
#[case::basic("basic", "UC7cl4MmM6ZZ2TcFyMk_b4pg", false, 15, 2)]
// TODO: wait for A/B test 6 to stabilize
// #[case::basic("basic", "UC7cl4MmM6ZZ2TcFyMk_b4pg", false, 15, 2)]
#[case::no_more_albums("no_more_albums", "UCOR4_bSVIXPsGa4BbCSt60Q", true, 15, 0)]
#[case::only_singles("only_singles", "UCfwCE5VhPMGxNPFxtVv7lRw", false, 13, 0)]
#[case::no_artist("no_artist", "UCh8gHdtzO2tXd593_bjErWg", false, 0, 0)]
@ -2783,12 +2780,3 @@ fn assert_frameset(frameset: &Frameset) {
let n = frameset.urls().count() as u32;
assert_eq!(n, frameset.page_count);
}
#[track_caller]
fn check_duplicates<T: Clone + Into<VideoId>>(items: &[T]) {
let ids = items
.iter()
.map(|itm| itm.clone().into().id)
.collect::<HashSet<String>>();
assert_eq!(ids.len(), items.len(), "duplicate items");
}