Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with the script given in description #22

Open
lachhebo opened this issue Apr 17, 2020 · 0 comments
Open

Error with the script given in description #22

lachhebo opened this issue Apr 17, 2020 · 0 comments

Comments

@lachhebo
Copy link

When :

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 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant