Skip to content

Commit

Permalink
lyrics: resolve   entity
Browse files Browse the repository at this point in the history
  • Loading branch information
sampsyo committed Mar 10, 2012
1 parent 5befad8 commit c65b237
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions beetsplug/lyrics.py
Expand Up @@ -31,11 +31,13 @@
BREAK_RE = re.compile(r'<br\s*/?>')

def unescape(text):
"""Resolves &#xxx; HTML entities."""
"""Resolves &#xxx; HTML entities (and some others)."""
out = text.replace('&nbsp;', ' ')
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
Expand Down

0 comments on commit c65b237

Please sign in to comment.