1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-28 06:04:17 +01:00

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
This commit is contained in:
qnorsten 2017-02-06 12:37:46 +01:00
parent c05297131c
commit 1dbe315586

View File

@ -189,9 +189,17 @@ class Viaplay(Service, OpenGraphThumbMixin):
match = re.search('"ContentPageProgramStore":({.*}),"ApplicationStore', self.get_urldata()) match = re.search('"ContentPageProgramStore":({.*}),"ApplicationStore', self.get_urldata())
if match: if match:
janson = json.loads(match.group(1)) janson = json.loads(match.group(1))
season = re.search("sasong-(\d+)",urlparse(self.url).path)
if season:
season = season.group(1)
seasons = [] seasons = []
for i in janson["format"]["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: for i in seasons:
if "program" in janson["format"]["videos"][str(i)]: if "program" in janson["format"]["videos"][str(i)]:
for n in janson["format"]["videos"][str(i)]["program"]: for n in janson["format"]["videos"][str(i)]["program"]: