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

disney: better automagic filename

this fixes #148
This commit is contained in:
Johan Andersson 2014-11-23 13:03:23 +01:00
parent d836c438b1
commit 76e6921771

View File

@ -5,9 +5,10 @@ from __future__ import absolute_import
import json import json
import re import re
import copy import copy
import os
from svtplay_dl.service import Service, OpenGraphThumbMixin from svtplay_dl.service import Service, OpenGraphThumbMixin
from svtplay_dl.utils import get_http_data, check_redirect from svtplay_dl.utils import get_http_data, check_redirect, filenamify
from svtplay_dl.utils.urllib import urlparse from svtplay_dl.utils.urllib import urlparse
from svtplay_dl.fetcher.hls import HLS, hlsparse from svtplay_dl.fetcher.hls import HLS, hlsparse
from svtplay_dl.fetcher.http import HTTP from svtplay_dl.fetcher.http import HTTP
@ -54,6 +55,16 @@ class Disney(Service, OpenGraphThumbMixin):
match = re.search(r"window.kalturaIframePackageData = ({.*});", data) match = re.search(r"window.kalturaIframePackageData = ({.*});", data)
jsondata = json.loads(match.group(1)) jsondata = json.loads(match.group(1))
ks = jsondata["enviornmentConfig"]["ks"] ks = jsondata["enviornmentConfig"]["ks"]
if options.output_auto:
name = jsondata["entryResult"]["meta"]["name"]
directory = os.path.dirname(options.output)
options.service = "disney"
title = "%s-%s" % (name, options.service)
title = filenamify(title)
if len(directory):
options.output = "%s/%s" % (directory, title)
else:
options.output = title
url = "http://cdnapi.kaltura.com/p/%s/sp/%s00/playManifest/entryId/%s/format/applehttp/protocol/http/a.m3u8?ks=%s&referrer=aHR0cDovL3d3dy5kaXNuZXkuc2U=&" % (partnerid[1:], partnerid[1:], entryid, ks) url = "http://cdnapi.kaltura.com/p/%s/sp/%s00/playManifest/entryId/%s/format/applehttp/protocol/http/a.m3u8?ks=%s&referrer=aHR0cDovL3d3dy5kaXNuZXkuc2U=&" % (partnerid[1:], partnerid[1:], entryid, ks)
redirect = check_redirect(url) redirect = check_redirect(url)