Merge pull request #654 from ritiek/fix-genius-lyric-crash

Fix crash when lyrics not yet released on Genius
This commit is contained in:
Ritiek Malhotra
2020-01-10 02:17:40 -08:00
committed by GitHub
2 changed files with 6 additions and 2 deletions

View File

@@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
### Fixed
- Fixed a crash occuring when lyrics for a track are not yet released
on Genius ([@ritiek](https://github.com/ritiek)) (#654)
- Fixed a regression where a track would fail to download if it isn't
found on Spotify ([@ritiek](https://github.com/ritiek)) (#653)

View File

@@ -37,8 +37,10 @@ class Genius(LyricBase):
def _get_lyrics_text(self, html):
soup = BeautifulSoup(html, "html.parser")
lyrics_paragraph = soup.find("p")
lyrics = lyrics_paragraph.get_text()
return lyrics
if lyrics_paragraph:
return lyrics_paragraph.get_text()
else:
raise LyricsNotFound("The lyrics for this track are yet to be released.")
def get_lyrics(self, linesep="\n", timeout=None):
url = self._guess_lyric_url()