mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-24 04:05:39 +01:00
flake8 fixes
This commit is contained in:
parent
defa24b566
commit
5d1f86d8fc
@ -5,7 +5,6 @@ from __future__ import absolute_import, unicode_literals
|
||||
import sys
|
||||
import logging
|
||||
|
||||
from svtplay_dl.log import log
|
||||
from svtplay_dl.utils.parser import parser, mergeparseroption, Options
|
||||
from svtplay_dl.utils.getmedia import get_media, get_multiple_media
|
||||
|
||||
@ -13,7 +12,7 @@ from svtplay_dl.service.cmore import Cmore
|
||||
|
||||
__version__ = "1.9.11"
|
||||
|
||||
log = logging.getLogger('svtplay_dl')
|
||||
logging.getLogger('svtplay_dl')
|
||||
|
||||
|
||||
def setup_log(silent, verbose=False):
|
||||
@ -33,8 +32,8 @@ def setup_log(silent, verbose=False):
|
||||
hdlr = logging.StreamHandler(stream)
|
||||
hdlr.setFormatter(fmt)
|
||||
|
||||
log.addHandler(hdlr)
|
||||
log.setLevel(level)
|
||||
logging.addHandler(hdlr)
|
||||
logging.setLevel(level)
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -46,7 +46,8 @@ class Bigbrother(Service, OpenGraphThumbMixin):
|
||||
return
|
||||
videoplayer = match.group(1)
|
||||
|
||||
dataurl = "http://c.brightcove.com/services/viewer/htmlFederated?flashID={0}&playerID={1}&playerKey={2}&isVid=true&isUI=true&dynamicStreaming=true&@videoPlayer={3}".format(flashid, playerid, playerkey, videoplayer)
|
||||
dataurl = "http://c.brightcove.com/services/viewer/htmlFederated?flashID={0}&playerID={1}&playerKey={2}" \
|
||||
"&isVid=true&isUI=true&dynamicStreaming=true&@videoPlayer={3}".format(flashid, playerid, playerkey, videoplayer)
|
||||
data = self.http.request("get", dataurl).content
|
||||
match = re.search(r'experienceJSON = ({.*});', data)
|
||||
if not match:
|
||||
@ -61,7 +62,8 @@ class Bigbrother(Service, OpenGraphThumbMixin):
|
||||
|
||||
for i in renditions:
|
||||
if i["defaultURL"].endswith("f4m"):
|
||||
streams = hdsparse(copy.copy(self.options), self.http.request("get", i["defaultURL"], params={"hdcore": "3.7.0"}), i["defaultURL"])
|
||||
streams = hdsparse(copy.copy(self.options), self.http.request("get", i["defaultURL"],
|
||||
params={"hdcore": "3.7.0"}), i["defaultURL"])
|
||||
if streams:
|
||||
for n in list(streams.keys()):
|
||||
yield streams[n]
|
||||
|
@ -58,7 +58,8 @@ class Dr(Service, OpenGraphThumbMixin):
|
||||
else:
|
||||
for stream in resource['Links']:
|
||||
if stream["Target"] == "HDS":
|
||||
streams = hdsparse(copy.copy(self.options), self.http.request("get", stream["Uri"], params={"hdcore": "3.7.0"}), stream["Uri"])
|
||||
streams = hdsparse(copy.copy(self.options), self.http.request("get", stream["Uri"],
|
||||
params={"hdcore": "3.7.0"}), stream["Uri"])
|
||||
if streams:
|
||||
for n in list(streams.keys()):
|
||||
yield streams[n]
|
||||
|
@ -161,7 +161,8 @@ class MtvMusic(Service, OpenGraphThumbMixin):
|
||||
for n in janson:
|
||||
if wanted_id == str(n["id"]):
|
||||
|
||||
mrssxmlurl = "http://media-utils.mtvnservices.com/services/MediaGenerator/mgid:arc:video:mtv.se:{0}?acceptMethods=hls".format(n["video_token"])
|
||||
mrssxmlurl = "http://media-utils.mtvnservices.com/services/MediaGenerator/" \
|
||||
"mgid:arc:video:mtv.se:{0}?acceptMethods=hls".format(n["video_token"])
|
||||
hls_asset = self.http.request("get", mrssxmlurl)
|
||||
xml = ET.XML(hls_asset.text)
|
||||
|
||||
|
@ -42,7 +42,8 @@ class NHL(Service, OpenGraphThumbMixin):
|
||||
except KeyError:
|
||||
yield ServiceError("Can't find api url")
|
||||
return
|
||||
filename = "{0}?contentId={1}&playbackScenario=HTTP_CLOUD_WIRED_WEB&format=json&platform=WEB_MEDIAPLAYER&_=1487455224334".format(janson["vpm"]["mediaFramework"]["mediaFrameworkEndPoint"], vid)
|
||||
filename = "{0}?contentId={1}&playbackScenario=HTTP_CLOUD_WIRED_WEB&format=json&platform=WEB_MEDIAPLAYER" \
|
||||
"&_=1487455224334".format(janson["vpm"]["mediaFramework"]["mediaFrameworkEndPoint"], vid)
|
||||
url = urljoin(apiurl, filename)
|
||||
res = self.http.get(url)
|
||||
janson = res.json()
|
||||
|
@ -34,7 +34,8 @@ class Picsearch(Service, OpenGraphThumbMixin):
|
||||
if not isinstance(mediaid, str):
|
||||
mediaid = mediaid.group(1)
|
||||
|
||||
jsondata = self.http.request("get", "http://csp.screen9.com/player?eventParam=1&ajaxauth={0}&method=embed&mediaid={1}".format(ajax_auth.group(1), mediaid)).text
|
||||
jsondata = self.http.request("get", "http://csp.screen9.com/player?eventParam=1&"
|
||||
"ajaxauth={0}&method=embed&mediaid={1}".format(ajax_auth.group(1), mediaid)).text
|
||||
jsondata = json.loads(jsondata)
|
||||
|
||||
if "data" in jsondata:
|
||||
|
@ -24,7 +24,8 @@ class Sr(Service, OpenGraphThumbMixin):
|
||||
|
||||
match = re.search('data-audio-type="publication" data-audio-id="(\d+)">', data) # Nyheter
|
||||
if match:
|
||||
dataurl = "https://sverigesradio.se/sida/playerajax/getaudiourl?id={0}&type={1}&quality=high&format=iis".format(match.group(1), "publication")
|
||||
dataurl = "https://sverigesradio.se/sida/playerajax/" \
|
||||
"getaudiourl?id={0}&type={1}&quality=high&format=iis".format(match.group(1), "publication")
|
||||
data = self.http.request("get", dataurl).text
|
||||
playerinfo = json.loads(data)
|
||||
yield HTTP(copy.copy(self.options), playerinfo["audioUrl"], 128)
|
||||
@ -46,7 +47,8 @@ class Sr(Service, OpenGraphThumbMixin):
|
||||
yield ServiceError("Can't find audio info")
|
||||
return
|
||||
|
||||
dataurl = "https://sverigesradio.se/sida/playerajax/getaudiourl?id={0}&type={1}&quality=high&format=iis".format(aid, type)
|
||||
dataurl = "https://sverigesradio.se/sida/playerajax/" \
|
||||
"getaudiourl?id={0}&type={1}&quality=high&format=iis".format(aid, type)
|
||||
data = self.http.request("get", dataurl).text
|
||||
playerinfo = json.loads(data)
|
||||
yield HTTP(copy.copy(self.options), playerinfo["audioUrl"], 128)
|
||||
|
@ -5,8 +5,6 @@
|
||||
# The unittest framwork doesn't play nice with pylint:
|
||||
# pylint: disable-msg=C0103
|
||||
|
||||
import unittest
|
||||
|
||||
|
||||
class HandlesURLsTestMixin():
|
||||
"""
|
||||
|
@ -128,7 +128,8 @@ class Tv4play(Service, OpenGraphThumbMixin):
|
||||
def _get_show_info(self):
|
||||
show = self._get_showname()
|
||||
live = str(self.options.live).lower()
|
||||
data = self.http.request("get", "http://webapi.tv4play.se/play/video_assets?type=episode&is_live={0}&platform=web&node_nids={1}&per_page=99999".format(live, show)).text
|
||||
data = self.http.request("get", "http://webapi.tv4play.se/play/video_assets?type=episode&is_live={0}&"
|
||||
"platform=web&node_nids={1}&per_page=99999".format(live, show)).text
|
||||
jsondata = json.loads(data)
|
||||
return jsondata
|
||||
|
||||
@ -139,7 +140,8 @@ class Tv4play(Service, OpenGraphThumbMixin):
|
||||
run = True
|
||||
live = str(self.options.live).lower()
|
||||
while run:
|
||||
data = self.http.request("get", "http://webapi.tv4play.se/play/video_assets?type=clips&is_live={0}&platform=web&node_nids={1}&per_page=1000&page={2}".format(live, show, page)).text
|
||||
data = self.http.request("get", "http://webapi.tv4play.se/play/video_assets?type=clips&is_live={0}"
|
||||
"&platform=web&node_nids={1}&per_page=1000&page={2}".format(live, show, page)).text
|
||||
jsondata = json.loads(data)
|
||||
for i in jsondata["results"]:
|
||||
if vid == i["id"]:
|
||||
|
@ -43,7 +43,8 @@ class Vg(Service, OpenGraphThumbMixin):
|
||||
return
|
||||
|
||||
if "hds" in jsondata["streamUrls"]:
|
||||
streams = hdsparse(self.options, self.http.request("get", jsondata["streamUrls"]["hds"], params={"hdcore": "3.7.0"}), jsondata["streamUrls"]["hds"])
|
||||
streams = hdsparse(self.options, self.http.request("get", jsondata["streamUrls"]["hds"], params={"hdcore": "3.7.0"}),
|
||||
jsondata["streamUrls"]["hds"])
|
||||
if streams:
|
||||
for n in list(streams.keys()):
|
||||
yield streams[n]
|
||||
|
@ -116,7 +116,8 @@ def parser(version):
|
||||
subtitle.add_argument("-S", "--subtitle", action="store_true", dest="subtitle", default=False,
|
||||
help="download subtitle from the site if available")
|
||||
subtitle.add_argument("-M", "--merge-subtitle", action="store_true", dest="merge_subtitle", default=False,
|
||||
help="merge subtitle with video/audio file with corresponding ISO639-3 language code. this invokes --remux automatically. use with -S for external also.")
|
||||
help="merge subtitle with video/audio file with corresponding ISO639-3 language code."
|
||||
"this invokes --remux automatically. use with -S for external also.")
|
||||
subtitle.add_argument("--force-subtitle", dest="force_subtitle", default=False, action="store_true",
|
||||
help="download only subtitle if its used with -S")
|
||||
subtitle.add_argument("--require-subtitle", dest="require_subtitle", default=False, action="store_true",
|
||||
|
Loading…
Reference in New Issue
Block a user