Skip to content

Commit

Permalink
fix: genius scrapper lyrics container div
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas committed Feb 11, 2025
1 parent 3fe4828 commit 9a17ad9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions spotdl/providers/lyrics/genius.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,15 @@ def extract_lyrics(self, url: str, **_) -> Optional[str]:

lyrics_div = soup.select_one("div.lyrics")
lyrics_containers = soup.select("div[class^=Lyrics__Container]")
lyrics_container = soup.find("div", {"data-lyrics-container": "true"})

# Get lyrics
if lyrics_div:
lyrics = lyrics_div.get_text()
elif lyrics_containers:
lyrics = "\n".join(con.get_text() for con in lyrics_containers)
elif lyrics_container:
lyrics = lyrics_container.get_text("\n")
else:
return None

Expand Down

0 comments on commit 9a17ad9

Please sign in to comment.