1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +01:00

sami: dont crash on &

this fixes #396
This commit is contained in:
Johan Andersson 2016-06-01 22:43:39 +02:00
parent b298e823eb
commit c0b4d278b4

View File

@ -104,7 +104,11 @@ class subtitle(object):
return subs
def sami(self, subdata):
tree = ET.XML(subdata.text.encode("utf8"))
text = subdata.text
if is_py2:
text = text.encode("utf8")
text = re.sub(r'&', '&', text)
tree = ET.fromstring(text)
subt = tree.find("Font")
subs = ""
n = 0
@ -122,6 +126,7 @@ class subtitle(object):
if is_py2:
subs = subs.encode('utf8')
subs = re.sub('&', r'&', subs)
return subs
def smi(self, subdata):