added null check for genius lyrics scrape

This commit is contained in:
lijacky 2020-04-12 00:05:17 -04:00
parent 939bc269b8
commit 8e28f0b694

View file

@ -373,7 +373,13 @@ class Genius(Backend):
# At least Genius is nice and has a tag called 'lyrics'!
# Updated css where the lyrics are based in HTML.
lyrics = html.find("div", class_="lyrics").get_text()
try:
lyrics = html.find("div", class_="lyrics").get_text()
except AttributeError as exc:
# html is a NoneType cannot retrieve lyrics
self._log.debug(u'Genius lyrics for {0} not found: {1}',
page_url, exc)
return None
return lyrics