2024-06-15 13:15:00 +02:00
|
|
|
import json
|
2019-08-25 00:40:39 +02:00
|
|
|
import re
|
2016-09-02 01:20:54 +02:00
|
|
|
|
|
|
|
from svtplay_dl.error import ServiceError
|
2019-08-25 00:40:39 +02:00
|
|
|
from svtplay_dl.fetcher.hls import hlsparse
|
|
|
|
from svtplay_dl.service import OpenGraphThumbMixin
|
|
|
|
from svtplay_dl.service import Service
|
2016-09-02 01:20:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Riksdagen(Service, OpenGraphThumbMixin):
|
2018-10-28 16:29:17 +01:00
|
|
|
supported_domains_re = ["riksdagen.se", "www.riksdagen.se"]
|
2016-09-02 01:20:54 +02:00
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
2024-06-15 13:15:00 +02:00
|
|
|
match = re.search(r"application\/json\">({.+})<\/script>", self.get_urldata())
|
|
|
|
if not match:
|
|
|
|
yield ServiceError("Cant find the video.")
|
2016-09-02 01:20:54 +02:00
|
|
|
return
|
|
|
|
|
2024-06-15 13:15:00 +02:00
|
|
|
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)
|