From f74b71d121609438d2cce1095460c416c2db3bb4 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Sun, 28 Jul 2024 23:50:14 +0200 Subject: [PATCH] urplay: improve --all-episodes --- lib/svtplay_dl/service/urplay.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/svtplay_dl/service/urplay.py b/lib/svtplay_dl/service/urplay.py index e5ad2b16..13f51e74 100644 --- a/lib/svtplay_dl/service/urplay.py +++ b/lib/svtplay_dl/service/urplay.py @@ -53,17 +53,19 @@ def find_all_episodes(self, config): logging.error("Can't find video info.") return episodes - data = unescape(match.group(1)) - jsondata = json.loads(data) + jsondata = json.loads(match.group(1)) seasons = jsondata["props"]["pageProps"]["superSeriesSeasons"] + build = jsondata["buildId"] parse = urlparse(self.url) url = f"https://{parse.netloc}{parse.path}" episodes.append(url) if seasons: for season in seasons: - res = self.http.get(f'https://urplay.se/api/v1/series?id={season["id"]}') - for episode in res.json()["programs"]: + res = self.http.get( + f'https://urplay.se/_next/data/{build}{season["link"]}.json?productType={jsondata["query"]["productType"]}&id={jsondata["props"]["pageProps"]["program"]["seriesId"]}', + ) + for episode in res.json()["pageProps"]["program"]["series"]["programs"]: url = urljoin("https://urplay.se", episode["link"]) if url not in episodes: episodes.append(url)