Exemplo n.º 1
0
    http(s)?://(\w+\.)?
    dailymotion.com
    (/embed)?/(video|live)
    /(?P<media_id>[^_?/]+)
""", re.VERBOSE)

_media_inner_schema = validate.Schema([{
    "layerList": [{
        "name":
        validate.text,
        validate.optional("sequenceList"): [{
            "layerList":
            validate.all([{
                "name": validate.text,
                validate.optional("param"): dict
            }], validate.filter(lambda l: l["name"] in ("video", "reporting")))
        }]
    }]
}])
_media_schema = validate.Schema(
    validate.any(
        _media_inner_schema,
        validate.all({"sequence": _media_inner_schema},
                     validate.get("sequence"))))
_vod_playlist_schema = validate.Schema({
    "duration": float,
    "fragments": [[int, float]],
    "template": validate.text
})
_vod_manifest_schema = validate.Schema({
    "alternates": [{
Exemplo n.º 2
0
            validate.all([{
                "LinkType":
                validate.text,
                "Qualities": [
                    validate.all(
                        {
                            "Streams":
                            validate.all([
                                validate.all({"Stream": validate.text},
                                             validate.get("Stream"))
                            ], validate.get(0))
                        }, validate.get("Streams"))
                ],
                "Server":
                validate.text
            }], validate.filter(lambda s: s["LinkType"] in STREAMING_TYPES))
        }]
    }, validate.get("Data", {}))

_video_schema = validate.Schema(
    {
        "Data": [{
            "Assets":
            validate.all([{
                validate.optional("Links"):
                validate.all([{
                    "Target": validate.text,
                    "Uri": validate.text
                }], validate.filter(lambda l: l["Target"] in STREAMING_TYPES))
            }], validate.filter(lambda a: "Links" in a))
        }]
Exemplo n.º 3
0
    (?:
        (?P<seconds>\d+)s
    )?
""", re.VERBOSE)

_access_token_schema = validate.Schema(
    {
        "token": validate.text,
        "sig": validate.text
    }, validate.union((validate.get("sig"), validate.get("token"))))
_token_schema = validate.Schema(
    {
        "chansub": {
            "restricted_bitrates":
            validate.all([validate.text],
                         validate.filter(lambda n: not re.match(
                             r"(.+_)?archives|live|chunked", n)))
        }
    }, validate.get("chansub"))
_user_schema = validate.Schema(
    {validate.optional("display_name"): validate.text},
    validate.get("display_name"))
_video_schema = validate.Schema({
    "chunks": {
        validate.text: [{
            "length": int,
            "url": validate.any(None, validate.url(scheme="http")),
            "upkeep": validate.any("pass", "fail", None)
        }]
    },
    "restrictions": {
        validate.text: validate.text
Exemplo n.º 4
0
METADATA_URL = "http://aftonbladet-play-metadata.cdn.drvideo.aptoma.no/video/{0}.json"

_embed_re = re.compile("<iframe src=\"(http://tv.aftonbladet.se[^\"]+)\"")
_aptoma_id_re = re.compile("<div id=\"drvideo\".+data-aptomaId=\"([^\"]+)\"")
_live_re = re.compile("data-isLive=\"true\"")
_url_re = re.compile("http(s)?://(\w+.)?.aftonbladet.se")

_video_schema = validate.Schema({
    "formats":
    validate.all(
        {
            validate.text: {
                validate.text:
                validate.all(
                    dict,
                    validate.filter(lambda k, v: k in STREAM_FORMATS),
                    {
                        validate.text: [{
                            "address": validate.text,
                            "filename": validate.text,
                            "path": validate.text
                        }]
                    },
                )
            }
        }, validate.filter(lambda k, v: k in STREAM_TYPES))
})


class Aftonbladet(Plugin):
    @classmethod
Exemplo n.º 5
0
        juicyplay |
        viafree
    )
    \.
    (?:
        dk|ee|lt|lv|no|se|com
    )
    (/.+?/|/embed\?id=)
    (?P<stream_id>\d+)
""", re.VERBOSE)

_stream_schema = validate.Schema(
    {
        "streams": validate.all(
            {validate.text: validate.any(validate.text, int, None)},
            validate.filter(lambda k, v: isinstance(v, validate.text))
        )
    },
    validate.get("streams")
)


class Viasat(Plugin):
    @classmethod
    def can_handle_url(cls, url):
        return _url_re.match(url)

    def _get_swf_url(self):
        res = http.get(self.url)
        match = _swf_url_re.search(res.text)
        if not match:
Exemplo n.º 6
0
STREAM_INFO_URL = "http://live.daserste.de/{0}/livestream.xml"
SWF_URL = "http://live.daserste.de/lib/br-player/swf/main.swf"
STREAMING_TYPES = {
    "streamingUrlLive": (
        "HDS", partial(HDSStream.parse_manifest, pvswf=SWF_URL)
    ),
    "streamingUrlIPhone": (
        "HLS", HLSStream.parse_variant_playlist
    )
}

_url_re = re.compile("http(s)?://live.daserste.de/(?P<channel>[^/?]+)?")

_livestream_schema = validate.Schema(
    validate.xml_findall("video/*"),
    validate.filter(lambda e: e.tag in STREAMING_TYPES),
    validate.map(lambda e: (STREAMING_TYPES.get(e.tag), e.text)),
    validate.transform(dict),
)

class ard_live(Plugin):
    @classmethod
    def can_handle_url(cls, url):
        return _url_re.match(url)

    def _get_streams(self):
        match = _url_re.match(self.url)
        channel = match.group("channel")
        res = http.get(STREAM_INFO_URL.format(channel))
        urls = http.xml(res, schema=_livestream_schema)
Exemplo n.º 7
0
    {
        "livestream": [{
            "media_is_live":
            validate.all(validate.text, validate.transform(int),
                         validate.transform(bool)),
            "media_id":
            validate.text
        }],
    }, validate.get("livestream"), validate.length(1), validate.get(0))
_player_schema = validate.Schema({
    "clip": {
        "baseUrl":
        validate.any(None, validate.text),
        "bitrates":
        validate.all(
            validate.filter(lambda b: b.get("url") and b.get("label")),
            [{
                "label": validate.text,
                "url": validate.text,
            }],
        )
    },
    validate.optional("playlist"): [{
        validate.optional("connectionProvider"):
        validate.text,
        validate.optional("netConnectionUrl"):
        validate.text,
        validate.optional("bitrates"): [{
            "label": validate.text,
            "url": validate.text,
            "provider": validate.text
Exemplo n.º 8
0
    r"<meta content='.+/([\w_-]+).+' property='og:video'>")
_player_config_re = re.compile(r"var playerConfig = (.+);")
_url_re = re.compile("http(s)?://(\w+\.)?(majorleaguegaming\.com|mlg\.tv)")

_player_config_schema = validate.Schema(
    {"media": {
        "stream_name": validate.text
    }}, validate.get("media", {}), validate.get("stream_name"))
_stream_schema = validate.Schema(
    {
        "data": {
            "items":
            validate.all([{
                "format": validate.text,
                "url": validate.text
            }], validate.filter(lambda s: s["format"] in STREAM_TYPES))
        }
    }, validate.get("data", {}), validate.get("items", []))


class MLGTV(Plugin):
    @classmethod
    def can_handle_url(self, url):
        return _url_re.match(url)

    def _find_channel_id(self, text):
        match = _stream_id_re.search(text)
        if match:
            return match.group(1)

    def _find_stream_id(self, text):