1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +01:00

svt: support for subtitles on the page.

fixes #1026
This commit is contained in:
Johan Andersson 2019-01-06 21:55:48 +01:00
parent a4d4769457
commit 806fd55d3b

View File

@ -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