From 74e9972f6e78801fed1d4ab598d973514efe83e1 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Fri, 14 Jun 2024 21:39:55 +0200 Subject: [PATCH] svtplay: fix a special case when we cant find videos In some cases videos dont have audiodescribed or signInterpreted available when it was released --- lib/svtplay_dl/service/svtplay.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/svtplay_dl/service/svtplay.py b/lib/svtplay_dl/service/svtplay.py index aedbea9f..3fdbecf8 100644 --- a/lib/svtplay_dl/service/svtplay.py +++ b/lib/svtplay_dl/service/svtplay.py @@ -122,19 +122,25 @@ def _get_video(self, janson): for videorfc in janson["variants"]["default"]["videoReferences"]: params = {} + special = False params["manifestUrl"] = quote_plus(videorfc["url"]) format = videorfc["format"] if "audioDescribed" in janson["variants"] and janson["variants"]["audioDescribed"]: for audiodesc in janson["variants"]["audioDescribed"]["videoReferences"]: if audiodesc["format"] == format: + special = True params["manifestUrlAudioDescription"] = audiodesc["url"] if "signInterpreted" in janson["variants"] and janson["variants"]["signInterpreted"]: for signinter in janson["variants"]["signInterpreted"]["videoReferences"]: if signinter["format"] == format: + special = True params["manifestUrlSignLanguage"] = signinter["url"] - params = _dict_to_flatstr(params) - pl_url = f"https://api.svt.se/ditto/api/v1/web?{params}" + if special: + params = _dict_to_flatstr(params) + pl_url = f"https://api.svt.se/ditto/api/v1/web?{params}" + else: + pl_url = videorfc["url"] if pl_url.find(".m3u8") > 0: yield from hlsparse(self.config, self.http.request("get", pl_url), pl_url, output=self.output)