mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-27 21:54:17 +01:00
nhl: support for vod videos.
This commit is contained in:
parent
dfaa1fac90
commit
c9903f63be
@ -34,6 +34,7 @@ from svtplay_dl.service.twitch import Twitch
|
||||
from svtplay_dl.service.lemonwhale import Lemonwhale
|
||||
from svtplay_dl.service.mtvnn import Mtvnn
|
||||
from svtplay_dl.service.mtvservices import Mtvservices
|
||||
from svtplay_dl.service.nhl import NHL
|
||||
from svtplay_dl.service.nrk import Nrk
|
||||
from svtplay_dl.service.oppetarkiv import OppetArkiv
|
||||
from svtplay_dl.service.picsearch import Picsearch
|
||||
@ -74,6 +75,7 @@ sites = [
|
||||
Lemonwhale,
|
||||
Mtvservices,
|
||||
Mtvnn,
|
||||
NHL,
|
||||
Nrk,
|
||||
Qbrick,
|
||||
Picsearch,
|
||||
|
31
lib/svtplay_dl/service/nhl.py
Normal file
31
lib/svtplay_dl/service/nhl.py
Normal file
@ -0,0 +1,31 @@
|
||||
from __future__ import absolute_import
|
||||
import re
|
||||
import json
|
||||
|
||||
from svtplay_dl.service import Service, OpenGraphThumbMixin
|
||||
from svtplay_dl.fetcher.hls import hlsparse
|
||||
from svtplay_dl.error import ServiceError
|
||||
|
||||
|
||||
class NHL(Service, OpenGraphThumbMixin):
|
||||
supported_domains = ['nhl.com']
|
||||
|
||||
def get(self):
|
||||
if self.exclude():
|
||||
yield ServiceError("Excluding video")
|
||||
return
|
||||
match = re.search("var initialMedia\s+= ({[^;]+);", self.get_urldata())
|
||||
if not match:
|
||||
yield ServiceError("Cant find any media on that page")
|
||||
return
|
||||
janson = json.loads(match.group(1))
|
||||
if "playbacks" in janson["metaData"]:
|
||||
for i in janson["metaData"]["playbacks"]:
|
||||
if "CLOUD" in i["name"]:
|
||||
streams = hlsparse(self.options, self.http.request("get", i["url"]), i["url"])
|
||||
if streams:
|
||||
for n in list(streams.keys()):
|
||||
yield streams[n]
|
||||
else:
|
||||
yield ServiceError("Can't find any video metadata")
|
||||
return
|
Loading…
Reference in New Issue
Block a user