"HLS", HLSStream.parse_variant_playlist ) } _url_re = re.compile(""" http(s)?://(\w+\.)?zdf.de/zdfmediathek(\#)?/.+ /(live|video) /(?P<video_id>\d+) """, re.VERBOSE | re.IGNORECASE) _schema = validate.Schema( validate.xml_findall("video/formitaeten/formitaet"), [ validate.union({ "type": validate.get("basetype"), "quality": validate.xml_findtext("quality"), "url": validate.all( validate.xml_findtext("url"), validate.url() ) }) ] ) class zdf_mediathek(Plugin): @classmethod def can_handle_url(cls, url): return _url_re.match(url) @classmethod
from time import time from livestreamer.plugin import Plugin, PluginError from livestreamer.plugin.api import http, validate from livestreamer.stream import RTMPStream, HLSStream SWF_URL = "http://play.streamingvideoprovider.com/player2.swf" API_URL = "http://player.webvideocore.net/index.php" _url_re = re.compile( "http(s)?://(\w+\.)?streamingvideoprovider.co.uk/(?P<channel>[^/&?]+)" ) _hls_re = re.compile("'(http://.+\.m3u8)'") _rtmp_schema = validate.Schema( validate.xml_findtext("./info/url"), validate.url(scheme="rtmp") ) _hls_schema = validate.Schema( validate.transform(_hls_re.search), validate.any( None, validate.all( validate.get(1), validate.url( scheme="http", path=validate.endswith("m3u8") ) ) ) )
def test_xml_findtext(self): el = Element("foo") el.text = "bar" assert validate(xml_findtext("."), el) == "bar"
# Import base classes from a support plugin that must exist in the # same directory as this plugin. from livestreamer.plugin.api.support_plugin import justintv_common JustinTVPluginBase = justintv_common.PluginBase JustinTVAPIBase = justintv_common.APIBase _url_re = re.compile(r"http(s)?://([\w\.]+)?justin.tv/[^/]+(/[bc]/\d+)?") _video_schema = validate.Schema(validate.union({ "archives": validate.all( validate.xml_findall("archive"), [ validate.union({ "length": validate.all( validate.xml_findtext("length"), validate.transform(int), ), "transcodes": validate.all( validate.xml_find("transcode_file_urls"), validate.xml_findall("*"), validate.map( lambda e: (e.tag.replace("transcode_", ""), e.text) ), validate.transform(dict), ), "url": validate.xml_findtext("video_file_url") }), ] ), validate.optional("restrictions"): validate.xml_findtext(
# same directory as this plugin. from livestreamer.plugin.api.support_plugin import justintv_common JustinTVPluginBase = justintv_common.PluginBase JustinTVAPIBase = justintv_common.APIBase _url_re = re.compile(r"http(s)?://([\w\.]+)?justin.tv/[^/]+(/[bc]/\d+)?") _video_schema = validate.Schema( validate.union({ "archives": validate.all(validate.xml_findall("archive"), [ validate.union({ "length": validate.all( validate.xml_findtext("length"), validate.transform(int), ), "transcodes": validate.all( validate.xml_find("transcode_file_urls"), validate.xml_findall("*"), validate.map(lambda e: (e.tag.replace("transcode_", ""), e.text)), validate.transform(dict), ), "url": validate.xml_findtext("video_file_url") }), ]), validate.optional("restrictions"):
import re from time import time from livestreamer.plugin import Plugin, PluginError from livestreamer.plugin.api import http, validate from livestreamer.stream import RTMPStream, HLSStream SWF_URL = "http://play.streamingvideoprovider.com/player2.swf" API_URL = "http://player.webvideocore.net/index.php" _url_re = re.compile( "http(s)?://(\w+\.)?streamingvideoprovider.co.uk/(?P<channel>[^/&?]+)") _hls_re = re.compile("'(http://.+\.m3u8)'") _rtmp_schema = validate.Schema(validate.xml_findtext("./info/url"), validate.url(scheme="rtmp")) _hls_schema = validate.Schema( validate.transform(_hls_re.search), validate.any( None, validate.all( validate.get(1), validate.url(scheme="http", path=validate.endswith("m3u8"))))) class Streamingvideoprovider(Plugin): @classmethod def can_handle_url(self, url): return _url_re.match(url)