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

svt: fix so we can download videos again

This commit is contained in:
Johan Andersson 2020-06-02 17:41:30 +02:00
parent ff914c2dd1
commit 916e19996c

View File

@ -1,4 +1,5 @@
import copy import copy
import json
import re import re
from svtplay_dl.error import ServiceError from svtplay_dl.error import ServiceError
@ -12,16 +13,14 @@ class Svt(Svtplay):
def get(self): def get(self):
data = self.get_urldata() data = self.get_urldata()
match_data_video_id = re.search('data-video-id="(.+?)"', data) match = re.search("n.reduxState=(.*);", data)
if not match:
if match_data_video_id:
id = match_data_video_id.group(1)
else:
yield ServiceError("Cant find video info.") yield ServiceError("Cant find video info.")
return return
res = self.http.get("http://api.svt.se/videoplayer-api/video/{}".format(id)) janson = json.loads(match.group(1))
vid = janson["areaData"]["articles"][list(janson["areaData"]["articles"].keys())[0]]["media"][0]["image"]["svtId"]
res = self.http.get("https://api.svt.se/video/{}".format(vid))
janson = res.json() janson = res.json()
if "subtitleReferences" in janson: if "subtitleReferences" in janson:
for i in janson["subtitleReferences"]: for i in janson["subtitleReferences"]: