mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 13:07:09 +01:00
lyrics: resolve entity
This commit is contained in:
parent
5befad8ba0
commit
c65b237b99
1 changed files with 4 additions and 2 deletions
|
|
@ -31,11 +31,13 @@ TAG_RE = re.compile(r'<[^>]*>')
|
|||
BREAK_RE = re.compile(r'<br\s*/?>')
|
||||
|
||||
def unescape(text):
|
||||
"""Resolves &#xxx; HTML entities."""
|
||||
"""Resolves &#xxx; HTML entities (and some others)."""
|
||||
out = text.replace(' ', ' ')
|
||||
def replchar(m):
|
||||
num = m.group(1)
|
||||
return unichr(int(num))
|
||||
return re.sub("&#(\d+);", replchar, text)
|
||||
out = re.sub("&#(\d+);", replchar, out)
|
||||
return out
|
||||
|
||||
def extract_text(html, starttag):
|
||||
"""Extract the text from a <DIV> tag in the HTML starting with
|
||||
|
|
|
|||
Loading…
Reference in a new issue