Skip to content

Commit

Permalink
svtplay: fix a special case when we cant find videos
Browse files Browse the repository at this point in the history
In some cases videos dont have audiodescribed or signInterpreted available
when it was released
  • Loading branch information
spaam committed Jun 14, 2024
1 parent 6d0c3a3 commit 74e9972
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/svtplay_dl/service/svtplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 74e9972

Please sign in to comment.