1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-30 15:14:14 +01:00

viaplay: error handling when xml filename is f4m file

This commit is contained in:
Johan Andersson 2014-06-26 22:04:16 +02:00
parent eb762b8084
commit 9a7378f32d

View File

@ -40,6 +40,9 @@ class Viaplay(Service, OpenGraphThumbMixin):
"""
html_data = self.get_urldata()
match = re.search(r'data-video-id="([0-9]+)"', html_data)
if match:
return match.group(1)
match = re.search(r'data-videoid="([0-9]+)', html_data)
if match:
return match.group(1)
@ -70,18 +73,21 @@ class Viaplay(Service, OpenGraphThumbMixin):
#Fulhack.. expose error code from get_http_data.
filename = xml.find("Product").find("Videos").find("Video").find("Url").text
if filename[len(filename)-3:] == "f4m":
filename = "%s?hdcore=2.8.0&g=hejsan" % filename
filedata = get_http_data(filename)
geoxml = ET.XML(filedata)
success = geoxml.find("Success").text
if success == "false":
if geoxml.find("Success") and geoxml.find("Success").text == "false":
log.error("Can't download file:")
log.error(xml.find("Msg").text)
sys.exit(2)
streams = get_http_data("http://playapi.mtgx.tv/v1/videos/stream/%s" % vid)
streamj = json.loads(streams)
print streamj
if streamj["streams"]["medium"]:
filename = streamj["streams"]["medium"]
print filename
if filename[len(filename)-3:] == "f4m":
#fulhack. RTMP need live to be set
if xml.find("Product").find("Syndicate").text == "true":