fix: v1.67 clippy lints (inline format strings)
This commit is contained in:
parent
15dad0c428
commit
331a13568a
33 changed files with 200 additions and 288 deletions
|
|
@ -510,7 +510,7 @@ mod tests {
|
|||
#[case::shorts("shorts", "UCh8gHdtzO2tXd593_bjErWg")]
|
||||
#[case::livestreams("livestreams", "UC2DjFE7Xf11URZqWBigcVOQ")]
|
||||
fn map_channel_videos(#[case] name: &str, #[case] id: &str) {
|
||||
let json_path = path!("testfiles" / "channel" / format!("channel_{}.json", name));
|
||||
let json_path = path!("testfiles" / "channel" / format!("channel_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let channel: response::Channel =
|
||||
|
|
@ -525,11 +525,11 @@ mod tests {
|
|||
);
|
||||
|
||||
if name == "videos_upcoming" {
|
||||
insta::assert_ron_snapshot!(format!("map_channel_{}", name), map_res.c, {
|
||||
insta::assert_ron_snapshot!(format!("map_channel_{name}"), map_res.c, {
|
||||
".content.items[1:].publish_date" => "[date]",
|
||||
});
|
||||
} else {
|
||||
insta::assert_ron_snapshot!(format!("map_channel_{}", name), map_res.c, {
|
||||
insta::assert_ron_snapshot!(format!("map_channel_{name}"), map_res.c, {
|
||||
".content.items[].publish_date" => "[date]",
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ impl RustyPipeQuery {
|
|||
reporter.report(&report);
|
||||
}
|
||||
|
||||
Err(ExtractionError::InvalidData(
|
||||
format!("could not deserialize xml: {}", e).into(),
|
||||
Err(
|
||||
ExtractionError::InvalidData(format!("could not deserialize xml: {e}").into())
|
||||
.into(),
|
||||
)
|
||||
.into())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,8 +130,6 @@ impl Default for RequestYT {
|
|||
#[derive(Clone, Debug, Serialize, Default)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct User {
|
||||
// TODO: provide a way to enable restricted mode with:
|
||||
// "enableSafetyMode": true
|
||||
locked_safety_mode: bool,
|
||||
}
|
||||
|
||||
|
|
@ -926,8 +924,7 @@ impl RustyPipeQuery {
|
|||
.inner
|
||||
.http
|
||||
.post(format!(
|
||||
"{}{}?key={}{}",
|
||||
YOUTUBEI_V1_URL, endpoint, DESKTOP_API_KEY, DISABLE_PRETTY_PRINT_PARAMETER
|
||||
"{YOUTUBEI_V1_URL}{endpoint}?key={DESKTOP_API_KEY}{DISABLE_PRETTY_PRINT_PARAMETER}"
|
||||
))
|
||||
.header(header::ORIGIN, "https://www.youtube.com")
|
||||
.header(header::REFERER, "https://www.youtube.com")
|
||||
|
|
@ -942,11 +939,7 @@ impl RustyPipeQuery {
|
|||
.inner
|
||||
.http
|
||||
.post(format!(
|
||||
"{}{}?key={}{}",
|
||||
YOUTUBE_MUSIC_V1_URL,
|
||||
endpoint,
|
||||
DESKTOP_MUSIC_API_KEY,
|
||||
DISABLE_PRETTY_PRINT_PARAMETER
|
||||
"{YOUTUBE_MUSIC_V1_URL}{endpoint}?key={DESKTOP_MUSIC_API_KEY}{DISABLE_PRETTY_PRINT_PARAMETER}"
|
||||
))
|
||||
.header(header::ORIGIN, "https://music.youtube.com")
|
||||
.header(header::REFERER, "https://music.youtube.com")
|
||||
|
|
@ -961,8 +954,7 @@ impl RustyPipeQuery {
|
|||
.inner
|
||||
.http
|
||||
.post(format!(
|
||||
"{}{}?key={}{}",
|
||||
YOUTUBEI_V1_URL, endpoint, DESKTOP_API_KEY, DISABLE_PRETTY_PRINT_PARAMETER
|
||||
"{YOUTUBEI_V1_URL}{endpoint}?key={DESKTOP_API_KEY}{DISABLE_PRETTY_PRINT_PARAMETER}"
|
||||
))
|
||||
.header(header::ORIGIN, "https://www.youtube.com")
|
||||
.header(header::REFERER, "https://www.youtube.com")
|
||||
|
|
@ -973,11 +965,7 @@ impl RustyPipeQuery {
|
|||
.inner
|
||||
.http
|
||||
.post(format!(
|
||||
"{}{}?key={}{}",
|
||||
YOUTUBEI_V1_GAPIS_URL,
|
||||
endpoint,
|
||||
ANDROID_API_KEY,
|
||||
DISABLE_PRETTY_PRINT_PARAMETER
|
||||
"{YOUTUBEI_V1_GAPIS_URL}{endpoint}?key={ANDROID_API_KEY}{DISABLE_PRETTY_PRINT_PARAMETER}"
|
||||
))
|
||||
.header(
|
||||
header::USER_AGENT,
|
||||
|
|
@ -992,8 +980,7 @@ impl RustyPipeQuery {
|
|||
.inner
|
||||
.http
|
||||
.post(format!(
|
||||
"{}{}?key={}{}",
|
||||
YOUTUBEI_V1_GAPIS_URL, endpoint, IOS_API_KEY, DISABLE_PRETTY_PRINT_PARAMETER
|
||||
"{YOUTUBEI_V1_GAPIS_URL}{endpoint}?key={IOS_API_KEY}{DISABLE_PRETTY_PRINT_PARAMETER}"
|
||||
))
|
||||
.header(
|
||||
header::USER_AGENT,
|
||||
|
|
@ -1065,7 +1052,7 @@ impl RustyPipeQuery {
|
|||
let report = Report {
|
||||
info: Default::default(),
|
||||
level,
|
||||
operation: format!("{}({})", operation, id),
|
||||
operation: format!("{operation}({id})"),
|
||||
error,
|
||||
msgs,
|
||||
deobf_data: deobf.map(Deobfuscator::get_data),
|
||||
|
|
@ -1230,7 +1217,6 @@ mod tests {
|
|||
fn t_get_ytm_visitor_data() {
|
||||
let rp = RustyPipe::new();
|
||||
let visitor_data = tokio_test::block_on(rp.get_ytm_visitor_data()).unwrap();
|
||||
dbg!(&visitor_data);
|
||||
assert!(visitor_data.ends_with("%3D"));
|
||||
assert_eq!(visitor_data.len(), 32)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -380,13 +380,12 @@ mod tests {
|
|||
#[case::no_artist("no_artist", "UCh8gHdtzO2tXd593_bjErWg")]
|
||||
#[case::only_more_singles("only_more_singles", "UC0aXrjVxG5pZr99v77wZdPQ")]
|
||||
fn map_music_artist(#[case] name: &str, #[case] id: &str) {
|
||||
let json_path = path!("testfiles" / "music_artist" / format!("artist_{}.json", name));
|
||||
let json_path = path!("testfiles" / "music_artist" / format!("artist_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let mut album_page_paths = Vec::new();
|
||||
for i in 1..=2 {
|
||||
let json_path =
|
||||
path!("testfiles" / "music_artist" / format!("artist_{}_{}.json", name, i));
|
||||
let json_path = path!("testfiles" / "music_artist" / format!("artist_{name}_{i}.json"));
|
||||
if !json_path.exists() {
|
||||
break;
|
||||
}
|
||||
|
|
@ -421,7 +420,7 @@ mod tests {
|
|||
artist.albums.append(&mut map_res.c);
|
||||
}
|
||||
|
||||
insta::assert_ron_snapshot!(format!("map_music_artist_{}", name), artist);
|
||||
insta::assert_ron_snapshot!(format!("map_music_artist_{name}"), artist);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -458,7 +457,7 @@ mod tests {
|
|||
ExtractionError::Redirect(id) => {
|
||||
assert_eq!(id, "UCOR4_bSVIXPsGa4BbCSt60Q")
|
||||
}
|
||||
_ => panic!("error: {}", e),
|
||||
_ => panic!("error: {e}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ mod tests {
|
|||
#[case::default("global")]
|
||||
#[case::us("US")]
|
||||
fn map_music_charts(#[case] name: &str) {
|
||||
let filename = format!("testfiles/music_charts/charts_{}.json", name);
|
||||
let filename = format!("testfiles/music_charts/charts_{name}.json");
|
||||
let json_path = Path::new(&filename);
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
|
|
@ -167,6 +167,6 @@ mod tests {
|
|||
"deserialization/mapping warnings: {:?}",
|
||||
map_res.warnings
|
||||
);
|
||||
insta::assert_ron_snapshot!(format!("map_music_charts_{}", name), map_res.c);
|
||||
insta::assert_ron_snapshot!(format!("map_music_charts_{name}"), map_res.c);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ mod tests {
|
|||
#[case::mv("mv", "ZeerrnuLi5E")]
|
||||
#[case::track("track", "7nigXQS1Xb0")]
|
||||
fn map_music_details(#[case] name: &str, #[case] id: &str) {
|
||||
let json_path = path!("testfiles" / "music_details" / format!("details_{}.json", name));
|
||||
let json_path = path!("testfiles" / "music_details" / format!("details_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let details: response::MusicDetails =
|
||||
|
|
@ -414,14 +414,14 @@ mod tests {
|
|||
"deserialization/mapping warnings: {:?}",
|
||||
map_res.warnings
|
||||
);
|
||||
insta::assert_ron_snapshot!(format!("map_music_details_{}", name), map_res.c);
|
||||
insta::assert_ron_snapshot!(format!("map_music_details_{name}"), map_res.c);
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
#[case::mv("mv", "RDAMVMZeerrnuLi5E")]
|
||||
#[case::track("track", "RDAMVM7nigXQS1Xb0")]
|
||||
fn map_music_radio(#[case] name: &str, #[case] id: &str) {
|
||||
let json_path = path!("testfiles" / "music_details" / format!("radio_{}.json", name));
|
||||
let json_path = path!("testfiles" / "music_details" / format!("radio_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let radio: response::MusicDetails =
|
||||
|
|
@ -434,7 +434,7 @@ mod tests {
|
|||
"deserialization/mapping warnings: {:?}",
|
||||
map_res.warnings
|
||||
);
|
||||
insta::assert_ron_snapshot!(format!("map_music_radio_{}", name), map_res.c);
|
||||
insta::assert_ron_snapshot!(format!("map_music_radio_{name}"), map_res.c);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ mod tests {
|
|||
#[case::default("default", "ggMPOg1uX1lMbVZmbzl6NlJ3")]
|
||||
#[case::mood("mood", "ggMPOg1uX1JOQWZFeDByc2Jm")]
|
||||
fn map_music_genre(#[case] name: &str, #[case] id: &str) {
|
||||
let json_path = path!("testfiles" / "music_genres" / format!("genre_{}.json", name));
|
||||
let json_path = path!("testfiles" / "music_genres" / format!("genre_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let playlist: response::MusicGenre =
|
||||
|
|
@ -249,6 +249,6 @@ mod tests {
|
|||
"deserialization/mapping warnings: {:?}",
|
||||
map_res.warnings
|
||||
);
|
||||
insta::assert_ron_snapshot!(format!("map_music_genre_{}", name), map_res.c);
|
||||
insta::assert_ron_snapshot!(format!("map_music_genre_{name}"), map_res.c);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ mod tests {
|
|||
#[rstest]
|
||||
#[case::default("default")]
|
||||
fn map_music_new_albums(#[case] name: &str) {
|
||||
let json_path = path!("testfiles" / "music_new" / format!("albums_{}.json", name));
|
||||
let json_path = path!("testfiles" / "music_new" / format!("albums_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let new_albums: response::MusicNew =
|
||||
|
|
@ -103,13 +103,13 @@ mod tests {
|
|||
"deserialization/mapping warnings: {:?}",
|
||||
map_res.warnings
|
||||
);
|
||||
insta::assert_ron_snapshot!(format!("map_music_new_albums_{}", name), map_res.c);
|
||||
insta::assert_ron_snapshot!(format!("map_music_new_albums_{name}"), map_res.c);
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
#[case::default("default")]
|
||||
fn map_music_new_videos(#[case] name: &str) {
|
||||
let json_path = path!("testfiles" / "music_new" / format!("videos_{}.json", name));
|
||||
let json_path = path!("testfiles" / "music_new" / format!("videos_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let new_albums: response::MusicNew =
|
||||
|
|
@ -122,6 +122,6 @@ mod tests {
|
|||
"deserialization/mapping warnings: {:?}",
|
||||
map_res.warnings
|
||||
);
|
||||
insta::assert_ron_snapshot!(format!("map_music_new_videos_{}", name), map_res.c);
|
||||
insta::assert_ron_snapshot!(format!("map_music_new_videos_{name}"), map_res.c);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ impl RustyPipeQuery {
|
|||
let context = self.get_context(ClientType::DesktopMusic, true, None).await;
|
||||
let request_body = QBrowse {
|
||||
context,
|
||||
browse_id: &format!("VL{}", playlist_id),
|
||||
browse_id: &format!("VL{playlist_id}"),
|
||||
};
|
||||
|
||||
self.execute_request::<response::MusicPlaylist, _, _>(
|
||||
|
|
@ -129,8 +129,7 @@ impl MapResponse<MusicPlaylist> for response::MusicPlaylist {
|
|||
if let Some(playlist_id) = shelf.playlist_id {
|
||||
if playlist_id != id {
|
||||
return Err(ExtractionError::WrongResult(format!(
|
||||
"got wrong playlist id {}, expected {}",
|
||||
playlist_id, id
|
||||
"got wrong playlist id {playlist_id}, expected {id}"
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
|
@ -384,7 +383,7 @@ mod tests {
|
|||
#[case::long("long", "PL5dDx681T4bR7ZF1IuWzOv1omlRbE7PiJ")]
|
||||
#[case::nomusic("nomusic", "PL1J-6JOckZtE_P9Xx8D3b2O6w0idhuKBe")]
|
||||
fn map_music_playlist(#[case] name: &str, #[case] id: &str) {
|
||||
let json_path = path!("testfiles" / "music_playlist" / format!("playlist_{}.json", name));
|
||||
let json_path = path!("testfiles" / "music_playlist" / format!("playlist_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let playlist: response::MusicPlaylist =
|
||||
|
|
@ -397,7 +396,7 @@ mod tests {
|
|||
"deserialization/mapping warnings: {:?}",
|
||||
map_res.warnings
|
||||
);
|
||||
insta::assert_ron_snapshot!(format!("map_music_playlist_{}", name), map_res.c, {
|
||||
insta::assert_ron_snapshot!(format!("map_music_playlist_{name}"), map_res.c, {
|
||||
".last_update" => "[date]"
|
||||
});
|
||||
}
|
||||
|
|
@ -409,7 +408,7 @@ mod tests {
|
|||
#[case::description("description", "MPREb_PiyfuVl6aYd")]
|
||||
#[case::unavailable("unavailable", "MPREb_AzuWg8qAVVl")]
|
||||
fn map_music_album(#[case] name: &str, #[case] id: &str) {
|
||||
let json_path = path!("testfiles" / "music_playlist" / format!("album_{}.json", name));
|
||||
let json_path = path!("testfiles" / "music_playlist" / format!("album_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let playlist: response::MusicPlaylist =
|
||||
|
|
@ -422,6 +421,6 @@ mod tests {
|
|||
"deserialization/mapping warnings: {:?}",
|
||||
map_res.warnings
|
||||
);
|
||||
insta::assert_ron_snapshot!(format!("map_music_album_{}", name), map_res.c);
|
||||
insta::assert_ron_snapshot!(format!("map_music_album_{name}"), map_res.c);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ mod tests {
|
|||
#[case::typo("typo")]
|
||||
#[case::radio("radio")]
|
||||
fn map_music_search_main(#[case] name: &str) {
|
||||
let json_path = path!("testfiles" / "music_search" / format!("main_{}.json", name));
|
||||
let json_path = path!("testfiles" / "music_search" / format!("main_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let search: response::MusicSearch =
|
||||
|
|
@ -405,7 +405,7 @@ mod tests {
|
|||
map_res.warnings
|
||||
);
|
||||
|
||||
insta::assert_ron_snapshot!(format!("map_music_search_main_{}", name), map_res.c);
|
||||
insta::assert_ron_snapshot!(format!("map_music_search_main_{name}"), map_res.c);
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
|
|
@ -414,7 +414,7 @@ mod tests {
|
|||
#[case::videos("videos")]
|
||||
#[case::no_artist_link("no_artist_link")]
|
||||
fn map_music_search_tracks(#[case] name: &str) {
|
||||
let json_path = path!("testfiles" / "music_search" / format!("tracks_{}.json", name));
|
||||
let json_path = path!("testfiles" / "music_search" / format!("tracks_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let search: response::MusicSearch =
|
||||
|
|
@ -428,7 +428,7 @@ mod tests {
|
|||
map_res.warnings
|
||||
);
|
||||
|
||||
insta::assert_ron_snapshot!(format!("map_music_search_tracks_{}", name), map_res.c);
|
||||
insta::assert_ron_snapshot!(format!("map_music_search_tracks_{name}"), map_res.c);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -473,7 +473,7 @@ mod tests {
|
|||
#[case::ytm("ytm")]
|
||||
#[case::community("community")]
|
||||
fn map_music_search_playlists(#[case] name: &str) {
|
||||
let json_path = path!("testfiles" / "music_search" / format!("playlists_{}.json", name));
|
||||
let json_path = path!("testfiles" / "music_search" / format!("playlists_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let search: response::MusicSearch =
|
||||
|
|
@ -487,14 +487,14 @@ mod tests {
|
|||
map_res.warnings
|
||||
);
|
||||
|
||||
insta::assert_ron_snapshot!(format!("map_music_search_playlists_{}", name), map_res.c);
|
||||
insta::assert_ron_snapshot!(format!("map_music_search_playlists_{name}"), map_res.c);
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
#[case::default("default")]
|
||||
#[case::empty("empty")]
|
||||
fn map_music_search_suggestion(#[case] name: &str) {
|
||||
let json_path = path!("testfiles" / "music_search" / format!("suggestion_{}.json", name));
|
||||
let json_path = path!("testfiles" / "music_search" / format!("suggestion_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let suggestion: response::MusicSearchSuggestion =
|
||||
|
|
@ -508,6 +508,6 @@ mod tests {
|
|||
map_res.warnings
|
||||
);
|
||||
|
||||
insta::assert_ron_snapshot!(format!("map_music_search_suggestion_{}", name), map_res.c);
|
||||
insta::assert_ron_snapshot!(format!("map_music_search_suggestion_{name}"), map_res.c);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ mod tests {
|
|||
"deserialization/mapping warnings: {:?}",
|
||||
map_res.warnings
|
||||
);
|
||||
insta::assert_ron_snapshot!(format!("map_{}", name), map_res.c, {
|
||||
insta::assert_ron_snapshot!(format!("map_{name}"), map_res.c, {
|
||||
".items.*.publish_date" => "[date]",
|
||||
});
|
||||
}
|
||||
|
|
@ -385,7 +385,7 @@ mod tests {
|
|||
"deserialization/mapping warnings: {:?}",
|
||||
map_res.warnings
|
||||
);
|
||||
insta::assert_ron_snapshot!(format!("map_{}", name), paginator);
|
||||
insta::assert_ron_snapshot!(format!("map_{name}"), paginator);
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
|
|
@ -408,7 +408,7 @@ mod tests {
|
|||
"deserialization/mapping warnings: {:?}",
|
||||
map_res.warnings
|
||||
);
|
||||
insta::assert_ron_snapshot!(format!("map_{}", name), paginator);
|
||||
insta::assert_ron_snapshot!(format!("map_{name}"), paginator);
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
|
|
@ -429,6 +429,6 @@ mod tests {
|
|||
"deserialization/mapping warnings: {:?}",
|
||||
map_res.warnings
|
||||
);
|
||||
insta::assert_ron_snapshot!(format!("map_{}", name), paginator);
|
||||
insta::assert_ron_snapshot!(format!("map_{name}"), paginator);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ impl RustyPipeQuery {
|
|||
playback_context: Some(QPlaybackContext {
|
||||
content_playback_context: QContentPlaybackContext {
|
||||
signature_timestamp: deobf.get_sts(),
|
||||
referer: format!("https://www.youtube.com/watch?v={}", video_id),
|
||||
referer: format!("https://www.youtube.com/watch?v={video_id}"),
|
||||
},
|
||||
}),
|
||||
cpn: None,
|
||||
|
|
@ -374,7 +374,7 @@ fn map_url(
|
|||
util::url_to_params(url),
|
||||
MapResult {
|
||||
c: None,
|
||||
warnings: vec![format!("Could not parse url `{}`", url)]
|
||||
warnings: vec![format!("Could not parse url `{url}`")]
|
||||
}
|
||||
),
|
||||
None => match signature_cipher {
|
||||
|
|
@ -384,8 +384,7 @@ fn map_url(
|
|||
return MapResult {
|
||||
c: None,
|
||||
warnings: vec![format!(
|
||||
"Could not deobfuscate signatureCipher `{}`: {}",
|
||||
signature_cipher, e
|
||||
"Could not deobfuscate signatureCipher `{signature_cipher}`: {e}"
|
||||
)],
|
||||
};
|
||||
}
|
||||
|
|
@ -403,8 +402,7 @@ fn map_url(
|
|||
let mut throttled = false;
|
||||
deobf_nsig(&mut url_params, deobf, last_nsig).unwrap_or_else(|e| {
|
||||
warnings.push(format!(
|
||||
"Could not deobfuscate nsig (params: {:?}): {}",
|
||||
url_params, e
|
||||
"Could not deobfuscate nsig (params: {url_params:?}): {e}"
|
||||
));
|
||||
throttled = true;
|
||||
});
|
||||
|
|
@ -416,8 +414,7 @@ fn map_url(
|
|||
MapResult {
|
||||
c: None,
|
||||
warnings: vec![format!(
|
||||
"url could not be joined. url: `{}` params: {:?}",
|
||||
url_base, url_params
|
||||
"url could not be joined. url: `{url_base}` params: {url_params:?}"
|
||||
)],
|
||||
}
|
||||
)
|
||||
|
|
@ -636,7 +633,7 @@ mod tests {
|
|||
#[case::android("android")]
|
||||
#[case::ios("ios")]
|
||||
fn map_player_data(#[case] name: &str) {
|
||||
let json_path = path!("testfiles" / "player" / format!("{}_video.json", name));
|
||||
let json_path = path!("testfiles" / "player" / format!("{name}_video.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let resp: response::Player = serde_json::from_reader(BufReader::new(json_file)).unwrap();
|
||||
|
|
@ -650,7 +647,7 @@ mod tests {
|
|||
map_res.warnings
|
||||
);
|
||||
let is_desktop = name == "desktop" || name == "desktopmusic";
|
||||
insta::assert_ron_snapshot!(format!("map_player_data_{}", name), map_res.c, {
|
||||
insta::assert_ron_snapshot!(format!("map_player_data_{name}"), map_res.c, {
|
||||
".details.publish_date" => insta::dynamic_redaction(move |value, _path| {
|
||||
if is_desktop {
|
||||
assert!(value.as_str().unwrap().starts_with("2019-05-30T00:00:00"));
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ impl RustyPipeQuery {
|
|||
let context = self.get_context(ClientType::Desktop, true, None).await;
|
||||
let request_body = QBrowse {
|
||||
context,
|
||||
browse_id: &format!("VL{}", playlist_id),
|
||||
browse_id: &format!("VL{playlist_id}"),
|
||||
};
|
||||
|
||||
self.execute_request::<response::Playlist, _, _>(
|
||||
|
|
@ -145,8 +145,7 @@ impl MapResponse<Playlist> for response::Playlist {
|
|||
let playlist_id = header.playlist_header_renderer.playlist_id;
|
||||
if playlist_id != id {
|
||||
return Err(ExtractionError::WrongResult(format!(
|
||||
"got wrong playlist id {}, expected {}",
|
||||
playlist_id, id
|
||||
"got wrong playlist id {playlist_id}, expected {id}"
|
||||
)));
|
||||
}
|
||||
|
||||
|
|
@ -243,7 +242,7 @@ mod tests {
|
|||
#[case::long("long", "PL5dDx681T4bR7ZF1IuWzOv1omlRbE7PiJ")]
|
||||
#[case::nomusic("nomusic", "PL1J-6JOckZtE_P9Xx8D3b2O6w0idhuKBe")]
|
||||
fn map_playlist_data(#[case] name: &str, #[case] id: &str) {
|
||||
let json_path = path!("testfiles" / "playlist" / format!("playlist_{}.json", name));
|
||||
let json_path = path!("testfiles" / "playlist" / format!("playlist_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let playlist: response::Playlist =
|
||||
|
|
@ -255,7 +254,7 @@ mod tests {
|
|||
"deserialization/mapping warnings: {:?}",
|
||||
map_res.warnings
|
||||
);
|
||||
insta::assert_ron_snapshot!(format!("map_playlist_data_{}", name), map_res.c, {
|
||||
insta::assert_ron_snapshot!(format!("map_playlist_data_{name}"), map_res.c, {
|
||||
".last_update" => "[date]"
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -533,7 +533,7 @@ impl MusicListMapper {
|
|||
// Track
|
||||
Some((MusicPageType::Track { is_video }, id)) => {
|
||||
let title =
|
||||
title.ok_or_else(|| format!("track {}: could not get title", id))?;
|
||||
title.ok_or_else(|| format!("track {id}: could not get title"))?;
|
||||
|
||||
let (artists_p, album_p, duration_p) = match item.flex_column_display_style
|
||||
{
|
||||
|
|
@ -549,7 +549,7 @@ impl MusicListMapper {
|
|||
} else {
|
||||
let mut subtitle_parts = c2
|
||||
.ok_or_else(|| {
|
||||
format!("track {}: could not get subtitle", id)
|
||||
format!("track {id}: could not get subtitle")
|
||||
})?
|
||||
.renderer
|
||||
.text
|
||||
|
|
@ -649,7 +649,7 @@ impl MusicListMapper {
|
|||
.into_iter();
|
||||
|
||||
let title =
|
||||
title.ok_or_else(|| format!("track {}: could not get title", id))?;
|
||||
title.ok_or_else(|| format!("track {id}: could not get title"))?;
|
||||
|
||||
let subtitle_p1 = subtitle_parts.next();
|
||||
let subtitle_p2 = subtitle_parts.next();
|
||||
|
|
@ -812,8 +812,7 @@ impl MusicListMapper {
|
|||
}
|
||||
_ => {
|
||||
return Err(format!(
|
||||
"could not parse subtitle of album {}",
|
||||
id
|
||||
"could not parse subtitle of album {id}"
|
||||
));
|
||||
}
|
||||
};
|
||||
|
|
@ -1057,7 +1056,7 @@ mod tests {
|
|||
atype_samples.iter().for_each(|(lang, entry)| {
|
||||
entry.iter().for_each(|(album_type, txt)| {
|
||||
let res = map_album_type(txt, *lang);
|
||||
assert_eq!(res, *album_type, "lang: {}, txt: {}", lang, txt);
|
||||
assert_eq!(res, *album_type, "lang: {lang}, txt: {txt}");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ mod tests {
|
|||
#[case::empty("empty")]
|
||||
#[case::ab3_channel_handles("20221121_AB3_channel_handles")]
|
||||
fn t_map_search(#[case] name: &str) {
|
||||
let json_path = path!("testfiles" / "search" / format!("{}.json", name));
|
||||
let json_path = path!("testfiles" / "search" / format!("{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let search: response::Search = serde_json::from_reader(BufReader::new(json_file)).unwrap();
|
||||
|
|
@ -159,7 +159,7 @@ mod tests {
|
|||
map_res.warnings
|
||||
);
|
||||
|
||||
insta::assert_ron_snapshot!(format!("map_search_{}", name), map_res.c, {
|
||||
insta::assert_ron_snapshot!(format!("map_search_{name}"), map_res.c, {
|
||||
".items.items.*.publish_date" => "[date]",
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ impl RustyPipeQuery {
|
|||
// YouTube Music album has to be resolved by the YTM API
|
||||
if resolve_albums && id.starts_with(util::PLAYLIST_ID_ALBUM_PREFIX) {
|
||||
self._navigation_resolve_url(
|
||||
&format!("/playlist?list={}", id),
|
||||
&format!("/playlist?list={id}"),
|
||||
ClientType::DesktopMusic,
|
||||
)
|
||||
.await
|
||||
|
|
@ -225,7 +225,7 @@ impl RustyPipeQuery {
|
|||
}
|
||||
// URL without protocol
|
||||
else if string.contains('/') && string.contains('.') {
|
||||
self.resolve_url(&format!("https://{}", string), resolve_albums)
|
||||
self.resolve_url(&format!("https://{string}"), resolve_albums)
|
||||
.await
|
||||
}
|
||||
// ID only
|
||||
|
|
@ -241,7 +241,7 @@ impl RustyPipeQuery {
|
|||
} else if util::PLAYLIST_ID_REGEX.is_match(string) {
|
||||
if resolve_albums && string.starts_with(util::PLAYLIST_ID_ALBUM_PREFIX) {
|
||||
self._navigation_resolve_url(
|
||||
&format!("/playlist?list={}", string),
|
||||
&format!("/playlist?list={string}"),
|
||||
ClientType::DesktopMusic,
|
||||
)
|
||||
.await
|
||||
|
|
|
|||
|
|
@ -100,8 +100,7 @@ impl MapResponse<VideoDetails> for response::VideoDetails {
|
|||
let video_id = current_video_endpoint.watch_endpoint.video_id;
|
||||
if id != video_id {
|
||||
return Err(ExtractionError::WrongResult(format!(
|
||||
"got wrong playlist id {}, expected {}",
|
||||
video_id, id
|
||||
"got wrong playlist id {video_id}, expected {id}"
|
||||
)));
|
||||
}
|
||||
|
||||
|
|
@ -555,8 +554,7 @@ mod tests {
|
|||
#[case::new_cont("20221011_new_continuation", "ZeerrnuLi5E")]
|
||||
#[case::no_recommends("20221011_rec_isr", "nFDBxBUfE74")]
|
||||
fn map_video_details(#[case] name: &str, #[case] id: &str) {
|
||||
let json_path =
|
||||
path!("testfiles" / "video_details" / format!("video_details_{}.json", name));
|
||||
let json_path = path!("testfiles" / "video_details" / format!("video_details_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let details: response::VideoDetails =
|
||||
|
|
@ -568,7 +566,7 @@ mod tests {
|
|||
"deserialization/mapping warnings: {:?}",
|
||||
map_res.warnings
|
||||
);
|
||||
insta::assert_ron_snapshot!(format!("map_video_details_{}", name), map_res.c, {
|
||||
insta::assert_ron_snapshot!(format!("map_video_details_{name}"), map_res.c, {
|
||||
".publish_date" => "[date]",
|
||||
".recommended.items[].publish_date" => "[date]",
|
||||
});
|
||||
|
|
@ -592,7 +590,7 @@ mod tests {
|
|||
#[case::top("top")]
|
||||
#[case::latest("latest")]
|
||||
fn map_comments(#[case] name: &str) {
|
||||
let json_path = path!("testfiles" / "video_details" / format!("comments_{}.json", name));
|
||||
let json_path = path!("testfiles" / "video_details" / format!("comments_{name}.json"));
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
|
||||
let comments: response::VideoComments =
|
||||
|
|
@ -604,7 +602,7 @@ mod tests {
|
|||
"deserialization/mapping warnings: {:?}",
|
||||
map_res.warnings
|
||||
);
|
||||
insta::assert_ron_snapshot!(format!("map_comments_{}", name), map_res.c, {
|
||||
insta::assert_ron_snapshot!(format!("map_comments_{name}"), map_res.c, {
|
||||
".items[].publish_date" => "[date]",
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue