mirror of
https://github.com/beetbox/beets.git
synced 2026-01-15 20:51:38 +01:00
return no lyrics when HtmlParseError occured
This commit is contained in:
parent
546d17f52f
commit
a6f0649c40
1 changed files with 7 additions and 2 deletions
|
|
@ -23,6 +23,7 @@ import json
|
|||
import unicodedata
|
||||
import difflib
|
||||
import itertools
|
||||
from HTMLParser import HTMLParseError
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets import ui
|
||||
|
|
@ -365,8 +366,12 @@ def scrape_lyrics_from_html(html):
|
|||
html = _scrape_merge_paragraphs(html)
|
||||
|
||||
# extract all long text blocks that are not code
|
||||
soup = BeautifulSoup(html, "html.parser",
|
||||
parse_only=SoupStrainer(text=is_text_notcode))
|
||||
try:
|
||||
soup = BeautifulSoup(html, "html.parser",
|
||||
parse_only=SoupStrainer(text=is_text_notcode))
|
||||
except HTMLParseError:
|
||||
return None
|
||||
|
||||
soup = sorted(soup.stripped_strings, key=len)[-1]
|
||||
|
||||
return soup
|
||||
|
|
|
|||
Loading…
Reference in a new issue