def _get_live_streams(self): stream_id = _id_map[self.channel_path] if stream_id == "ruv": qualities_rtmp = ["720p", "480p", "360p", "240p"] for i, quality in enumerate(qualities_rtmp): yield quality, RTMPStream( self.session, { "rtmp": RTMP_LIVE_URL.format(stream_id, i + 1), "pageUrl": self.url, "live": True }) qualities_hls = ["240p", "360p", "480p", "720p"] for i, quality_hls in enumerate(qualities_hls): yield quality_hls, HLSStream(self.session, HLS_RUV_LIVE_URL.format(i + 1)) else: yield "audio", RTMPStream( self.session, { "rtmp": RTMP_LIVE_URL.format(stream_id, 1), "pageUrl": self.url, "live": True }) yield "audio", HLSStream(self.session, HLS_RADIO_LIVE_URL.format(stream_id))
def _get_streams(self): streams = {} # streaming.media.ccc.de match = _url_streaming_media_re.match(self.url) if match: query_url = API_URL_STREAMING_MEDIA live_streams = parse_streaming_media_json(get_json(query_url),\ match.group('room')) for stream_name, stream_url in live_streams.items(): if re.search(r"m3u8", live_streams[stream_name]): streams[stream_name] = HLSStream(self.session,\ stream_url) else: streams[stream_name] = HTTPStream(self.session,\ stream_url) # media.ccc.de elif _url_media_re.search(self.url): event_id = get_event_id(self.url) query_url = "%s/public/events/%i" % (API_URL_MEDIA, event_id) recordings = parse_media_json(get_json(query_url)) for name, stream_url in recordings.items(): streams[name] = HTTPStream(self.session, stream_url) if not streams: raise PluginError("This plugin does not support your " "selected video.") return streams
def _get_sarpurinn_streams(self): res = http.get(self.url) match = _rtmp_url_re.search(res.text) if not match: yield token = match.group("id") status = match.group("status") extension = match.group("ext") date = match.group("date") if not date: date = "" if extension == "mp3": key = "audio" else: key = "576p" # HLS on Sarpurinn is currently only available on videos yield key, HLSStream( self.session, HLS_SARPURINN_URL.format(status, date, token, extension)) yield key, RTMPStream( self.session, { "rtmp": RTMP_SARPURINN_URL.format(status, date, token, extension), "pageUrl": self.url, "live": True })
def _get_streams(self): res = http.get(self.url, schema=_live_schema) if not res: return if res["type"] == "hls" and urlparse(res["url"]).path.endswith("m3u8"): stream = HLSStream(self.session, res["url"]) return dict(hls=stream)
def _parse_vod_streams(self, vod): for name, stream in vod["streams"].items(): scheme = urlparse(stream["url"]).scheme if scheme == "http": yield name, HLSStream(self.session, stream["url"]) elif scheme == "rtmp": yield name, self._create_rtmp_stream(stream, live=False)
def _get_streams(self): match = _url_re.match(self.url) username = match.group("username") broadcast = self._get_broadcast(username) if not broadcast: return playlist_url = PLAYLIST_URL.format(**broadcast) stream = HLSStream(self.session, playlist_url, headers=HEADERS) return dict(live=stream)
def _get_streams(self): match = _url_re.match(self.url) if not match: return streams = {} streams["live"] = HLSStream( self.session, "http://cdn.meerkatapp.co/broadcast/{0}/live.m3u8".format( match.group("token"))) return streams
def _get_hls_stream(self, url, cdn, quality, broad_key, bid): keyjson = self._get_hls_key(broad_key, bid) if keyjson["RESULT"] != CHANNEL_RESULT_OK: return key = keyjson["AID"] print key info = self._get_stream_info(url, cdn, quality, broad_key, "hls") if "view_url" in info: print info["view_url"] return HLSStream(self.session, info["view_url"], params=dict(aid=key))
def _get_hls_stream(self, channel_name): params = { "l": "info", "a": "ajax_video_info", "file": channel_name, "rid": time() } playlist_url = http.get(API_URL, params=params, schema=_hls_schema) if not playlist_url: return return HLSStream(self.session, playlist_url)
def _get_streams(self): """ Finds the stream from tvcatchup, they only provide a single 480p stream per channel. """ match = _url_re.match(self.url).groupdict() channel_id = match["channel_id"] res = http.get(STREAM_URL_FORMAT.format(channel_id)) stream_url = http.json(res).get('url') if stream_url: return {"480p": HLSStream(self.session, stream_url)}
def _create_hls_streams(self, bitrate): url = bitrate["url"] quality = self._get_quality(bitrate["label"]) if not url.startswith("http"): url = HLS_PLAYLIST_BASE.format(url) if bitrate["label"] == "Auto": 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) else: return quality, HLSStream(self.session, url)
def _get_streams(self): res = http.get(self.url) match = _stream_re.search(res.text) if not match: return stream_id = match.group(2) streams = {} for name, url_suffix in QUALITIES.items(): url = HLS_URL_FORMAT.format(stream_id, url_suffix) if not self._check_stream(url): continue streams[name] = HLSStream(self.session, url) return streams
def _get_streams(self): match = _url_re.match(self.url) res = http.get(STREAM_INFO_URL, params=match.groupdict(), acceptable_status=STATUS_UNAVAILABLE) if res.status_code in STATUS_UNAVAILABLE: return playlist_url = http.json(res, schema=_stream_schema) if "hls_url" in playlist_url: return HLSStream.parse_variant_playlist(self.session, playlist_url["hls_url"]) elif "replay_url" in playlist_url: self.logger.info("Live Stream ended, using replay instead") return dict(replay=HLSStream(self.session, playlist_url["replay_url"])) else: return
def _get_hls_streams(self, channelname): options = dict(l="info", a="ajax_video_info", file=channelname, rid=time()) res = urlget(self.APIURL, params=options) match = re.search("'(http://.+\.m3u8)'", res.text) if not match: raise PluginError( ("No HLS playlist found on URL {0}").format(self.url)) playlisturl = match.group(1) self.logger.debug("Playlist URL is {0}", playlisturl) playlist = {} playlist["hls"] = HLSStream(self.session, playlisturl) return playlist
def _get_streams(self): match = _url_re.match(self.url) domain = match.group('domain') cnid = self._get_channel_id(domain) if cnid == False: return flash_stream = HTTPStream(self.session, self._get_qq_stream_url(cnid, 1)) if flash_stream: yield "live", flash_stream mobile_stream = HLSStream(self.session, self._get_qq_stream_url(cnid, 2)) if mobile_stream: yield "live_http", mobile_stream
def _get_streams(self): reference_id, player_id, is_live = self._get_player_params() if not is_live: return acc_id = self._get_player_params2(reference_id) url = self._get_player_params3(acc_id, reference_id).replace("master.m3u8", "") streams = {} for i in range(len(STREAM_RATE)): _url = url + str(STREAM_RATE[i]) + "/azevinho.m3u8" s = HLSStream(self.session, _url) if s != None: streams[STREAM_NAMES[i]] = s #streams return streams
def _get_streams(self): api = self._create_api() match = _url_re.match(self.url) media_id = int(match.group("media_id")) try: info = api.get_info(media_id, fields=["media.stream_data"], schema=_media_schema) except CrunchyrollAPIError as err: raise PluginError(u"Media lookup error: {0}".format(err.msg)) if not info: return # TODO: Use dict comprehension here after dropping Python 2.6 support. return dict( (stream["quality"], HLSStream(self.session, stream["url"])) for stream in info["streams"] )
def _get_streams(self): channelname = self.url.rstrip("/").rpartition("/")[2].lower() streams = {} try: options = dict(l="info", a="ajax_video_info", file=channelname, rid=time()) res = urlget(self.HLSStreamURL, params=options, exception=IOError) match = re.search("'(http://.+\.m3u8)'", res.text) if not match: raise PluginError("Failed to find HLS playlist in result") playlisturl = match.group(1) self.logger.debug("Playlist URL is {0}", playlisturl) streams["live"] = HLSStream(self.session, playlisturl) except IOError: raise NoStreamsError(self.url) return streams
def _get_hls_stream(self, broadcast): info = self._get_stream_info(broadcast, "hls") if "view_url" in info: return HLSStream(self.session, info["view_url"])
def _get_streams(self): match = _url_re.match(self.url) if not match: return channel, media_id = match.group("channel", "media_id") if channel != "video": res = http.get(LIVE_API.format(channel)) livestream = http.json(res, schema=_live_schema) if not livestream["media_is_live"]: return media_id = livestream["media_id"] media_type = "live" else: media_type = "video" res = http.get(PLAYER_API.format(media_type, media_id)) player = http.json(res, schema=_player_schema) if media_type == "live": swf_url = SWF_URL for playlist in player.get("playlist", []): bitrates = playlist.get("bitrates") provider = playlist.get("connectionProvider") rtmp = None if bitrates: rtmp = playlist.get("netConnectionUrl") elif provider and provider in player["plugins"]: provider = player["plugins"][provider] swf_name = provider["url"] swf_url = SWF_BASE + swf_name rtmp = provider["netConnectionUrl"] bitrates = player["clip"]["bitrates"] else: continue for bitrate in bitrates: quality = self._get_quality(bitrate["label"]) url = bitrate["url"] stream = RTMPStream( self.session, { "rtmp": rtmp, "pageUrl": self.url, "playpath": url, "swfVfy": swf_url, "live": True }) yield quality, stream else: base_url = player["clip"]["baseUrl"] or VOD_BASE_URL for bitrate in player["clip"]["bitrates"]: url = base_url + "/" + bitrate["url"] quality = self._get_quality(bitrate["label"]) if urlparse(url).path.endswith("m3u8"): stream = HLSStream(self.session, url) else: stream = HTTPStream(self.session, url) yield quality, stream