mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 21:14:19 +01:00
lyrics: Tolerate pages without text (fix #1914)
This commit is contained in:
parent
c9be5bc7d1
commit
f684f29a25
1 changed files with 7 additions and 2 deletions
|
|
@ -430,8 +430,13 @@ def scrape_lyrics_from_html(html):
|
|||
parse_only=SoupStrainer(text=is_text_notcode))
|
||||
except HTMLParseError:
|
||||
return None
|
||||
soup = sorted(soup.stripped_strings, key=len)[-1]
|
||||
return soup
|
||||
|
||||
# Get the longest text element (if any).
|
||||
strings = sorted(soup.stripped_strings, key=len, reverse=True)
|
||||
if strings:
|
||||
return strings[0]
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
class Google(Backend):
|
||||
|
|
|
|||
Loading…
Reference in a new issue