class NineAnime(Plugin): _episode_info_url = "http://9anime.to/ajax/episode/info" _info_schema = validate.Schema({ "grabber": validate.url(), "params": { "id": validate.text, "token": validate.text, "options": validate.text, } }) _streams_schema = validate.Schema({ "token": validate.text, "error": None, "data": [{ "label": validate.text, "file": validate.url(), "type": "mp4" }] }) _user_agent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) "\ "Chrome/36.0.1944.9 Safari/537.36" _url_re = re.compile(r"https?://9anime.to/watch/(?:[^.]+?\.)(\w+)/(\w+)") @classmethod def can_handle_url(cls, url): return cls._url_re.match(url) is not None def _get_streams(self): match = self._url_re.match(self.url) film_id, episode_id = match.groups() headers = {"Referer": self.url, "User-Agent": self._user_agent} # Get the info about the Episode, including the Grabber API URL info_res = http.get(self._episode_info_url, params=dict(update=0, film=film_id, id=episode_id), headers=headers) info = http.json(info_res, schema=self._info_schema) # Get the data about the streams from the Grabber API stream_list_res = http.get(info["grabber"], params=info["params"], headers=headers) stream_data = http.json(stream_list_res, schema=self._streams_schema) for stream in stream_data["data"]: yield stream["label"], HTTPStream(self.session, stream["file"])
class TV360(Plugin): url_re = re.compile(r"https?://(?:www.)?tv360.com.tr/CanliYayin") data_re = re.compile(r'''div.*?data-tp=(?P<q>["'])(?P<data>.*?)(?P=q)''', re.DOTALL) _js_to_json = partial(re.compile(r"""(\w+):(["']|\d+,|true|false)""").sub, r'"\1":\2') data_schema = validate.Schema( validate.transform(data_re.search), validate.any( None, validate.all( validate.get("data"), validate.transform(_js_to_json), validate.transform(lambda x: x.replace("'", '"')), validate.transform(parse_json), { "tp_type": "hls4", "tp_file": validate.url(), } ) ) ) @classmethod def can_handle_url(cls, url): return cls.url_re.match(url) is not None def _get_streams(self): res = http.get(self.url) data = self.data_schema.validate(res.text) if data: return HLSStream.parse_variant_playlist(self.session, data["tp_file"])
class TV8(Plugin): """ Support for the live stream on www.tv8.com.tr """ url_re = re.compile(r"https?://www.tv8.com.tr/canli-yayin") player_config_re = re.compile( r""" configPlayer.source.media.push[ ]*\( [ ]*\{[ ]*'src':[ ]*"(.*?)", [ ]*type:[ ]*"application/x-mpegURL"[ ]*}[ ]*\); """, re.VERBOSE) player_config_schema = validate.Schema( validate.transform(player_config_re.search), validate.any(None, validate.all(validate.get(1), validate.url()))) @classmethod def can_handle_url(cls, url): return cls.url_re.match(url) is not None def _get_streams(self): res = http.get(self.url) stream_url = self.player_config_schema.validate(res.text) if stream_url: return HLSStream.parse_variant_playlist(self.session, stream_url)
class TVPlayer(Plugin): _user_agent = ( "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/43.0.2357.65 Safari/537.36") API_URL = "http://api.tvplayer.com/api/v2/stream/live" _url_re = re.compile( r"https?://(?:www.)?tvplayer.com/(:?watch/?|watch/(.+)?)") _stream_attrs_ = re.compile( r'var\s+(validate|platform|resourceId)\s+=\s*(.*?);', re.S) _stream_schema = validate.Schema({ "tvplayer": validate.Schema({ "status": u'200 OK', "response": validate.Schema( {"stream": validate.url(scheme=validate.any("http"))}) }) }) @classmethod def can_handle_url(cls, url): match = TVPlayer._url_re.match(url) return match is not None def _get_streams(self): # find the list of channels from the html in the page self.url = self.url.replace("https", "http") # https redirects to http res = http.get(self.url, headers={"User-Agent": TVPlayer._user_agent}) stream_attrs = dict( (k, v.strip('"')) for k, v in TVPlayer._stream_attrs_.findall(res.text)) # get the stream urls res = http.post(TVPlayer.API_URL, data=dict(id=stream_attrs["resourceId"], validate=stream_attrs["validate"], platform=stream_attrs["platform"])) stream_data = http.json(res, schema=TVPlayer._stream_schema) return HLSStream.parse_variant_playlist( self.session, stream_data["tvplayer"]["response"]["stream"], headers={'user-agent': TVPlayer._user_agent})
class DingitTV(Plugin): """ Plugin that supports playing streams from DingIt.tv """ # regex to match the site urls url_re = re.compile(r""" http://www.dingit.tv/( highlight/(?P<highlight_id>\d+)| channel/(?P<broadcaster>\w+)/(?P<channel_id>\d+) )""", re.VERBOSE) # flashvars API url and schema flashvars_url = "http://www.dingit.tv/api/get_player_flashvars" flashvars_schema = validate.Schema({ u"status": 0, u"data": [{ validate.optional("stream"): validate.text, validate.optional("akaurl"): validate.text, validate.optional("pereakaurl"): validate.text, }] }, validate.get("data"), validate.length(1), validate.get(0) ) pereakaurl = "http://dingitmedia-vh.akamaihd.net/i/{}/master.m3u8" akaurl = "https://dingmedia1-a.akamaihd.net/processed/delivery/{}70f8b7bc-5ed4-336d-609a-2d2cd86288c6.m3u8" @classmethod def can_handle_url(cls, url): return cls.url_re.match(url) is not None def _get_streams(self): match = self.url_re.match(self.url) res = http.post(self.flashvars_url, data=dict( broadcaster=match.group("broadcaster") or "Verm", stream_id=match.group("channel_id") or match.group("highlight_id"))) flashvars = http.json(res, schema=self.flashvars_schema) if flashvars.get("pereakaurl"): url = self.pereakaurl.format(flashvars.get("pereakaurl").strip("/")) return HLSStream.parse_variant_playlist(self.session, url) elif flashvars.get("akaurl"): url = self.akaurl.format(flashvars.get("akaurl").strip("/")) return HLSStream.parse_variant_playlist(self.session, url) elif flashvars.get("stream"): self.logger.error("OctoStreams are not currently supported")
class WebTV(Plugin): _url_re = re.compile("http(?:s)?://(\w+)\.web.tv/?") _sources_re = re.compile(r'"sources": (\[.*?\]),', re.DOTALL) _sources_schema = validate.Schema([ { u"src": validate.text, u"type": validate.text, u"label": validate.text } ]) @classmethod def can_handle_url(cls, url): return cls._url_re.match(url) is not None def _get_streams(self): """ Find the streams for web.tv :return: """ headers = {} res = http.get(self.url, headers=headers) headers["Referer"] = self.url sources = self._sources_re.findall(res.text) if len(sources): sdata = parse_json(sources[0], schema=self._sources_schema) for source in sdata: self.logger.debug("Found stream of type: {}", source[u'type']) if source[u'type'] == u"application/vnd.apple.mpegurl": # if the url has no protocol, assume it is http url = source[u"src"] if url.startswith("//"): url = "http:" + url try: # try to parse the stream as a variant playlist variant = HLSStream.parse_variant_playlist(self.session, url, headers=headers) if variant: for q, s in variant.items(): yield q, s else: # and if that fails, try it as a plain HLS stream yield 'live', HLSStream(self.session, url, headers=headers) except IOError: self.logger.warning("Could not open the stream, perhaps the channel is offline")
class INE(Plugin): url_re = re.compile(r"""https://streaming.ine.com/play\#?/ ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/? (.+)?""", re.VERBOSE) play_url = "https://streaming.ine.com/play/{vid}/watch" js_re = re.compile(r'''script type="text/javascript" src="(https://content.jwplatform.com/players/.*?)"''') jwplayer_re = re.compile(r'''jwplayer\(".*?"\).setup\((\{.*\})\);''', re.DOTALL) setup_schema = validate.Schema( validate.transform(jwplayer_re.search), validate.any( None, validate.all( validate.get(1), validate.transform(json.loads), {"playlist": [ {"sources": [{"file": validate.text, "type": validate.text}]} ]} ) ) ) @classmethod def can_handle_url(cls, url): return cls.url_re.match(url) is not None def _get_streams(self): vid = self.url_re.match(self.url).group(1) self.logger.debug("Found video ID: {}", vid) page = http.get(self.play_url.format(vid=vid)) js_url_m = self.js_re.search(page.text) if js_url_m: js_url = js_url_m.group(1) self.logger.debug("Loading player JS: {}", js_url) res = http.get(js_url) data = self.setup_schema.validate(res.text) for source in data["playlist"][0]["sources"]: if source["type"] == "hls": return HLSStream.parse_variant_playlist(self.session, "https:" + source["file"])
class Turkuvaz(Plugin): """ Plugin to support ATV/A2TV Live streams from www.atv.com.tr and www.a2tv.com.tr """ _url_re = re.compile( r"""https?://(?:www.)? (?: (atv|a2tv|ahaber|aspor|minikago|minikacocuk).com.tr/webtv/canli-yayin| (atvavrupa).tv/webtv/videoizle/atv_avrupa/canli_yayin )""", re.VERBOSE) _hls_url = "http://trkvz-live.ercdn.net/{channel}/{channel}.m3u8" _token_url = "http://videotoken.tmgrup.com.tr/webtv/secure" _token_schema = validate.Schema( validate.all({ "Success": True, "Url": validate.url(), }, validate.get("Url"))) @classmethod def can_handle_url(cls, url): return cls._url_re.match(url) is not None def _get_streams(self): url_m = self._url_re.match(self.url) domain = url_m.group(1) or url_m.group(2) # remap the domain to channel channel = { "atv": "atvhd", "ahaber": "ahaberhd", "aspor": "asporhd" }.get(domain, domain) hls_url = self._hls_url.format(channel=channel) # get the secure HLS URL res = http.get(self._token_url, params={"url": hls_url}) secure_hls_url = http.json(res, schema=self._token_schema) return HLSStream.parse_variant_playlist(self.session, secure_hls_url)
class LiveMe(Plugin): url_re = re.compile(r"https?://(www.)?liveme.com/media/play/(.*)") api_url = "http://live.ksmobile.net/live/queryinfo?userid=1&videoid={id}" api_schema = validate.Schema( validate.all( { "status": "200", "data": { "video_info": { "videosource": validate.any('', validate.url()), "hlsvideosource": validate.any('', validate.url()), } } }, validate.get("data"))) @classmethod def can_handle_url(cls, url): return cls.url_re.match(url) is not None def _make_stream(self, url): if url and url.endswith("flv"): return HTTPStream(self.session, url) elif url and url.endswith("m3u8"): return HLSStream(self.session, url) def _get_streams(self): url_params = dict(parse_qsl(urlparse(self.url).query)) video_id = url_params.get("videoid") if video_id: self.logger.debug("Found Video ID: {}", video_id) res = http.get(self.api_url.format(id=video_id)) data = http.json(res, schema=self.api_schema) hls = self._make_stream(data["video_info"]["hlsvideosource"]) video = self._make_stream(data["video_info"]["videosource"]) if hls: yield "live", hls if video: yield "live", video
class CinerGroup(Plugin): """ Support for the live stream on www.showtv.com.tr """ url_re = re.compile( r"""https?://(?:www.)? (?: showtv.com.tr/canli-yayin/showtv| haberturk.com/canliyayin| showmax.com.tr/canliyayin| showturk.com.tr/canli-yayin/showturk| bloomberght.com/tv| haberturk.tv/canliyayin )/?""", re.VERBOSE) stream_re = re.compile( r"""div .*? data-ht=(?P<quote>["'])(?P<data>.*?)(?P=quote)""", re.DOTALL) stream_data_schema = validate.Schema( validate.transform(stream_re.search), validate.any( None, validate.all( validate.get("data"), validate.transform(unquote), validate.transform(lambda x: x.replace(""", '"')), validate.transform(json.loads), {"ht_stream_m3u8": validate.url()}, validate.get("ht_stream_m3u8")))) @classmethod def can_handle_url(cls, url): return cls.url_re.match(url) is not None def _get_streams(self): res = http.get(self.url) stream_url = self.stream_data_schema.validate(res.text) if stream_url: return HLSStream.parse_variant_playlist(self.session, stream_url)
class PowerApp(Plugin): url_re = re.compile(r"https?://(?:www.)?powerapp.com.tr/tv/(\w+)") api_url = "http://api.powergroup.com.tr/Channels/{}/?appRef=iPowerWeb&apiVersion=11" api_schema = validate.Schema( validate.all( { "errorCode": 0, "response": { "channel_stream_url": validate.url() } }, validate.get("response"))) @classmethod def can_handle_url(cls, url): return cls.url_re.match(url) is not None def _get_streams(self): channel = self.url_re.match(self.url).group(1) res = http.get(self.api_url.format(channel)) data = http.json(res, schema=self.api_schema) return HLSStream.parse_variant_playlist(self.session, data["channel_stream_url"])
parser = HTMLParser() return parser.unescape(s) _url_re = re.compile(r"https?://(?:www\.)?vidio\.com/(?P<type>live|watch)/(?P<id>\d+)-(?P<name>[^/?#&]+)") _clipdata_re = re.compile(r"""data-json-clips\s*=\s*(['"])(.*?)\1""") _schema = validate.Schema( validate.transform(_clipdata_re.search), validate.any( None, validate.all( validate.get(2), validate.transform(html_unescape), validate.transform(parse_json), [{ "sources": [{ "file": validate.url( scheme="http", path=validate.endswith(".m3u8") ) }] }] ) ) ) class Vidio(Plugin): @classmethod def can_handle_url(cls, url): return _url_re.match(url)
class AdultSwim(Plugin): _user_agent = ( "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/43.0.2357.65 Safari/537.36") API_URL = "http://www.adultswim.com/videos/api/v2/videos/{id}?fields=stream" _url_re = re.compile(r"http://www\.adultswim\.com/videos/streams/(.*)") _stream_data_re = re.compile(r".*AS_INITIAL_DATA = (\{.*?});.*", re.M | re.DOTALL) _page_data_schema = validate.Schema( {u"streams": { validate.text: { u"stream": validate.text } }}) _api_schema = validate.Schema({ u'status': u'ok', u'data': { u'stream': { u'assets': [{ u'url': validate.url() }] } } }) @classmethod def can_handle_url(cls, url): match = AdultSwim._url_re.match(url) return match is not None def _get_streams(self): # get the page res = http.get(self.url, headers={"User-Agent": self._user_agent}) # find the big blob of stream info in the page stream_data = self._stream_data_re.match(res.text) stream_name = AdultSwim._url_re.match( self.url).group(1) or "live-stream" if stream_data: # parse the stream info as json stream_info = parse_json(stream_data.group(1), schema=self._page_data_schema) # get the stream ID stream_id = stream_info[u"streams"][stream_name][u"stream"] if stream_id: api_url = self.API_URL.format(id=stream_id) res = http.get(api_url, headers={"User-Agent": self._user_agent}) stream_data = http.json(res, schema=self._api_schema) for asset in stream_data[u'data'][u'stream'][u'assets']: for n, s in HLSStream.parse_variant_playlist( self.session, asset[u"url"]).items(): yield n, s else: self.logger.error( "Couldn't find the stream ID for this stream: {}".format( stream_name)) else: self.logger.error( "Couldn't find the stream data for this stream: {}".format( stream_name))
)? (?: /video/\d+/[^/]+ )? """, re.VERBOSE) _file_re = re.compile("\"?file\"?:\s+['\"]([^'\"]+)['\"]") _swf_url_re = re.compile("swfobject.embedSWF\(\"([^\"]+)\",") _schema = validate.Schema( validate.union({ "urls": validate.all(validate.transform(_file_re.findall), validate.map(unquote), [validate.url()]), "swf": validate.all( validate.transform(_swf_url_re.search), validate.any( None, validate.all( validate.get(1), validate.url(scheme="http", path=validate.endswith("swf"))))) })) class Aliez(Plugin): @classmethod def can_handle_url(self, url): return _url_re.match(url) def _get_streams(self):
_url_re = re.compile( "http(s)?://(\w+\.)?weeb.tv/(channel|online)/(?P<channel>[^/&?]+)") _schema = validate.Schema( dict, validate.map(lambda k, v: (PARAMS_KEY_MAP.get(k, k), v)), validate.any( { "status": validate.transform(int), "rtmp": validate.url(scheme="rtmp"), "playpath": validate.text, "multibitrate": validate.all(validate.transform(int), validate.transform(bool)), "block_type": validate.transform(int), validate.optional("token"): validate.text, validate.optional("block_time"): validate.text, validate.optional("reconnect_time"): validate.text, }, { "status": validate.transform(int), }, )) class Weeb(Plugin):
#-plugin-sig:ndEiyRW3P8MfPorpHFFSH2O2CRPRvepIW9hNPMAUB94OXs//5NgB2pw9lVxgHr4o2YUj7M3wtnAG9Ws7KEVRVq6vd+cjAJyWDaKmOAA/VdVbPGrLRTwJaTucHPGogJ0xcNDm/huGb+6ExZ71IN5zAFcI9Ko03xU9mgd/gp5fKTWS3I00ESjXkEkCs05tkqk4IzhfZbIZIrRpM28XOycKQxgc9Ot4Kq2npHByj4E0XGn+X9QoOdc/5uqQ0VrJUSVdxq47V+Zc2pI1FBK87Z1hktEKAx8bESXzKTvFnJUcNLuJHUxutXrwNH4MKVroxpap7wZUc7a/YplEOQXPRRpdJA== import re from ACEStream.PluginsContainer.livestreamer.plugin import Plugin from ACEStream.PluginsContainer.livestreamer.plugin.api import http, validate from ACEStream.PluginsContainer.livestreamer.stream import HLSStream _url_re = re.compile("http(s)?://(www\.)?openrec.tv/(live|movie)/[^/?&]+") _playlist_url_re = re.compile("data-file=\"(?P<url>[^\"]+)\"") _schema = validate.Schema( validate.transform(_playlist_url_re.search), validate.any( None, validate.all( validate.get("url"), validate.url( scheme="http", path=validate.endswith(".m3u8") ) ) ) ) class OPENRECtv(Plugin): @classmethod def can_handle_url(self, url): return _url_re.match(url) def _get_streams(self): playlist_url = http.get(self.url, schema=_schema) if not playlist_url:
from ACEStream.PluginsContainer.livestreamer.plugin import Plugin from ACEStream.PluginsContainer.livestreamer.plugin.api import http, validate from ACEStream.PluginsContainer.livestreamer.stream import RTMPStream, HLSStream STREAMS_URL = "https://piczel.tv:3000/streams/{0}?&page=1&sfw=false&live_only=true" HLS_URL = "https://5810b93fdf674.streamlock.net:1936/live/{0}/playlist.m3u8" RTMP_URL = "rtmp://piczel.tv:1935/live/{0}" _url_re = re.compile("https://piczel.tv/watch/(\w+)") _streams_schema = validate.Schema({ "type": validate.text, "data": [{ "id": int, "live": bool, "slug": validate.text }] }) class Piczel(Plugin): @classmethod def can_handle_url(cls, url): return _url_re.match(url) def _get_streams(self): match = _url_re.match(self.url) if not match: return
#!/usr/bin/env python #-plugin-sig:j5IvF8YBcLoDm+PQagnwUnnyhIUaeWtb571lPo8bfkQ6gjvBdfOaKbEHp/GyEby4t6Kkj4C+ZyJ66jEdVSHvAFFCMjQkDcWRnwNrq0MkM00umifbqh2QzrftiDZbGiTzcqCue3gWenHU3E6NUmLxbbY/wYrpSM4Is0cf358kJ3PcDgyoIEibqxxV4feJCu0/95GWxQJ7OILfqTs15+nhGYkgDtWNHAD55jxq7BKIwFI/J5otPp094RW7gY3oThv8xagrn0OIVf9J75Nyha8rebWRoE9cHYaC6urzD3ji9H7P1v6DNaRTlkk5cmasUP8b1y/Y35eEUe9hiwtnw2HeRQ== import re from ACEStream.PluginsContainer.livestreamer.plugin import Plugin from ACEStream.PluginsContainer.livestreamer.plugin.api import http from ACEStream.PluginsContainer.livestreamer.stream import HLSStream from ACEStream.PluginsContainer.livestreamer.plugin.api import validate STREAM_INFO_URL = "http://dinamics.ccma.cat/pvideo/media.jsp?media=video&version=0s&idint={ident}&profile=pc&desplacament=0" _url_re = re.compile(r"http://(?:www.)?ccma.cat/tv3/directe/(.+?)/") _media_schema = validate.Schema({ "geo": validate.text, "url": validate.url(scheme=validate.any("http")) }) _channel_schema = validate.Schema({ "media": validate.any([_media_schema], _media_schema) }) class TV3Cat(Plugin): @classmethod def can_handle_url(self, url): match = _url_re.match(url) return match def _get_streams(self): match = _url_re.match(self.url) if match: ident = match.group(1)
_url_re = re.compile("http(s)?://(\w+\.)?ssh101\.com/") _live_re = re.compile(""" \s*jwplayer\(\"player\"\)\.setup\({.*? \s*primary:\s+"([^"]+)".*? \s*file:\s+"([^"]+)" """, re.DOTALL) _live_schema = validate.Schema( validate.transform(_live_re.search), validate.any( None, validate.union({ "type": validate.get(1), "url": validate.all( validate.get(2), validate.url(scheme="http"), ), }) ) ) class SSH101(Plugin): @classmethod def can_handle_url(self, url): return _url_re.match(url) def _get_streams(self): res = http.get(self.url, schema=_live_schema) if not res:
_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 def can_handle_url(cls, url): return _url_re.match(url)
(?: /videos/(?P<video_id>\d+) )? (?: /(?P<channel>[^/&?]+) )? """, re.VERBOSE) _playlist_schema = validate.Schema( validate.union({ "base": validate.all(validate.xml_find("./head/meta"), validate.get("base"), validate.url(scheme="rtmp")), "videos": validate.all(validate.xml_findall(".//video"), [ validate.union({ "src": validate.all(validate.get("src"), validate.text), "height": validate.all(validate.get("height"), validate.text, validate.transform(int)) }) ]) })) class Cybergame(Plugin): @classmethod def can_handle_url(cls, url): return _url_re.match(url) def _get_playlist(self, **params):
from ACEStream.PluginsContainer.livestreamer.plugin.api.utils import parse_json from ACEStream.PluginsContainer.livestreamer.plugin.api.support_plugin import viasat STREAM_API_URL = "http://playapi.mtgx.tv/v3/videos/stream/{0}" _embed_url_re = re.compile( '<meta itemprop="embedURL" content="http://www.viagame.com/embed/video/([^"]+)"' ) _store_data_re = re.compile("window.fluxData\s*=\s*JSON.parse\(\"(.+)\"\);") _url_re = re.compile("http(s)?://(www\.)?viagame.com/channels/.+") _store_schema = validate.Schema( { "initialStoresData": [{ "instanceName": validate.text, "storeName": validate.text, "initialData": validate.any(dict, list) }] }, validate.get("initialStoresData") ) _match_store_schema = validate.Schema( { "match": { "id": validate.text, "type": validate.text, "videos": [{ "id": validate.text, "play_id": validate.text, }] } },
_time_re = re.compile( """ (?: (?P<hours>\d+)h )? (?: (?P<minutes>\d+)m )? (?: (?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({
from ACEStream.PluginsContainer.livestreamer.plugin.api import http, validate from ACEStream.PluginsContainer.livestreamer.stream import HTTPStream, HDSStream, RTMPStream MEDIA_URL = "http://www.ardmediathek.de/play/media/{0}" SWF_URL = "http://www.ardmediathek.de/ard/static/player/base/flash/PluginFlash.swf" HDCORE_PARAMETER = "?hdcore=3.3.0" QUALITY_MAP = {"auto": "auto", 3: "544p", 2: "360p", 1: "288p", 0: "144p"} _url_re = re.compile("http(s)?://(\w+\.)?ardmediathek.de/tv") _media_id_re = re.compile("/play/config/(\d+)") _media_schema = validate.Schema({ "_mediaArray": [{ "_mediaStreamArray": [{ validate.optional("_server"): validate.text, "_stream": validate.any(validate.text, [validate.text]), "_quality": validate.any(int, validate.text) }] }] }) _smil_schema = validate.Schema( validate.union({ "base": validate.all(validate.xml_find("head/meta"), validate.get("base"), validate.url(scheme="http")), "videos": validate.all(validate.xml_findall("body/seq/video"), [validate.get("src")]) }))
CHANNEL_INFO_URL = "http://api.plu.cn/tga/streams/%s" QQ_STREAM_INFO_URL = "http://info.zb.qq.com/?cnlid=%d&cmd=2&stream=%d&system=1&sdtfrom=113" PLU_STREAM_INFO_URL = "http://star.api.plu.cn/live/GetLiveUrl?roomId=%d" _quality_re = re.compile("\d+x(\d+)$") _url_re = re.compile( "http://star\.longzhu\.(?:tv|com)/(m\/)?(?P<domain>[a-z0-9]+)") _channel_schema = validate.Schema( { "data": validate.any( None, { "channel": validate.any( None, { "id": validate.all(validate.text, validate.transform(int)), "vid": int }) }) }, validate.get("data")) _plu_schema = validate.Schema({ "urls": [{ "securityUrl": validate.url(scheme=validate.any("rtmp", "http")), "resolution": validate.text, "ext": validate.text }] })
HD_URL_PATTERN = "http://pl{0}.live.panda.tv/live_panda/{1}_mid.flv" # I don't know ordinary-definition url pattern, sorry for ignore it. OD_URL_PATTERN = "http://pl{0}.live.panda.tv/live_panda/{1}_mid.flv" _url_re = re.compile("http(s)?://(\w+.)?panda.tv/(?P<channel>[^/&?]+)") _room_schema = validate.Schema( { "data": validate.any( validate.text, dict, { "videoinfo": validate.any( validate.text, { "room_key": validate.text, "plflag": validate.text, "status": validate.text, "stream_addr": { "HD": validate.text, "OD": validate.text, "SD": validate.text } }) }) }, validate.get("data")) class pandatv(Plugin): @classmethod def can_handle_url(self, url): return _url_re.match(url)
SHOW_STATUS_ONLINE = 1 SHOW_STATUS_OFFLINE = 2 STREAM_WEIGHTS = {"low": 540, "middle": 720, "source": 1080} _url_re = re.compile( """ http(s)?://(www\.)?douyu.com /(?P<channel>[^/]+) """, re.VERBOSE) _room_id_re = re.compile(r'"room_id"\s*:\s*(\d+),') _room_id_alt_re = re.compile(r'data-room_id="(\d+)"') _room_id_schema = validate.Schema( validate.all( validate.transform(_room_id_re.search), validate.any(None, validate.all(validate.get(1), validate.transform(int))))) _room_id_alt_schema = validate.Schema( validate.all( validate.transform(_room_id_alt_re.search), validate.any(None, validate.all(validate.get(1), validate.transform(int))))) _room_schema = validate.Schema( { "data": validate.any(None, { "show_status": validate.all(validate.text, validate.transform(int))
)? ) """, re.VERBOSE) _channels_schema = validate.Schema( { "Data": [{ "Slug": validate.text, "StreamingServers": 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": [{
""", re.VERBOSE) _url_re = re.compile( """ 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
(?: tv4play.se/program/[^\?/]+| fotbollskanalen.se/video ) .+(video_id|videoid)=(?P<video_id>\d+) """, re.VERBOSE) _asset_schema = validate.Schema( validate.xml_findall("items/item"), [ validate.all( validate.xml_findall("*"), validate.map(lambda e: (e.tag, e.text)), validate.transform(dict), { "base": validate.text, "bitrate": validate.all( validate.text, validate.transform(int) ), "url": validate.text } ) ] ) class TV4Play(Plugin): @classmethod def can_handle_url(cls, url): return _url_re.match(url)