1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +01:00

aftonbladet: support for the new page.

they changed it a bit so it uses some more js.

fixes #664
This commit is contained in:
Johan Andersson 2017-09-01 20:53:04 +02:00
parent 2a70b72938
commit 40e4c63211
2 changed files with 32 additions and 2 deletions

View File

@ -17,7 +17,7 @@ from svtplay_dl.subtitle import subtitle
from svtplay_dl.output import filename
from svtplay_dl.postprocess import postprocess
from svtplay_dl.service.aftonbladet import Aftonbladet
from svtplay_dl.service.aftonbladet import Aftonbladet, Aftonbladettv
from svtplay_dl.service.bambuser import Bambuser
from svtplay_dl.service.bigbrother import Bigbrother
from svtplay_dl.service.dbtv import Dbtv
@ -60,6 +60,7 @@ __version__ = "1.9.4"
sites = [
Aftonbladet,
Aftonbladettv,
Bambuser,
Bigbrother,
Dbtv,

View File

@ -11,7 +11,7 @@ from svtplay_dl.error import ServiceError
from svtplay_dl.fetcher.hls import hlsparse
class Aftonbladet(Service):
class Aftonbladettv(Service):
supported_domains = ['tv.aftonbladet.se', "svd.se"]
def get(self):
@ -43,3 +43,32 @@ class Aftonbladet(Service):
if streams:
for n in list(streams.keys()):
yield streams[n]
class Aftonbladet(Service):
supported_domains = ["aftonbladet.se"]
def get(self):
data = self.get_urldata()
if self.exclude():
yield ServiceError("Excluding video")
return
match = re.search('window.FLUX_STATE = ({.*})</script>', data)
if not match:
yield ServiceError("Can't find video info")
return
janson = json.loads(match.group(1))
articleid = janson["article"]["currentArticleId"]
components = janson["articles"][articleid]["article"]["components"]
for i in components:
if "components" in i:
for n in i["components"]:
if "type" in n and n["type"] == "video":
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]