diff --git a/music_kraken/pages/genius.py b/music_kraken/pages/genius.py index f37715b..15f1ac2 100644 --- a/music_kraken/pages/genius.py +++ b/music_kraken/pages/genius.py @@ -182,7 +182,7 @@ class Genius(Page): return results def fetch_artist(self, source: Source, stop_at_level: int = 1) -> Artist: - artist = Artist() + artist: Artist = Artist() # https://genius.com/api/artists/24527/albums?page=1 r = self.connection.get(source.url, name=source.url) @@ -200,7 +200,26 @@ class Genius(Page): artist = self.parse_api_object(data.get("artist", {})) for e in data.get("artist_albums", []): - artist.album_collection.append(self.parse_api_object(e)) + r = self.parse_api_object(e) + if not isinstance(r, Album): + continue + + artist.album_collection.append(r) + + for e in data.get("artist_songs", []): + r = self.parse_api_object(e) + if not isinstance(r, Song): + continue + + """ + TODO + fetch the album for these songs, because the api doesn't + return them + """ + + artist.album_collection.extend(r.album_collection) + + artist.source_collection.append(source) return artist