From cc93e175d66909becd864fcfe07218a4412c19f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonah=20Br=C3=BCchert?= Date: Sun, 14 Jan 2024 20:10:17 +0100 Subject: [PATCH] Fix loading the "Systemabsturz" artist page --- src/example/main.cpp | 8 +++++++- src/ytmusic.cpp | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/example/main.cpp b/src/example/main.cpp index 555098a0..3fa1f5c2 100644 --- a/src/example/main.cpp +++ b/src/example/main.cpp @@ -8,7 +8,7 @@ int main() { const auto ytm = YTMusic(); - const auto results = ytm.search("y2ECgOhoDGs"); + const auto results = ytm.search("Systemabsturz"); std::cout << "Found " << results.size() << " results." << std::endl; @@ -55,6 +55,12 @@ int main() { if (playlist.lyrics) { ytm.get_lyrics(*playlist.lyrics); } + } else if (!arg.artists.empty()) { + for (const meta::Artist &artist : arg.artists) { + if (artist.id) { + ytm.get_artist(*artist.id); + } + } } } else { std::cout << "non exaustive visitor" << std::endl; diff --git a/src/ytmusic.cpp b/src/ytmusic.cpp index 0f33953c..d27029f6 100644 --- a/src/ytmusic.cpp +++ b/src/ytmusic.cpp @@ -205,6 +205,9 @@ playlist::Track extract_playlist_track(py::handle track) { } artist::Artist::Song::Album extract_song_album(py::handle album) { + if (album["id"].is_none()) { + return {}; + } return { album["name"].cast(), album["id"].cast()