mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-27 13:44:14 +01:00
riksdagen: they changed the website
This commit is contained in:
parent
c8dcdfaf6d
commit
f75072313c
@ -1,3 +1,4 @@
|
||||
import json
|
||||
import re
|
||||
|
||||
from svtplay_dl.error import ServiceError
|
||||
@ -10,21 +11,12 @@ class Riksdagen(Service, OpenGraphThumbMixin):
|
||||
supported_domains_re = ["riksdagen.se", "www.riksdagen.se"]
|
||||
|
||||
def get(self):
|
||||
match = re.search("_([a-zA-Z0-9]+)$", self.url)
|
||||
|
||||
match = re.search(r"application\/json\">({.+})<\/script>", self.get_urldata())
|
||||
if not match:
|
||||
yield ServiceError("Cant find video id.")
|
||||
yield ServiceError("Cant find the video.")
|
||||
return
|
||||
|
||||
vid = match.group(1)
|
||||
res = self.http.get(f"http://www.riksdagen.se/api/videostream/get/{vid}")
|
||||
data = res.json()
|
||||
|
||||
try:
|
||||
janson = data["videodata"][0]["streams"]["files"]
|
||||
except TypeError:
|
||||
yield ServiceError("Cant find video.")
|
||||
return
|
||||
|
||||
for i in janson:
|
||||
for n in i["bandwidth"]:
|
||||
yield from hlsparse(self.config, self.http.request("get", n["url"]), n["url"], output=self.output)
|
||||
janson = json.loads(match.group(1))
|
||||
url = janson["props"]["pageProps"]["contentApiData"]["video"]["url"]
|
||||
yield from hlsparse(self.config, self.http.request("get", url), url, output=self.output)
|
||||
|
Loading…
Reference in New Issue
Block a user