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

solittango: dont crash when the xml data is unicode on py2

This commit is contained in:
Johan Andersson 2017-08-01 19:34:53 +02:00
parent 45266f6a2a
commit 2a70b72938

View File

@ -8,6 +8,7 @@ from svtplay_dl.service import Service
from svtplay_dl.fetcher.hls import hlsparse
from svtplay_dl.error import ServiceError
from svtplay_dl.utils.urllib import urlparse
from svtplay_dl.utils import is_py2
class Solidtango(Service):
@ -53,7 +54,10 @@ class Solidtango(Service):
if data.status_code != 200:
yield ServiceError("Can't find video info. if there is a video on the page. its a bug.")
return
xml = ET.XML(data.text)
xmldoc = data.text
if is_py2 and isinstance(xmldoc, unicode):
xmldoc = xmldoc.encode("utf8")
xml = ET.XML(xmldoc)
elements = xml.findall(".//manifest")
streams = hlsparse(self.options, self.http.request("get", elements[0].text), elements[0].text)
for n in list(streams.keys()):