diff --git a/lib/svtplay_dl/service/services.py b/lib/svtplay_dl/service/services.py index 8dc544e..7730035 100644 --- a/lib/svtplay_dl/service/services.py +++ b/lib/svtplay_dl/service/services.py @@ -37,6 +37,7 @@ from svtplay_dl.service.tv4play import Tv4 from svtplay_dl.service.tv4play import Tv4play from svtplay_dl.service.twitch import Twitch from svtplay_dl.service.urplay import Urplay +from svtplay_dl.service.vasaloppet import Vasaloppet from svtplay_dl.service.vg import Vg from svtplay_dl.service.viaplay import Viafree from svtplay_dl.service.viasatsport import Viasatsport @@ -80,6 +81,7 @@ sites = [ Tv4, Tv4play, Urplay, + Vasaloppet, Viafree, Viasatsport, Vimeo, diff --git a/lib/svtplay_dl/service/vasaloppet.py b/lib/svtplay_dl/service/vasaloppet.py new file mode 100644 index 0000000..fe529b0 --- /dev/null +++ b/lib/svtplay_dl/service/vasaloppet.py @@ -0,0 +1,26 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +import re +from urllib.parse import urlparse + +from svtplay_dl.error import ServiceError +from svtplay_dl.fetcher.hls import hlsparse +from svtplay_dl.service import OpenGraphThumbMixin +from svtplay_dl.service import Service + + +class Vasaloppet(Service, OpenGraphThumbMixin): + supported_domains = ["vasaloppet.tv"] + + def get(self): + match = re.search(r'iframe src="(https://vlplayer.rack[^"]+)" width', self.get_urldata()) + if not match: + yield ServiceError("Can't find video") + return + + parse = urlparse(match.group(1)) + status_url = f"http://{parse.netloc}{parse.path}/status" + res = self.http.get(status_url) + janson = res.json() + hls = janson["vods"][0]["hls"] + yield from hlsparse(self.config, self.http.request("get", hls), hls, output=self.output)