mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-28 06:04:17 +01:00
more code cleanup
cleanup
This commit is contained in:
parent
2adcdcd8ef
commit
908b4ec313
@ -24,7 +24,7 @@ class Tv4play(Service, OpenGraphThumbMixin):
|
|||||||
data = self.get_urldata()
|
data = self.get_urldata()
|
||||||
|
|
||||||
vid = findvid(self.url, data)
|
vid = findvid(self.url, data)
|
||||||
if vid is None:
|
if not vid:
|
||||||
yield ServiceError("Can't find video id for {0}.".format(self.url))
|
yield ServiceError("Can't find video id for {0}.".format(self.url))
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -57,8 +57,7 @@ class Tv4play(Service, OpenGraphThumbMixin):
|
|||||||
sa = list(ss.iter("item"))
|
sa = list(ss.iter("item"))
|
||||||
|
|
||||||
if xml.find("live").text:
|
if xml.find("live").text:
|
||||||
if xml.find("live").text != "false":
|
self.options.live = (xml.find("live").text != "false")
|
||||||
self.options.live = True
|
|
||||||
if xml.find("drmProtected").text == "true":
|
if xml.find("drmProtected").text == "true":
|
||||||
yield ServiceError("We can't download DRM protected content from this site.")
|
yield ServiceError("We can't download DRM protected content from this site.")
|
||||||
return
|
return
|
||||||
@ -70,7 +69,7 @@ class Tv4play(Service, OpenGraphThumbMixin):
|
|||||||
directory = os.path.dirname(self.options.output)
|
directory = os.path.dirname(self.options.output)
|
||||||
self.options.service = "tv4play"
|
self.options.service = "tv4play"
|
||||||
basename = self._autoname(vid)
|
basename = self._autoname(vid)
|
||||||
if basename is None:
|
if not basename:
|
||||||
yield ServiceError("Cant find vid id for autonaming.")
|
yield ServiceError("Cant find vid id for autonaming.")
|
||||||
return
|
return
|
||||||
title = "{0}-{1}-{2}".format(basename, vid, self.options.service)
|
title = "{0}-{1}-{2}".format(basename, vid, self.options.service)
|
||||||
@ -119,10 +118,7 @@ class Tv4play(Service, OpenGraphThumbMixin):
|
|||||||
|
|
||||||
def _get_show_info(self):
|
def _get_show_info(self):
|
||||||
show = self._get_showname()
|
show = self._get_showname()
|
||||||
if self.options.live:
|
live = str(self.options.live).lower()
|
||||||
live = "true"
|
|
||||||
else:
|
|
||||||
live = "false"
|
|
||||||
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)
|
jsondata = json.loads(data)
|
||||||
return jsondata
|
return jsondata
|
||||||
@ -132,10 +128,7 @@ class Tv4play(Service, OpenGraphThumbMixin):
|
|||||||
page = 1
|
page = 1
|
||||||
assets = page * 1000
|
assets = page * 1000
|
||||||
run = True
|
run = True
|
||||||
if self.options.live:
|
live = str(self.options.live).lower()
|
||||||
live = "true"
|
|
||||||
else:
|
|
||||||
live = "false"
|
|
||||||
while run:
|
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)
|
jsondata = json.loads(data)
|
||||||
|
Loading…
Reference in New Issue
Block a user