def connect(self): proxy_options = self.parse_proxy_url(self._proxy_url) if proxy_options.get('http_proxy_host'): log.debug("Connecting to {0} via proxy ({1}://{2}:{3})".format( self.host, proxy_options.get('proxy_type') or "http", proxy_options.get('http_proxy_host'), proxy_options.get('http_proxy_port') or 80)) else: log.debug("Connecting to {0}".format(self.host)) self._ws = websocket.create_connection( self.host, header=["User-Agent: {0}".format(useragents.CHROME)], origin="https://www.ustream.tv", **proxy_options) args = dict( type="viewer", appId=self._app_id, appVersion=self._app_version, rsid=self.rsid, rpin=self.rpin, referrer=self._referrer, clusterHost= "r%rnd%-1-%mediaId%-%mediaType%-%protocolPrefix%-%cluster%.ums.ustream.tv", media=str(self.media_id), application=self.application) if self._password: args["password"] = self._password result = self.send("connect", **args) return result > 0
def _get_info(self, stream_name): server = self.api_url() self.logger.debug("Connecting to API: {0}", server) ws = websocket.create_connection(server, header=["User-Agent: {0}".format(useragents.CHROME)], origin=self.origin, class_=VLWebSocket, session=self.session) ws.send("MVN LOAD3 {0}".format(stream_name)) action, message = ws.recv() return self.parse_ack(action, message)
def connect(self): log.debug("Connecting to {0}".format(self.host)) self._ws = websocket.create_connection( self.host, header=["User-Agent: {0}".format(useragents.CHROME)], origin="http://www.ustream.tv") args = dict( type="viewer", appId=self._app_id, appVersion=self._app_version, rsid=self.rsid, rpin=self.rpin, referrer=self._referrer, clusterHost= "r%rnd%-1-%mediaId%-%mediaType%-%protocolPrefix%-%cluster%.ums.ustream.tv", media=str(self.media_id), application=self.application) if self._password: args["password"] = self._password result = self.send("connect", **args) return result > 0