mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-24 04:05:39 +01:00
discoveryplus: show an error message if we cant find any videos
This commit is contained in:
parent
682ecd9763
commit
4ca255b232
@ -120,6 +120,7 @@ class Dplay(Service):
|
|||||||
self.domain = re.search(r"(discoveryplus\.\w\w)", parse.netloc).group(1)
|
self.domain = re.search(r"(discoveryplus\.\w\w)", parse.netloc).group(1)
|
||||||
programid = None
|
programid = None
|
||||||
seasons = []
|
seasons = []
|
||||||
|
episodes = []
|
||||||
match = re.search("^/(program|programmer|videos|videoer)/([^/]+)", parse.path)
|
match = re.search("^/(program|programmer|videos|videoer)/([^/]+)", parse.path)
|
||||||
if not match:
|
if not match:
|
||||||
logging.error("Can't find show name")
|
logging.error("Can't find show name")
|
||||||
@ -140,6 +141,9 @@ class Dplay(Service):
|
|||||||
|
|
||||||
url = "http://disco-api.{}/cms/routes/program{}/{}?decorators=viewingHistory&include=default".format(self.domain, urllocal, match.group(2))
|
url = "http://disco-api.{}/cms/routes/program{}/{}?decorators=viewingHistory&include=default".format(self.domain, urllocal, match.group(2))
|
||||||
res = self.http.get(url)
|
res = self.http.get(url)
|
||||||
|
if res.status_code > 400:
|
||||||
|
logging.error("Cant find any videos. wrong url?")
|
||||||
|
return episodes
|
||||||
for what in res.json()["included"]:
|
for what in res.json()["included"]:
|
||||||
if "attributes" in what and "alias" in what["attributes"] and "season" in what["attributes"]["alias"]:
|
if "attributes" in what and "alias" in what["attributes"] and "season" in what["attributes"]["alias"]:
|
||||||
programid = what["id"]
|
programid = what["id"]
|
||||||
@ -147,7 +151,6 @@ class Dplay(Service):
|
|||||||
if ses["id"] == "seasonNumber":
|
if ses["id"] == "seasonNumber":
|
||||||
for opt in ses["options"]:
|
for opt in ses["options"]:
|
||||||
seasons.append(opt["value"])
|
seasons.append(opt["value"])
|
||||||
episodes = []
|
|
||||||
|
|
||||||
if programid:
|
if programid:
|
||||||
for season in seasons:
|
for season in seasons:
|
||||||
|
Loading…
Reference in New Issue
Block a user