1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +01:00

subtitle: use decode_html_entities function

use decode_html_entities to decode html entities
This commit is contained in:
qnorsten 2017-03-22 23:22:57 +01:00
parent a310ceb2a1
commit a9e1e92ba2

View File

@ -171,7 +171,8 @@ class subtitle(object):
if int(sync.group(1)) != int(timea):
if data and data != " ":
subs += "%s\n%s --> %s\n" % (number, timestr(timea), timestr(sync.group(1)))
text = "%s\n" % TAG_RE.sub('', data.replace("<br>", "\n").replace("&nbsp;"," "))
text = "%s\n" % TAG_RE.sub('', data.replace("<br>", "\n"))
text = decode_html_entities(text)
if text[len(text)-2] != "\n":
text += "\n"
subs += text
@ -181,7 +182,7 @@ class subtitle(object):
if text:
data = text.group(1)
recomp = re.compile(r'\r')
text = bad_char.sub('-', recomp.sub('', subs)).replace('&quot;', '"')
text = bad_char.sub('-', recomp.sub('', subs))
if is_py2 and isinstance(text, unicode):
return text.encode("utf-8")
return text