From 76aa97827dbab08d636d3b027da641bbaa1cbb5e Mon Sep 17 00:00:00 2001 From: wisp3rwind <17089248+wisp3rwind@users.noreply.github.com> Date: Tue, 15 Jun 2021 10:10:22 +0200 Subject: [PATCH] lyrics: rename html -> soup for consistency --- beetsplug/lyrics.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/beetsplug/lyrics.py b/beetsplug/lyrics.py index f0290f74a..83b43ff22 100644 --- a/beetsplug/lyrics.py +++ b/beetsplug/lyrics.py @@ -373,22 +373,22 @@ class Genius(Backend): def _scrape_lyrics_from_html(self, html): """Scrape lyrics from a given genius.com html""" - html = BeautifulSoup(html, "html.parser") + soup = BeautifulSoup(html, "html.parser") # Remove script tags that they put in the middle of the lyrics. - [h.extract() for h in html('script')] + [h.extract() for h in soup('script')] # Most of the time, the page contains a div with class="lyrics" where # all of the lyrics can be found already correctly formatted # Sometimes, though, it packages the lyrics into separate divs, most # likely for easier ad placement - lyrics_div = html.find("div", class_="lyrics") + lyrics_div = soup.find("div", class_="lyrics") if not lyrics_div: self._log.debug(u'Received unusual song page html') - verse_div = html.find("div", + verse_div = soup.find("div", class_=re.compile("Lyrics__Container")) if not verse_div: - if html.find("div", + if soup.find("div", class_=re.compile("LyricsPlaceholder__Message"), string="This song is an instrumental"): self._log.debug('Detected instrumental') @@ -433,11 +433,11 @@ class Tekstowo(Backend): html = _scrape_merge_paragraphs(html) try: - html = BeautifulSoup(html, "html.parser") + soup = BeautifulSoup(html, "html.parser") except HTMLParseError: return None - song_rows = html.find("div", class_="content"). \ + song_rows = soup.find("div", class_="content"). \ find("div", class_="card"). \ find_all("div", class_="box-przeboje") @@ -457,11 +457,11 @@ class Tekstowo(Backend): html = _scrape_merge_paragraphs(html) try: - html = BeautifulSoup(html, "html.parser") + soup = BeautifulSoup(html, "html.parser") except HTMLParseError: return None - return html.find("div", class_="song-text").get_text() + return soup.find("div", class_="song-text").get_text() def remove_credits(text):