from PyLyrics import *
albums = PyLyrics.getAlbums(singer='Eminem')
myalbum = albums[4] #Select your album based on Index
tracks = myalbum.tracks() #or PyLyrics.getTracks(myalbum)
for track in tracks:
print (track) #Each track is a track object
print (track.getLyrics()) #Get the lyrics
Then :
soup = BeautifulSoup(requests.get(url).text)
Traceback (most recent call last):
File "crawler.py", line 31, in <module>
tracks = myalbum.tracks() #or PyLyrics.getTracks(myalbum)
File "/home/isma/.local/lib/python3.7/site-packages/PyLyrics/functions.py", line 38, in tracks
return PyLyrics.getTracks(self)
File "/home/isma/.local/lib/python3.7/site-packages/PyLyrics/functions.py", line 69, in getTracks
songs =[Track(song.text,album,album.artist()) for song in currentAlbum.findNext('songs').findAll('item')]
UnboundLocalError: local variable 'currentAlbum' referenced before assignment
➜ LyricsGenerator
When :
Then :