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 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 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)
_channel_schema = validate.Schema( { validate.optional("state"): { "stream": { "qualities": [validate.text], "rootUrl": validate.url(scheme="rtmp") } } }, validate.get("state")) _vod_schema = validate.Schema( { "name": validate.text, "channel_slug": validate.text, "title": validate.text, "created_at": validate.transform(int) }, ) class GamingLive(Plugin): @classmethod def can_handle_url(self, url): return _url_re.match(url) @classmethod def stream_weight(cls, key): weight = QUALITY_WEIGHTS.get(key) if weight: return weight, "gaminglive" return Plugin.stream_weight(key)
scheme="http", path=validate.endswith(".m3u8") ), validate.optional("video_encode_id"): validate.text }] ) } ) }, validate.get("stream_data") ) _login_schema = validate.Schema({ "auth": validate.text, "expires": validate.all( validate.text, validate.transform(parse_timestamp) ), "user": { "username": validate.any(validate.text, None), "email": validate.text } }) _session_schema = validate.Schema( { "session_id": validate.text }, validate.get("session_id") ) class CrunchyrollAPIError(Exception):
_quality_re = re.compile("(\d+p)$") _url_re = re.compile( """ http(s)?://(www\.)?hitbox.tv /(?P<channel>[^/]+) (?: /(?P<media_id>[^/]+) )? """, re.VERBOSE) _live_schema = validate.Schema( { "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,
#-plugin-sig:aavGbgu25BH3tVqGAcLbnkvxoEd3w5BCl8DSx+1DnYg1Uc7gmHVfcBk11uJUqv4DT/MrleczvIlhXNcfrZY6svb4JAGptIzelQrxXrBUUyqnmA7LIByGFWurfVPLTrKv1NWWmurdO6O5IRFf675L3boLPajwpjzkSpJwtR44wl5+SfZ45I9Gr25Aq6VQC1qU7A1qSW9JhTSMcj9uFQ4JEC1AZQtlcuhnP1/Iwz4jjhMziIm2+RGTV2xBcbKI2YNWqsLRlqtT9sT099Eh28iiALeXmvyC5zvXaPvf0Rgz39b7kvSwL9ZAlt0TZwSk741Fg+j6x+9IWL06XgWkHcgUZg== import re from functools import partial from ACEStream.PluginsContainer.livestreamer.plugin.api import validate from ACEStream.PluginsContainer.livestreamer.plugin.api.utils import parse_json __all__ = ["parse_playlist"] _playlist_re = re.compile("\(?\{.*playlist: (\[.*\]),.*?\}\)?;", re.DOTALL) _js_to_json = partial(re.compile("(\w+):\s").sub, r'"\1":') _playlist_schema = validate.Schema( validate.transform(_playlist_re.search), validate.any( None, validate.all(validate.get(1), validate.transform(_js_to_json), validate.transform(parse_json), [{ "sources": [{ "file": validate.text, validate.optional("label"): validate.text }] }]))) def parse_playlist(res): """Attempts to parse a JWPlayer playlist in a HTTP response body.""" return _playlist_schema.validate(res.text)
#-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:
import re from ACEStream.PluginsContainer.livestreamer.compat import urlparse from ACEStream.PluginsContainer.livestreamer.plugin import Plugin from ACEStream.PluginsContainer.livestreamer.plugin.api import http, validate from ACEStream.PluginsContainer.livestreamer.stream import HLSStream, HTTPStream _url_re = re.compile("http(s)?://(\w+\.)?seemeplay.ru/") _player_re = re.compile( """ SMP.(channel|video).player.init\({ \s+file:\s+"([^"]+)" """, re.VERBOSE) _schema = validate.Schema( validate.transform(_player_re.search), validate.any( None, validate.union({ "type": validate.get(1), "url": validate.all( validate.get(2), validate.url(scheme="http"), ), }))) class SeeMePlay(Plugin): @classmethod
from ACEStream.PluginsContainer.livestreamer.stream import HLSStream try: from HTMLParser import HTMLParser except ImportError: from html.parser import HTMLParser def html_unescape(s): 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") ) }] }] )
#-plugin-sig:ImuwcdTcKXfitHRLTEfiZUWj79efIUTrEK4a/dFtqczZHpRVneotL2YNH+KuQXQVuNgZreqzRB8TVooCpzT4FCzr60RvBwJ5ov+o501y5cxMmffcTqJwXXvG1ay3cbbQYqL1h8Py5xGg/+6j5USNTbMpd+CyLcjeteBVJOjUbhV3MKPdFsplu8Aze4yEhhGOvl0oyPQ8eirhf3Ynum9yq8tayg+GhKH4NqDgOpjjS9yCN62FS7f/h39PInN1hfSwZ7/wAXj6FjqCacRCaIWmY0IFneirSgDHCdrj90O6+XdoSqhPhcYlUITkpLGggcY4dMC4/tckfe1TfEqTxyC7ag== import re from ACEStream.PluginsContainer.livestreamer.plugin import Plugin, PluginError, PluginOptions from ACEStream.PluginsContainer.livestreamer.plugin.api import http, validate from ACEStream.PluginsContainer.livestreamer.stream import HLSStream LOGIN_PAGE_URL = "http://www.livestation.com/en/users/new" LOGIN_POST_URL = "http://www.livestation.com/en/sessions.json" _csrf_token_re = re.compile("<meta content=\"([^\"]+)\" name=\"csrf-token\"") _hls_playlist_re = re.compile( "<meta content=\"([^\"]+.m3u8)\" property=\"og:video\" />") _url_re = re.compile("http(s)?://(\w+\.)?livestation.com") _csrf_token_schema = validate.Schema(validate.transform(_csrf_token_re.search), validate.any(None, validate.get(1))) _hls_playlist_schema = validate.Schema( validate.transform(_hls_playlist_re.search), validate.any( None, validate.all( validate.get(1), validate.url(scheme="http", path=validate.endswith(".m3u8"))))) _login_schema = validate.Schema({ "email": validate.text, validate.optional("errors"): validate.all( {"base": [validate.text]}, validate.get("base"),
_rtmp_re = re.compile("/(?P<app>[^/]+)/(?P<playpath>.+)") def _parse_server_ip(values): octets = [ values["a"] / values["f"], values["b"] / values["f"], values["c"] / values["f"], values["d"] / values["f"], ] return ".".join(str(int(octet)) for octet in octets) _schema = validate.Schema( validate.transform(_js_var_re.findall), validate.transform(dict), { "a": validate.transform(int), "b": validate.transform(int), "c": validate.transform(int), "d": validate.transform(int), "f": validate.transform(int), "v_part": validate.text, }, validate.union({ "server_ip": validate.transform(_parse_server_ip), "path": validate.all(validate.get("v_part"), validate.transform(_rtmp_re.findall), validate.get(0)) }))
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) streams = {} for (name, parser), url in urls.items():
VIEW_LIVE_API_URL = "http://api.afreeca.tv/live/view_live.php" VIEW_LIVE_API_URL_TW = "http://api.afreecatv.com.tw/live/view_live.php" VIEW_LIVE_API_URL_JP = "http://api.afreecatv.jp/live/view_live.php" _url_re = re.compile( "http(s)?://(\w+\.)?(afreecatv.com.tw|afreeca.tv|afreecatv.jp)/(?P<channel>[\w\-_]+)" ) _url_re_tw = re.compile( "http(s)?://(\w+\.)?(afreecatv.com.tw)/(?P<channel>[\w\-_]+)") _url_re_jp = re.compile( "http(s)?://(\w+\.)?(afreecatv.jp)/(?P<channel>[\w\-_]+)") _flashvars_re = re.compile('<param name="flashvars" value="([^"]+)" />') _flashvars_schema = validate.Schema( validate.transform(_flashvars_re.findall), validate.get(0), validate.transform(parse_query), validate.any({ "s": validate.text, "id": validate.text }, {})) _view_live_schema = validate.Schema( { "channel": { "strm": [{ "bps": validate.text, "purl": validate.url(scheme="rtmp") }] }, }, validate.get("channel"), validate.get("strm"))
import re from itertools import chain from ACEStream.PluginsContainer.livestreamer.compat import urlparse from ACEStream.PluginsContainer.livestreamer.plugin import Plugin from ACEStream.PluginsContainer.livestreamer.plugin.api import http, validate from ACEStream.PluginsContainer.livestreamer.stream import HLSStream, HTTPStream, RTMPStream SWF_URL = "http://www.arte.tv/player/v2/jwplayer6/mediaplayer.6.6.swf" _url_re = re.compile("http(s)?://(\w+\.)?arte.tv/") _json_re = re.compile("arte_vp_(?:live-)?url=(['\"])(.+?)\\1") _schema = validate.Schema( validate.transform(_json_re.search), validate.any(None, validate.all(validate.get(2), validate.url(scheme="http")))) _video_schema = validate.Schema({ "videoJsonPlayer": { "VSR": validate.any( [], { validate.text: { "height": int, "mediaType": validate.text, "url": validate.text, validate.optional("streamer"): validate.text }, },
STREAM_INFO_URLS = { "rtmp": "http://sessionmanager01.afreeca.tv:6060/broad_stream_assign.html", "hls": "http://resourcemanager.afreeca.tv:9090/broad_stream_assign.html" } HLS_KEY_URL = "http://api.m.afreeca.com/broad/a/watch" CHANNEL_RESULT_ERROR = 0 CHANNEL_RESULT_OK = 1 _url_re = re.compile( "http(s)?://(\w+\.)?afreeca(tv)?.com/(?P<username>\w+)(/\d+)?") _channel_schema = validate.Schema( { "CHANNEL": { "RESULT": validate.transform(int), "BROAD_INFOS": [{ "list": [{ "nBroadNo": validate.text }] }] } }, validate.get("CHANNEL")) _stream_schema = validate.Schema({ validate.optional("view_url"): validate.url(scheme=validate.any("rtmp", "http")) }) class AfreecaTV(Plugin): @classmethod
"vaughnlive": "live", } _url_re = re.compile( """ http(s)?://(\w+\.)? (?P<domain>vaughnlive|breakers|instagib|vapers).tv (/embed/video)? /(?P<channel>[^/&?]+) """, re.VERBOSE) _swf_player_re = re.compile( 'swfobject.embedSWF\("(/\d+/swf/[0-9A-Za-z]+\.swf)"') _schema = validate.Schema( validate.transform(lambda s: s.split(";")), validate.length(3), validate.union({ "server": validate.all(validate.get(0), validate.text), "token": validate.all(validate.get(1), validate.text, validate.startswith(":mvnkey-"), validate.transform(lambda s: s[len(":mvnkey-"):])), "ingest": validate.all(validate.get(2), validate.text) })) class VaughnLive(Plugin): @classmethod def can_handle_url(cls, url):
#-plugin-sig:nxKn3qSj3u8dietuDnQprLMbaEPyi7iXLY5o2MQ2rz2c4pO9VTE181iaeM2VJlhmSRcdyjumUYca2AfQ6srq75V0/0VJCJXHmzjBfJYvslXQLWYyoLqre1S1vd2IRe1KIo3cOEiLs8m9ai0lQ7Iq5aeGyl/ZGaOUxzy3lk9dIR1Zpc6+ZZIIM2pySSs1CPmNpL/9VHGLXO+n1bVGfHb6mZ9oCM2b7iwge72TEk5gAV4xi8x7zPbJe4wokwv/cOB9p3vXcRBUTSR07MzLk8ogcMmoD3UpgeCg3OlzFiQV0wLknXQHplYKAPloua7/ATzz+TIjsVWAeGPRuOVUUzMcVg== import re from ACEStream.PluginsContainer.livestreamer.compat import urlparse from ACEStream.PluginsContainer.livestreamer.plugin import Plugin from ACEStream.PluginsContainer.livestreamer.plugin.api import StreamMapper, http, validate from ACEStream.PluginsContainer.livestreamer.stream import HLSStream, RTMPStream CHANNEL_URL = "http://www.mobileonline.tv/channel.php" _url_re = re.compile("http(s)?://(\w+\.)?(ilive.to|streamlive.to)/.*/(?P<channel>\d+)") _link_re = re.compile("<a href=(\S+) target=\"_blank\"") _schema = validate.Schema( validate.transform(_link_re.findall), ) class StreamLive(Plugin): @classmethod def can_handle_url(self, url): return _url_re.match(url) def _create_hls_streams(self, url): try: streams = HLSStream.parse_variant_playlist(self.session, url) return streams.items() except IOError as err: self.logger.warning("Failed to extract HLS streams: {0}", err) def _create_rtmp_stream(self, url): parsed = urlparse(url)
_history_re = re.compile( "helpers.common.flash.flashplayerinstall\({url:'([^']+)',") _video_flashvars_re = re.compile( "<embed width=\"486\" height=\"326\" flashvars=\"([^\"]+)\"") _live_schema = validate.Schema({ "streams": [{ "name": validate.text, "quality": validate.text, "url": validate.url(scheme="rtmp") }] }) _schema = validate.Schema( validate.union({ "export_url": validate.all(validate.transform(_live_export_re.search), validate.any( None, validate.get(1), )), "video_flashvars": validate.all( validate.transform(_video_flashvars_re.search), validate.any( None, validate.all( validate.get(1), validate.transform(parse_query), { "_111pix_serverURL": validate.url(scheme="rtmp"), "en_flash_providerName": validate.text }))), "history_video":
_url_re = re.compile(""" http(s)?://(www\.)? (?: 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):
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 }] }) _qq_schema = validate.Schema( {validate.optional("playurl"): validate.url(scheme="http")},
from ACEStream.PluginsContainer.livestreamer.compat import urlparse 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)?://(\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):
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))
"73": "token" } BLOCKED_MSG_FORMAT = ( "You have crossed the free viewing limit. You have been blocked for " "{0} minutes. Try again in {1} minutes") BLOCK_TYPE_VIEWING_LIMIT = 1 BLOCK_TYPE_NO_SLOTS = 11 _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, },
from ACEStream.PluginsContainer.livestreamer.plugin import Plugin from ACEStream.PluginsContainer.livestreamer.plugin.api import http, validate from ACEStream.PluginsContainer.livestreamer.plugin.api.utils import parse_query from ACEStream.PluginsContainer.livestreamer.stream import RTMPStream BALANCER_URL = "http://www.mips.tv:1935/loadbalancer" PLAYER_URL = "http://mips.tv/embedplayer/{0}/1/500/400" SWF_URL = "http://mips.tv/content/scripts/eplayer.swf" _url_re = re.compile("http(s)?://(\w+.)?mips.tv/(?P<channel>[^/&?]+)") _flashvars_re = re.compile("'FlashVars', '([^']+)'") _rtmp_re = re.compile("redirect=(.+)") _schema = validate.Schema( validate.transform(_flashvars_re.search), validate.any( None, validate.all( validate.get(1), validate.transform(parse_query), { "id": validate.transform(int), validate.optional("s"): validate.text } ) ) ) _rtmp_schema = validate.Schema( validate.transform(_rtmp_re.search), validate.get(1),
validate.xml_element(attrib={ "content": validate.text }), validate.get("content") ), "videos": validate.all( validate.xml_findall("{http://www.w3.org/2001/SMIL20/Language}body/" "{http://www.w3.org/2001/SMIL20/Language}switch/" "{http://www.w3.org/2001/SMIL20/Language}video"), [ validate.all( validate.xml_element(attrib={ "src": validate.text, "system-bitrate": validate.all( validate.text, validate.transform(int) ) }), validate.transform( lambda e: (e.attrib["src"], e.attrib["system-bitrate"]) ) ) ], ) })) class Livestream(Plugin): @classmethod def default_stream_types(cls, streams): return ["akamaihd", "hls"]
from ACEStream.PluginsContainer.livestreamer.compat import urljoin from ACEStream.PluginsContainer.livestreamer.plugin import Plugin from ACEStream.PluginsContainer.livestreamer.plugin.api import http, validate from ACEStream.PluginsContainer.livestreamer.stream import HLSStream COOKIE_PARAMS = ("devicetype=desktop&" "preferred-player-odm=hlslink&" "preferred-player-live=hlslink") _id_re = re.compile("/(?:program|direkte|serie/[^/]+)/([^/]+)") _url_re = re.compile("https?://(tv|radio).nrk.no/") _api_baseurl_re = re.compile('apiBaseUrl:\s*"(?P<baseurl>[^"]+)"') _schema = validate.Schema( validate.transform(_api_baseurl_re.search), validate.any( None, validate.all(validate.get("baseurl"), validate.url(scheme="http")))) _mediaelement_schema = validate.Schema( {"mediaUrl": validate.url(scheme="http", path=validate.endswith(".m3u8"))}) class NRK(Plugin): @classmethod def can_handle_url(self, url): return _url_re.match(url) def _get_streams(self): # Get the stream type from the url (tv/radio).
""" http(s)?://(\w+\.)?aliez.tv (?: /live/[^/]+ )? (?: /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 parse_fmt_list(formatsmap): formats = {} if not formatsmap: return formats for format in formatsmap.split(","): s = format.split("/") (w, h) = s[1].split("x") formats[int(s[0])] = "{0}p".format(h) return formats _config_schema = validate.Schema({ validate.optional("fmt_list"): validate.all(validate.text, validate.transform(parse_fmt_list)), validate.optional("url_encoded_fmt_stream_map"): validate.all(validate.text, validate.transform(parse_stream_map), [{ "itag": validate.all(validate.text, validate.transform(int)), "quality": validate.text, "url": validate.url(scheme="http"), validate.optional("s"): validate.text, validate.optional("stereo3d"): validate.all(validate.text, validate.transform(int), validate.transform(bool)), }]), validate.optional("adaptive_fmts"):