1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 12:15:40 +01:00
svtplay-dl/lib/svtplay_dl/service/expressen.py

27 lines
840 B
Python
Raw Normal View History

2013-03-02 21:26:28 +01:00
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
import json
2019-08-25 00:40:39 +02:00
import re
from svtplay_dl.error import ServiceError
from svtplay_dl.fetcher.hls import hlsparse
2019-08-25 00:40:39 +02:00
from svtplay_dl.service import Service
from svtplay_dl.utils.text import decode_html_entities
2015-09-15 20:10:32 +02:00
class Expressen(Service):
2019-08-25 00:27:31 +02:00
supported_domains = ["expressen.se"]
def get(self):
data = self.get_urldata()
match = re.search('data-article-data="([^"]+)"', data)
if not match:
yield ServiceError("Cant find video file info")
return
data = decode_html_entities(match.group(1))
janson = json.loads(data)
self.config.set("live", janson["isLive"])
yield from hlsparse(self.config, self.http.request("get", janson["stream"]), janson["stream"], output=self.output)