mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-30 15:14:14 +01:00
vasaloppet: add support
This commit is contained in:
parent
84420869c7
commit
5d77d4c8ca
@ -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,
|
||||
|
26
lib/svtplay_dl/service/vasaloppet.py
Normal file
26
lib/svtplay_dl/service/vasaloppet.py
Normal 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)
|
Loading…
Reference in New Issue
Block a user