def retrieveVideoInfo(video_id): video_info = VideoInfo() video_info.set_video_hosting_info(getVideoHostingInfo()) video_info.set_video_id(video_id) try: video_info_link = 'http://www.videozer.com/player_control/settings.php?v=' + video_id + '&fv=v1.1.45' jsonObj = json.load(urllib.urlopen(video_info_link)) key1 = jsonObj["cfg"]["environment"]["rkts"] key2 = jsonObj["cfg"]["login"]["pepper"] key3 = jsonObj["cfg"]["ads"]["lightbox2"]["time"] values = binascii.unhexlify(decrypt(jsonObj["cfg"]["login"]["spen"], jsonObj["cfg"]["login"]["salt"], 950569)).split(';') spn = HttpUtils.getUrlParams(values[0]) outk = HttpUtils.getUrlParams(values[1]) ikey = getikey(int(outk["ik"])) urlKey = '' for spnkey in spn: spnval = spn[spnkey] if spnval == '1': cypher = jsonObj["cfg"]["info"]["sece2"] urlKey = urlKey + spnkey + '=' + decrypt(cypher, key1, ikey, ln=256) + '&' if spnval == '2': cypher = jsonObj["cfg"]["ads"]["g_ads"]["url"] urlKey = urlKey + spnkey + '=' + decrypt(cypher, key1, ikey) + '&' if spnval == '3': cypher = jsonObj["cfg"]["ads"]["g_ads"]["type"] urlKey = urlKey + spnkey + '=' + decrypt(cypher, key1, ikey, 26, 25431, 56989, 93, 32589, 784152) + '&' if spnval == '4': cypher = jsonObj["cfg"]["ads"]["g_ads"]["time"] urlKey = urlKey + spnkey + '=' + decrypt(cypher, key1, ikey, 82, 84669, 48779, 32, 65598, 115498) + '&' if spnval == '5': cypher = jsonObj["cfg"]["login"]["euno"] urlKey = urlKey + spnkey + '=' + decrypt(cypher, key2, ikey, 10, 12254, 95369, 39, 21544, 545555) + '&' if spnval == '6': cypher = jsonObj["cfg"]["login"]["sugar"] urlKey = urlKey + spnkey + '=' + decrypt(cypher, key3, ikey, 22, 66595, 17447, 52, 66852, 400595) + '&' urlKey = urlKey + "start=0" video_link = "" for videoStrm in jsonObj["cfg"]["quality"]: if videoStrm["d"]: video_link = str(base64.b64decode(videoStrm["u"])) if video_link == "": video_info.set_video_stopped(False) raise Exception("VIDEO_STOPPED") video_link = video_link + '&' + urlKey video_info.set_video_name(jsonObj["cfg"]["info"]["video"]["title"]) video_info.set_video_image(jsonObj["cfg"]["environment"]["thumbnail"]) video_info.set_video_stopped(False) video_info.add_video_link(VIDEO_QUAL_SD, video_link) except: video_info.set_video_stopped(True) return video_info
def __initialize__(self, params=None): print params self.set_action_id('__start__') if params is None: self.set_params({}) elif type(params) is str: self.set_params(HttpUtils.getUrlParams(params)) elif type(params) is dict: self.set_params(params) if self.get_params().has_key('actionId') and self.get_params()['actionId'] != '': self.set_action_id(self.get_params()['actionId']) if self.get_params().has_key('data') and self.get_params()['data'] != '': self.set_data(AddonUtils.decodeData(self.get_params()['data']))
def retrieveVideoInfo(video_id): video_info = VideoInfo() video_info.set_video_hosting_info(getVideoHostingInfo()) video_info.set_video_id(video_id) try: HttpUtils.HttpClient().enableCookies() html = HttpUtils.HttpClient().getHtmlContent(url='http://www.vplay.ro/watch/' + str(video_id)) html = HttpUtils.HttpClient().getHtmlContent(url='http://www.vplay.ro/play/dinosaur.do', params={'key':str(video_id)}) params = HttpUtils.getUrlParams(html) video_link = HttpUtils.getRedirectedUrl(url=params['nqURL']) HttpUtils.HttpClient().disableCookies() video_info.set_video_stopped(False) video_info.add_video_link(VIDEO_QUAL_SD, video_link) video_info.set_video_image(params['th']) except: video_info.set_video_stopped(True) return video_info
def retrieveVideoInfo(video_id): video_info = VideoInfo() video_info.set_video_hosting_info(getVideoHostingInfo()) video_info.set_video_id(video_id) try: HttpUtils.HttpClient().enableCookies() html = HttpUtils.HttpClient().getHtmlContent( url='http://www.vplay.ro/watch/' + str(video_id)) html = HttpUtils.HttpClient().getHtmlContent( url='http://www.vplay.ro/play/dinosaur.do', params={'key': str(video_id)}) params = HttpUtils.getUrlParams(html) video_link = HttpUtils.getRedirectedUrl(url=params['nqURL']) HttpUtils.HttpClient().disableCookies() video_info.set_video_stopped(False) video_info.add_video_link(VIDEO_QUAL_SD, video_link) video_info.set_video_image(params['th']) except: video_info.set_video_stopped(True) return video_info
def retrieveVideoInfo(video_id): video_info = VideoInfo() video_info.set_video_hosting_info(getVideoHostingInfo()) video_info.set_video_id(video_id) try: HttpUtils.HttpClient().enableCookies() video_info.set_video_image('http://i.ytimg.com/vi/' + video_id + '/default.jpg') html = HttpUtils.HttpClient().getHtmlContent(url='http://www.youtube.com/get_video_info?video_id=' + video_id + '&asv=3&el=detailpage&hl=en_US') stream_map = None html = html.decode('utf8') html = html.replace('\n', '') html = html.replace('\r', '') html = unicode(html + '&').encode('utf-8') if re.search('status=fail', html): # XBMCInterfaceUtils.displayDialogMessage('Video info retrieval failed', 'Reason: ' + ((re.compile('reason\=(.+?)\.').findall(html))[0]).replace('+', ' ') + '.') Logger.logInfo('YouTube video is removed for Id = ' + video_id + ' reason = ' + html) video_info.set_video_stopped(True) return video_info title = urllib.unquote_plus(re.compile('title=(.+?)&').findall(html)[0]).replace('/\+/g', ' ') video_info.set_video_name(title) stream_info = None if not re.search('url_encoded_fmt_stream_map=&', html): stream_info = re.compile('url_encoded_fmt_stream_map=(.+?)&').findall(html) stream_map = None if (stream_info is None or len(stream_info) == 0) and re.search('fmt_stream_map": "', html): stream_map = re.compile('fmt_stream_map": "(.+?)"').findall(html)[0].replace("\\/", "/") elif stream_info is not None: stream_map = stream_info[0] if stream_map is None: params = HttpUtils.getUrlParams(html) Logger.logDebug('ENTERING live video scenario...') for key in params: Logger.logDebug(key + " : " + urllib.unquote_plus(params[key])) hlsvp = urllib.unquote_plus(params['hlsvp']) playlistItems = HttpUtils.HttpClient().getHtmlContent(url=hlsvp).splitlines() qualityIdentified = None for item in playlistItems: Logger.logDebug(item) if item.startswith('#EXT-X-STREAM-INF'): if item.endswith('1280x720'): qualityIdentified = VIDEO_QUAL_HD_720 elif item.endswith('1080'): qualityIdentified = VIDEO_QUAL_HD_1080 elif item.endswith('854x480'): qualityIdentified = VIDEO_QUAL_SD elif item.endswith('640x360'): qualityIdentified = VIDEO_QUAL_LOW elif item.startswith('http') and qualityIdentified is not None: videoUrl = HttpUtils.HttpClient().addHttpCookiesToUrl(item, extraExtraHeaders={'Referer':'https://www.youtube.com/watch?v=' + video_id}) video_info.add_video_link(qualityIdentified, videoUrl) qualityIdentified = None video_info.set_video_stopped(False) return video_info stream_map = urllib.unquote_plus(stream_map) Logger.logDebug(stream_map) formatArray = stream_map.split(',') streams = {} for formatContent in formatArray: if formatContent == '': continue formatUrl = '' try: formatUrl = urllib.unquote(re.compile("url=([^&]+)").findall(formatContent)[0]) + "&title=" + urllib.quote_plus(title) except Exception, e: Logger.logFatal(e) if re.search("rtmpe", stream_map): try: conn = urllib.unquote(re.compile("conn=([^&]+)").findall(formatContent)[0]); host = re.compile("rtmpe:\/\/([^\/]+)").findall(conn)[0]; stream = re.compile("stream=([^&]+)").findall(formatContent)[0]; path = 'videoplayback'; formatUrl = "-r %22rtmpe:\/\/" + host + "\/" + path + "%22 -V -a %22" + path + "%22 -f %22WIN 11,3,300,268%22 -W %22http:\/\/s.ytimg.com\/yt\/swfbin\/watch_as3-vfl7aCF1A.swf%22 -p %22http:\/\/www.youtube.com\/watch?v=" + video_id + "%22 -y %22" + urllib.unquote(stream) + "%22" except Exception, e: Logger.logFatal(e) if formatUrl == '': continue Logger.logDebug('************************') Logger.logDebug(formatContent) formatQual = '' if(formatUrl[0: 4] == "http" or formatUrl[0: 2] == "-r"): formatQual = re.compile("itag=([^&]+)").findall(formatContent)[0] if not re.search("signature=", formatUrl): sig = re.compile("sig=([^&]+)").findall(formatContent) if sig is not None and len(sig) == 1: formatUrl += "&signature=" + sig[0] else: sig = re.compile("s=([^&]+)").findall(formatContent) if sig is not None and len(sig) == 1: formatUrl += "&signature=" + parseSignature(sig[0]) qual = formatQual url = HttpUtils.HttpClient().addHttpCookiesToUrl(formatUrl, addHeaders=False,addCookies=False, extraExtraHeaders={'Referer':'https://www.youtube.com/watch?v=' + video_id}) streams[int(qual)] = url