mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-12-29 21:31:23 +00:00
Merge pull request #654 from ritiek/fix-genius-lyric-crash
Fix crash when lyrics not yet released on Genius
This commit is contained in:
@@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Fixed
|
### 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
|
- Fixed a regression where a track would fail to download if it isn't
|
||||||
found on Spotify ([@ritiek](https://github.com/ritiek)) (#653)
|
found on Spotify ([@ritiek](https://github.com/ritiek)) (#653)
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,10 @@ class Genius(LyricBase):
|
|||||||
def _get_lyrics_text(self, html):
|
def _get_lyrics_text(self, html):
|
||||||
soup = BeautifulSoup(html, "html.parser")
|
soup = BeautifulSoup(html, "html.parser")
|
||||||
lyrics_paragraph = soup.find("p")
|
lyrics_paragraph = soup.find("p")
|
||||||
lyrics = lyrics_paragraph.get_text()
|
if lyrics_paragraph:
|
||||||
return lyrics
|
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):
|
def get_lyrics(self, linesep="\n", timeout=None):
|
||||||
url = self._guess_lyric_url()
|
url = self._guess_lyric_url()
|
||||||
|
|||||||
Reference in New Issue
Block a user