mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-24 04:05:39 +01:00
Add support for Aftonbladet embedded videos
This commit is contained in:
parent
c27e098593
commit
78d1ad6934
@ -6,8 +6,8 @@ import json
|
||||
|
||||
from svtplay_dl.service import Service
|
||||
from svtplay_dl.utils import decode_html_entities
|
||||
from svtplay_dl.utils.urllib import urlparse
|
||||
from svtplay_dl.error import ServiceError
|
||||
from svtplay_dl.fetcher.hds import hdsparse
|
||||
from svtplay_dl.fetcher.hls import hlsparse
|
||||
|
||||
|
||||
@ -46,7 +46,6 @@ class Aftonbladettv(Service):
|
||||
class Aftonbladet(Service):
|
||||
supported_domains = ["aftonbladet.se"]
|
||||
|
||||
|
||||
def get(self):
|
||||
data = self.get_urldata()
|
||||
|
||||
@ -59,7 +58,13 @@ class Aftonbladet(Service):
|
||||
yield ServiceError("Can't find video info")
|
||||
return
|
||||
|
||||
janson = json.loads(match.group(1))
|
||||
videos = self._get_video(match.group(1))
|
||||
for i in videos:
|
||||
yield i
|
||||
|
||||
def _get_video(self, url):
|
||||
|
||||
janson = json.loads(url)
|
||||
articleid = janson["article"]["currentArticleId"]
|
||||
components = janson["articles"][articleid]["article"]["components"]
|
||||
for i in components:
|
||||
@ -69,5 +74,21 @@ class Aftonbladet(Service):
|
||||
streams = hlsparse(self.options, self.http.request("get", n["videoAsset"]["streamUrls"]["hls"]),
|
||||
n["videoAsset"]["streamUrls"]["hls"])
|
||||
if streams:
|
||||
for n in list(streams.keys()):
|
||||
yield streams[n]
|
||||
for key in list(streams.keys()):
|
||||
yield streams[key]
|
||||
|
||||
if "videoAsset" in i and "streamUrls" in i["videoAsset"]:
|
||||
|
||||
streams = []
|
||||
streamUrls = i["videoAsset"]["streamUrls"]
|
||||
|
||||
if "hls" in streamUrls:
|
||||
streams.append(hlsparse(self.options, self.http.request("get", streamUrls["hls"]), streamUrls["hls"]))
|
||||
|
||||
if "hds" in streamUrls:
|
||||
streams.append(hdsparse(self.options, self.http.request("get", streamUrls["hds"], params={"hdcore": "3.7.0"}), streamUrls["hds"]))
|
||||
|
||||
if streams:
|
||||
for s in streams:
|
||||
for key in list(s.keys()):
|
||||
yield s[key]
|
||||
|
Loading…
Reference in New Issue
Block a user