fix: playlist ID regex, tests
This commit is contained in:
parent
3aa8be423d
commit
6a99540ef5
3 changed files with 23 additions and 6 deletions
|
|
@ -25,7 +25,7 @@ pub static VIDEO_ID_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"^[A-Za-z0-9_-
|
|||
pub static CHANNEL_ID_REGEX: Lazy<Regex> =
|
||||
Lazy::new(|| Regex::new(r"^UC[A-Za-z0-9_-]{22}$").unwrap());
|
||||
pub static PLAYLIST_ID_REGEX: Lazy<Regex> =
|
||||
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<Regex> =
|
||||
Lazy::new(|| Regex::new(r"^MPREb_[A-Za-z0-9_-]{11}$").unwrap());
|
||||
pub static VANITY_PATH_REGEX: Lazy<Regex> = Lazy::new(|| {
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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<T>(channel: &Channel<T>) {
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue