diff --git a/src/util/mod.rs b/src/util/mod.rs index 3615aa5..274301c 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -25,7 +25,7 @@ pub static VIDEO_ID_REGEX: Lazy = Lazy::new(|| Regex::new(r"^[A-Za-z0-9_- pub static CHANNEL_ID_REGEX: Lazy = Lazy::new(|| Regex::new(r"^UC[A-Za-z0-9_-]{22}$").unwrap()); pub static PLAYLIST_ID_REGEX: Lazy = - Lazy::new(|| Regex::new(r"^(?:PL|RDCLAK|OLAK)[A-Za-z0-9_-]{30,50}$").unwrap()); + Lazy::new(|| Regex::new(r"^(?:PL|RDCLAK|OLAK)[A-Za-z0-9_-]{16,50}$").unwrap()); pub static ALBUM_ID_REGEX: Lazy = Lazy::new(|| Regex::new(r"^MPREb_[A-Za-z0-9_-]{11}$").unwrap()); pub static VANITY_PATH_REGEX: Lazy = Lazy::new(|| { diff --git a/tests/snapshots/youtube__music_lyrics.snap b/tests/snapshots/youtube__music_lyrics.snap index 5d233fa..ecb76ac 100644 --- a/tests/snapshots/youtube__music_lyrics.snap +++ b/tests/snapshots/youtube__music_lyrics.snap @@ -3,6 +3,6 @@ source: tests/youtube.rs expression: lyrics --- Lyrics( - body: "Still and silent\nCalm before the storm\nGold and diamond\nJewels behind the throne\n\nInto the night\nOut of the dark\nTake to the sky\nChasing the stars\nAll that we said\nAll that we are\nWaiting to fly\nThis is the start\n\nHide and seek\nReason and rhyme\nGrand and glorious\nLiving the dream\nYours and mine\nEuphoria\n\nHide and seek\nReason and rhyme\nGrand and glorious\nLiving the dream\nYours and mine\nEuphoria\n\nStone and feather\nMove outside your head\nNow or never\nStrong in every step\n\nGive me a sign\nHitting the mark\nTake to the sky\nChasing the stars\nOpen your eyes\nWatching afar\nWaiting to fly\nThis is the start\n\nHide and seek\nReason and rhyme\nGrand and glorious\nLiving the dream\nYours and mine\nEuphoria\n\nHide and seek\nReason and rhyme\nGrand and glorious\nLiving the dream\nYours and mine\nEuphoria", + body: "Eyes, in the sky, gazing far into the night\nI raise my hand to the fire, but it\'s no use\n\'Cause you can\'t stop it from shining through\nIt\'s true\nBaby let the light shine through\nIf you believe it\'s true\nBaby won\'t you let the light shine through\nFor you\nFor you\nFor you\nFor you\nFor you\nFor you\nFor you\nFor you\nFor you\nFor you\nFor you\nWon\'t you let the light shine through\n\nEyes, in the sky, gazing far into the night\nI raise my hand to the fire, but it\'s no use\n\'Cause you can\'t stop it from shining through\nIt\'s true\nBaby let the light shine through\nIf you believe it\'s true\nBaby won\'t you let the light shine through\nFor you\nFor you\nFor you\nFor you\nFor you\nFor you\nFor you\nFor you\nFor you\nFor you\nFor you\nFor you", footer: "Source: Musixmatch", ) diff --git a/tests/youtube.rs b/tests/youtube.rs index 0050f4b..869102c 100644 --- a/tests/youtube.rs +++ b/tests/youtube.rs @@ -177,7 +177,7 @@ fn check_video_stream(s: impl YtStream) { )] #[case::live( "86YLFOog4GM", - "🌎 Nasa Live Stream - Earth From Space : Live Views from the ISS", + "🌎 Earth From Space Live Stream : Live Views from the ISS", "The station is crewed by NASA astronauts as well as Russian Cosmonauts", 0, "UCakgsb0w7QB0VHdnCc-OVEA", @@ -660,7 +660,7 @@ fn get_video_details_live(rp: RustyPipe) { assert_eq!(details.id, "86YLFOog4GM"); assert_eq!( details.name, - "🌎 Nasa Live Stream - Earth From Space : Live Views from the ISS" + "🌎 Earth From Space Live Stream : Live Views from the ISS" ); let desc = details.description.to_plaintext(); assert!( @@ -930,7 +930,6 @@ fn assert_channel_eevblog(channel: &Channel) { true )] #[case::music("UC-9-kyTW8ZkZNDHQJ6FgpwQ", "Music", false, false)] -#[case::news("UCYfdidRxbB8Qhf0Nx7ioOYw", "News", false, false)] fn channel_more( #[case] id: &str, #[case] name: &str, @@ -969,6 +968,7 @@ fn channel_more( #[case::sports("UCEgdi0XIXXZ-qJOFPf4JSKw")] #[case::learning("UCtFRv9O2AHqOZjjynzrv-xg")] #[case::live("UC4R8DWoMoI7CAwX8_LjQHig")] +#[case::news("UCYfdidRxbB8Qhf0Nx7ioOYw")] fn channel_not_found(#[case] id: &str, rp: RustyPipe) { let err = tokio_test::block_on(rp.query().channel_videos(&id)).unwrap_err(); @@ -1675,6 +1675,18 @@ fn music_search_playlists(#[case] with_community: bool, rp: RustyPipe) { assert_gte(playlist.track_count.unwrap(), 100, "tracks"); assert_eq!(playlist.channel, None); assert!(playlist.from_ytm); + + if with_community { + assert!( + res.items.items.iter().any(|p| !p.from_ytm), + "no community items found" + ) + } else { + assert!( + res.items.items.iter().all(|p| p.from_ytm), + "community items found" + ) + } } #[rstest] @@ -1704,6 +1716,11 @@ 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. @@ -1765,7 +1782,7 @@ fn music_details(#[case] name: &str, #[case] id: &str, rp: RustyPipe) { #[rstest] fn music_lyrics(rp: RustyPipe) { - let track = tokio_test::block_on(rp.query().music_details("NO8Arj4yeww")).unwrap(); + let track = tokio_test::block_on(rp.query().music_details("60ImQ8DS3Vs")).unwrap(); let lyrics = tokio_test::block_on(rp.query().music_lyrics(&track.lyrics_id.unwrap())).unwrap(); insta::assert_ron_snapshot!(lyrics); }