From 806fd55d3b4a60a360e0b3fc7f84394765d1427c Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Sun, 6 Jan 2019 21:55:48 +0100 Subject: [PATCH] svt: support for subtitles on the page. fixes #1026 --- lib/svtplay_dl/service/svt.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/svtplay_dl/service/svt.py b/lib/svtplay_dl/service/svt.py index 9f2fa00..175c5e2 100644 --- a/lib/svtplay_dl/service/svt.py +++ b/lib/svtplay_dl/service/svt.py @@ -1,7 +1,9 @@ import re +import copy from svtplay_dl.error import ServiceError from svtplay_dl.service.svtplay import Svtplay +from svtplay_dl.subtitle import subtitle class Svt(Svtplay): @@ -21,6 +23,11 @@ class Svt(Svtplay): res = self.http.get("http://api.svt.se/videoplayer-api/video/{0}".format(id)) janson = res.json() + if "subtitleReferences" in janson: + for i in janson["subtitleReferences"]: + if i["format"] == "websrt" and "url" in i: + yield subtitle(copy.copy(self.config), "wrst", i["url"], output=self.output) + videos = self._get_video(janson) for i in videos: yield i