1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 05:34:15 +01:00

vasaloppet: add support

This commit is contained in:
Johan Andersson 2024-04-05 22:04:17 +02:00
parent 84420869c7
commit 5d77d4c8ca
2 changed files with 28 additions and 0 deletions

View File

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

View File

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