johnwmillr / LyricsGenius

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

Add an item song.album #210

Open Mat314159 opened 3 years ago

Mat314159 commented 3 years ago

Hello, Thank you very much for your project ! I use it to download the lyrics of rap songs, and I coded a little program in python to organize te lyrics in folders (artist > album > all songs). I would like to access to the album name from a song. I think it was available in previous version. Can you explain me how to use a previous version, or better, add an item song.album ? Thank you for your help ! Matteo

allerter commented 3 years ago

The song.album attribute will be added back in the future. Nevertheless, you can always access what Genius sends in the response if you access the response dict. For example:

song = genius.search_song("Rap God", "Eminem", get_full_info=True)
song_dict = song.to_dict()
print(song_dict.keys())
print(song_dict["album"])

This is how you would get the album, but right now there is a bug that makes get_full_info become False and album won't be available. You can either clone #181 and use that or use any version below 3.0.0. If you want to use an earlier version:

pip uninstall lyricsgenius
pip install lyricsgenius==2.0.2

Note that only the latest version is supported and bugs in earlier versions won't be fixed.