From 774e29a1044be323785d9da070f97be0491c4185 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Wed, 10 Feb 2021 21:47:43 +0100 Subject: [PATCH] disoveryplus: only add showid when we need it --- lib/svtplay_dl/service/dplay.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/svtplay_dl/service/dplay.py b/lib/svtplay_dl/service/dplay.py index 93a2da2..93b8b6d 100644 --- a/lib/svtplay_dl/service/dplay.py +++ b/lib/svtplay_dl/service/dplay.py @@ -154,18 +154,20 @@ class Dplay(Service): if ses["id"] == "seasonNumber": for opt in ses["options"]: seasons.append(opt["value"]) - showid = what["attributes"]["component"]["mandatoryParams"] + if "mandatoryParams" in what["attributes"]["component"]: + showid = what["attributes"]["component"]["mandatoryParams"] if programid: for season in seasons: page = 1 totalpages = 1 while page <= totalpages: - querystring = "decorators=viewingHistory&include=default&page[items.number]={}&{}&pf[seasonNumber]={}".format( + querystring = "decorators=viewingHistory&include=default&page[items.number]={}&pf[seasonNumber]={}".format( page, - showid, season, ) + if showid: + querystring += "&{}".format(showid) res = self.http.get("https://disco-api.{}/cms/collections/{}?{}".format(self.domain, programid, querystring)) janson = res.json() totalpages = janson["data"]["meta"]["itemsTotalPages"]