diff --git a/lib/svtplay_dl/service/barnkanalen.py b/lib/svtplay_dl/service/barnkanalen.py index c4dbf2f..e5692cb 100644 --- a/lib/svtplay_dl/service/barnkanalen.py +++ b/lib/svtplay_dl/service/barnkanalen.py @@ -74,15 +74,16 @@ class Barnkanalen(Svtplay): yield from self._get_video(janson) def find_all_episodes(self, config): + episodes = [] data = self.get_urldata() match = re.search(self.info_search_expr, data) if not match: logging.error("Can't find video info.") - return + return episodes janson = json.loads(match.group(1)) title = janson["query"]["titleSlug"] - episodes = [] + for season in janson["props"]["pageProps"]["initialState"]["featuredTitle"]["associatedContent"]: for episode in season["items"]: if "variants" in episode["item"]: diff --git a/lib/svtplay_dl/service/dplay.py b/lib/svtplay_dl/service/dplay.py index 7d74296..d555692 100644 --- a/lib/svtplay_dl/service/dplay.py +++ b/lib/svtplay_dl/service/dplay.py @@ -9,4 +9,3 @@ class Discoveryplus(Service): def get(self): yield ServiceError("Can't download videos from this site anymore because of DRM") - return diff --git a/lib/svtplay_dl/service/mtvnn.py b/lib/svtplay_dl/service/mtvnn.py index 315b788..f9dc6ce 100644 --- a/lib/svtplay_dl/service/mtvnn.py +++ b/lib/svtplay_dl/service/mtvnn.py @@ -89,19 +89,20 @@ class Mtvnn(Service, OpenGraphThumbMixin): yield from hlsparse(self.config, self.http.request("get", i["url"]), i["url"], output=self.output) def find_all_episodes(self, config): + episodes = [] match = re.search(r"data-franchise='([^']+)'", self.get_urldata()) if match is None: logging.error("Couldn't program id") - return + return episodes programid = match.group(1) match = re.findall(r"
  • 0: @@ -111,7 +111,7 @@ class OppetArkiv(Service, OpenGraphThumbMixin): datatitle = re.search('data-title="([^"]+)"', self.get_urldata()) if not datatitle: - return None + return datat = decode_html_entities(datatitle.group(1)) self.output["title"] = self.name(datat) self.seasoninfo(datat) diff --git a/lib/svtplay_dl/service/svtplay.py b/lib/svtplay_dl/service/svtplay.py index 0643048..5c68b4c 100644 --- a/lib/svtplay_dl/service/svtplay.py +++ b/lib/svtplay_dl/service/svtplay.py @@ -119,7 +119,7 @@ class Svtplay(Service, MetadataThumbMixin): match = re.search(self.info_search_expr, self.get_urldata()) if not match: logging.error("Can't find video info.") - return + return videos janson = json.loads(match.group(1)) video_data = None for data_entry in janson["props"]["urqlState"].values(): @@ -172,6 +172,7 @@ class Svtplay(Service, MetadataThumbMixin): def _all_episodes(self, url): parse = urlparse(url) tab = None + videos = [] if parse.query: query = parse_qs(parse.query) if "tab" in query: @@ -181,7 +182,7 @@ class Svtplay(Service, MetadataThumbMixin): match = re.search(self.info_search_expr, data) if not match: logging.error("Can't find video info.") - return + return videos janson = json.loads(match.group(1)) video_data = None @@ -195,9 +196,8 @@ class Svtplay(Service, MetadataThumbMixin): break collections = [] - videos = [] if video_data is None: - return + return videos if video_data["item"]["parent"]["__typename"] == "Single": videos.append(urljoin("http://www.svtplay.se", video_data["item"]["urls"]["svtplay"])) for i in video_data["associatedContent"]: diff --git a/lib/svtplay_dl/service/urplay.py b/lib/svtplay_dl/service/urplay.py index 71197f0..7019e2c 100644 --- a/lib/svtplay_dl/service/urplay.py +++ b/lib/svtplay_dl/service/urplay.py @@ -59,7 +59,7 @@ class Urplay(Service, OpenGraphThumbMixin): match = re.search(r"__NEXT_DATA__\" type=\"application\/json\">({.+})<\/script>", self.get_urldata()) if not match: logging.error("Can't find video info.") - return + return episodes data = unescape(match.group(1)) jsondata = json.loads(data) diff --git a/lib/svtplay_dl/service/viaplay.py b/lib/svtplay_dl/service/viaplay.py index ea9c03c..6e490a9 100644 --- a/lib/svtplay_dl/service/viaplay.py +++ b/lib/svtplay_dl/service/viaplay.py @@ -125,7 +125,7 @@ class Viafree(Service, OpenGraphThumbMixin): match = re.search('}}}},("staticPages".*}}); windo', data) if not match: logging.error("Cant find necessary info") - return + return episodes janson = self._jansonpage(match.group(1)) seasons = [] @@ -136,7 +136,7 @@ class Viafree(Service, OpenGraphThumbMixin): match = re.search('}}}},("staticPages".*}}); windo', data) if not match: logging.error("Cant find necessary info") - return + return episodes janson = self._jansonpage(match.group(1)) diff --git a/lib/svtplay_dl/utils/parser.py b/lib/svtplay_dl/utils/parser.py index 5770602..68e5062 100644 --- a/lib/svtplay_dl/utils/parser.py +++ b/lib/svtplay_dl/utils/parser.py @@ -45,6 +45,7 @@ class Options: def get(self, key): if key in self.default: return self.default[key] + return None def get_variable(self): return self.default