def getStreamCloud(url): progress.update( 40, "", "Opening Streamcloud", "" ) scpage = utils.getVideoLink(url, '') progress.update( 50, "", "Getting Streamcloud page", "" ) schtml = utils.postHtml(scpage) form_values = {} match = re.compile('<input.*?name="(.*?)".*?value="(.*?)">', re.DOTALL | re.IGNORECASE).findall(schtml) for name, value in match: form_values[name] = value.replace("download1","download2") progress.update( 60, "", "Grabbing video file", "" ) newscpage = utils.postHtml(scpage, form_data=form_values) videourl = re.compile('file: "(.+?)",', re.DOTALL | re.IGNORECASE).findall(newscpage) progress.update( 80, "", "Returning video file", "" ) return videourl[0]
def Playvid(self, username, name): try: postRequest = { 'method': 'getRoomData', 'args[]': 'false', 'args[]': str(username) } response = utils.postHtml( 'http://bongacams.com/tools/amf.php', form_data=postRequest, headers={'X-Requested-With': 'XMLHttpRequest'}, compression=False) except: print('Oh oh Couldnt find a playable webcam link') return None amf_json = json.loads(response) if amf_json['localData']['videoServerUrl'].startswith("//mobile"): videourl = 'https:' + amf_json['localData'][ 'videoServerUrl'] + '/hls/stream_' + username + '.m3u8' else: videourl = 'https:' + amf_json['localData'][ 'videoServerUrl'] + '/hls/stream_' + username + '/playlist.m3u8' return videourl
def Playvid(username, name): try: postRequest = { 'method': 'getRoomData', 'args[]': 'false', 'args[]': str(username) } response = utils.postHtml( 'http://bongacams.com/tools/amf.php', form_data=postRequest, headers={'X-Requested-With': 'XMLHttpRequest'}, compression=False) except: utils.notify('Oh oh', 'Couldn\'t find a playable webcam link') return None amf_json = json.loads(response) if amf_json['localData']['videoServerUrl'].startswith("//mobile"): videourl = 'https:' + amf_json['localData'][ 'videoServerUrl'] + '/hls/stream_' + username + '.m3u8' else: videourl = 'https:' + amf_json['localData'][ 'videoServerUrl'] + '/hls/stream_' + username + '/playlist.m3u8' print(videourl) subprocess.Popen('mpv ' + videourl, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)