johnwmillr / LyricsGenius

Download song lyrics and metadata from Genius.com 🎶🎤
http://www.johnwmillr.com/scraping-genius-lyrics/
MIT License
904 stars 159 forks source link

Search artist with include_features=True does not work #216

Open mg98 opened 3 years ago

mg98 commented 3 years ago

Whenever I pass the argument include_features=True to genius.search_artist, I get this error messages:

KeyError: 'featured_artists'
    result = artist.add_song(song, verbose=False,
  File "/usr/local/lib/python3.9/site-packages/lyricsgenius/types/artist.py", line 79, in add_song
    or (include_features and any(new_song._body['featured_artists']))):
KeyError: 'featured_artists'

I haven't worked with this lib before (love it so far!), but maybe this is due to a recent change on genius' side?

Version info

JaySCarter commented 3 years ago

I'm 100% the wrong person to develop a real solution but maybe the key that is producing the error ('featured_artists') should change to 'title_with_featured'. Below is a sample response from the API docs (https://docs.genius.com/#/authentication-h1) using the Try It button on the GET /artists/:id/songs section with this API call: artists/2/songs

{ annotation_count: 46, api_path: "/songs/80548", full_title: "3 Kings by Rick Ross (Ft. Dr. Dre & JAY-Z)", header_image_thumbnail_url: "https://images.genius.com/52547754f795d4ff94def40716ed3a2e.300x300x1.jpg", header_image_url: "https://images.genius.com/52547754f795d4ff94def40716ed3a2e.1000x1000x1.jpg", id: 80548, lyrics_owner_id: 11524, lyrics_state: "complete", path: "/Rick-ross-3-kings-lyrics", pyongs_count: 21, song_art_image_thumbnail_url: "https://images.genius.com/eab4da932239dc10cc5f63e1d22e77f9.300x300x1.jpg", song_art_image_url: "https://images.genius.com/eab4da932239dc10cc5f63e1d22e77f9.1000x1000x1.jpg", +stats: {...}, title: "3 Kings", title_with_featured: "3 Kings (Ft. Dr. Dre & JAY-Z)", url: "https://genius.com/Rick-ross-3-kings-lyrics", song_art_primary_color: "#f4b411", song_art_secondary_color: "#edd772", song_art_text_color: "#000", +primary_artist: {...} } ], next_page: 2