From 1dbe3155865e879bd7b96b3894f69bac329bdf96 Mon Sep 17 00:00:00 2001 From: qnorsten Date: Mon, 6 Feb 2017 12:37:46 +0100 Subject: [PATCH] viafree: Download only specific season by using /sasongXX in url Support to only download specific season by passing /sasongXX in url, when used with -A Fixes: https://github.com/spaam/svtplay-dl/issues/439 --- lib/svtplay_dl/service/viaplay.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/svtplay_dl/service/viaplay.py b/lib/svtplay_dl/service/viaplay.py index 49dab49..86593c0 100644 --- a/lib/svtplay_dl/service/viaplay.py +++ b/lib/svtplay_dl/service/viaplay.py @@ -189,9 +189,17 @@ class Viaplay(Service, OpenGraphThumbMixin): match = re.search('"ContentPageProgramStore":({.*}),"ApplicationStore', self.get_urldata()) if match: janson = json.loads(match.group(1)) + season = re.search("sasong-(\d+)",urlparse(self.url).path) + if season: + season = season.group(1) seasons = [] for i in janson["format"]["seasons"]: - seasons.append(i["seasonNumber"]) + if season: + if int(season) == i["seasonNumber"]: + seasons.append(i["seasonNumber"]) + else: + seasons.append(i["seasonNumber"]) + for i in seasons: if "program" in janson["format"]["videos"][str(i)]: for n in janson["format"]["videos"][str(i)]["program"]: