def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://letwatch.us/embed-' + str( video_id) + '-620x496.html' logging.getLogger().debug('URL : ' + video_link) html = http.HttpClient().get_html_content(url=video_link) paramSet = re.compile( "return p\}\(\'(.+?)\',(\d*),(\d*),\'(.+?)\'").findall(html) video_info_link = None if len(paramSet) > 0: video_info_link = encoders.parse_packed_value( paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'') logging.getLogger().debug(video_info_link) img_link = re.compile("image\:'(.+?)'").findall(video_info_link)[0] hd_video_link = re.compile("file\:'(.+?)',label\:'SD'").findall( video_info_link) if len(hd_video_link) > 0: video.add_stream_link(STREAM_QUAL_HD_720, hd_video_link[0]) sd_video_link = re.compile("file\:'(.+?)',label\:'HD'").findall( video_info_link) if len(sd_video_link) > 0: video.add_stream_link(STREAM_QUAL_SD, sd_video_link[0]) logging.getLogger().debug(video.get_streams()) video.set_stopped(False) video.set_thumb_image(img_link) video.set_name("LetWatch Video") except: video.set_stopped(True) return video
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_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 = http.parse_url_params(values[0]) outk = http.parse_url_params(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_name(jsonObj["cfg"]["info"]["video"]["title"]) video_info.set_thumb_image(jsonObj["cfg"]["environment"]["thumbnail"]) video_info.set_stopped(False) video_info.add_stream_link(STREAM_QUAL_SD, video_link) except: video_info.set_video_stopped(True) return video_info
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://www.dailymotion.com/embed/video/' + str(video_id) html = http.HttpClient().get_html_content(url=video_link) http.HttpClient().disable_cookies() matchFullHD = re.compile('"stream_h264_hd1080_url":"(.+?)"', re.DOTALL).findall(html) matchHD = re.compile('"stream_h264_hd_url":"(.+?)"', re.DOTALL).findall(html) matchHQ = re.compile('"stream_h264_hq_url":"(.+?)"', re.DOTALL).findall(html) matchSD = re.compile('"stream_h264_url":"(.+?)"', re.DOTALL).findall(html) matchLD = re.compile('"stream_h264_ld_url":"(.+?)"', re.DOTALL).findall(html) dm_LD = None dm_SD = None dm_720 = None dm_1080 = None if matchFullHD: dm_1080 = urllib.unquote_plus(matchFullHD[0]).replace("\\", "") if matchHD: dm_720 = urllib.unquote_plus(matchHD[0]).replace("\\", "") if dm_720 is None and matchHQ: dm_720 = urllib.unquote_plus(matchHQ[0]).replace("\\", "") if matchSD: dm_SD = urllib.unquote_plus(matchSD[0]).replace("\\", "") if matchLD: dm_LD = urllib.unquote_plus(matchLD[0]).replace("\\", "") if dm_LD is not None: video.add_stream_link(STREAM_QUAL_LOW, dm_LD,addUserAgent=False , addReferer=False, refererUrl=video_link) if dm_SD is not None: video.add_stream_link(STREAM_QUAL_SD, dm_SD,addUserAgent=False , addReferer=False, refererUrl=video_link) if dm_720 is not None: video.add_stream_link(STREAM_QUAL_HD_720, dm_720,addUserAgent=False , addReferer=False, refererUrl=video_link) if dm_1080 is not None: video.add_stream_link(STREAM_QUAL_HD_1080, dm_1080,addUserAgent=False , addReferer=False, refererUrl=video_link) if len(video.get_streams()) == 0: video.set_stopped(True) else: video.set_stopped(False) except Exception, e: logging.getLogger().error(e) video.set_stopped(True)
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: video_link = 'http://www.zshare.net/video/' + str(video_id) html = http.HttpClient().get_html_content(url=video_link) match = re.compile('<iframe src="http://www.zshare.net/videoplayer/player.php(.+?)"').findall(html) html = http.HttpClient().get_html_content(url=('http://www.zshare.net/videoplayer/player.php' + match[0].replace(' ', '%20'))) video_link = re.compile('file: "(.+?)"').findall(html)[0].replace(' ', '%20') video_info.set_stopped(False) video_info.add_stream_link(STREAM_QUAL_SD, video_link) except: video_info.set_stopped(True) return video_info
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: video_info_link = 'http://embed.tune.pk/play/' + str(video_id) + '?autoplay=no' html = http.HttpClient().get_html_content(url=video_info_link) image = re.compile("preview_img = '(.+?)';").findall(html) if image is not None and len(image) == 1: video_info.set_thumb_image(str(image[0])) html = html.replace('\n\r', '').replace('\r', '').replace('\n', '').replace('"','').replace('\\/','/') sources = re.compile("{(.+?)}").findall(re.compile("sources = (.+?)]").findall(html)[0]) for source in sources: video_link = str(re.compile("file:(.+?).mp4").findall(source)[0]) + '.mp4' label_text = str(re.compile("label:(.+?)p").findall(source)[0]) + 'p' if label_text is not None and len(label_text) == 1: label = str(label_text[0]) logging.getLogger().debug(label) if label == '240p': video_info.add_stream_link(STREAM_QUAL_LOW, video_link) elif label == '360p' and video_info.get_stream_link(STREAM_QUAL_SD) is None: video_info.add_stream_link(STREAM_QUAL_SD, video_link) elif label == '480p' or label == 'SD': video_info.add_stream_link(STREAM_QUAL_SD, video_link) elif label == '720p' or label == 'HD': video_info.add_stream_link(STREAM_QUAL_HD_720, video_link) elif label == '1080p': video_info.add_stream_link(STREAM_QUAL_HD_1080, video_link) else: video_info.add_stream_link(STREAM_QUAL_SD, video_link) else: video_info.add_stream_link(STREAM_QUAL_SD, video_link) video_info.set_stopped(False) except Exception, e: logging.getLogger().error(e) video_info.set_stopped(True)
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://www.videohut.to/embed.php?id=' + str(video_id) mobileagent = urllib.quote_plus('AppleCoreMedia/1.0.0.10B146 (iPhone; U; CPU OS 6_1_2 like Mac OS X; en_us)') req = urllib2.Request(video_link) req.add_header('User-Agent', mobileagent) response = urllib2.urlopen(req) html=response.read() response.close() video_link = re.compile('src=\"(.+?)\?cloudy_stream=true').findall(html)[0] video.set_stopped(False) video.set_thumb_image('') video.set_name("Videohut Video") video.add_stream_link(STREAM_QUAL_SD, video_link) except: video.set_stopped(True)
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://www.comedyportal.net/' + str(video_id) html = http.HttpClient().get_html_content(url=video_link) match = re.compile("id='pl'.+?data='(.+?)'").findall(html) html = http.HttpClient().get_html_content( url=match[0].replace(' ', '%20')) video_link = re.compile("file : '(.+?)'").findall(html)[0].replace( ' ', '%20') video.set_stopped(False) video.add_stream_link(STREAM_QUAL_SD, video_link) except: video.set_stopped(True) return video
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: http.HttpClient().enable_cookies() video_info_link = 'http://www.videohut.to/embed.php?id=' + str(video_id) html = http.HttpClient().get_html_content(url=video_info_link) if re.search(r'Video hosting is expensive. We need you to prove you\'re human.', html): html = http.HttpClient().get_html_content(url=video_info_link) domainStr = re.compile('flashvars.domain="(.+?)"').findall(html)[0] fileStr = re.compile('flashvars.file="(.+?)"').findall(html)[0] filekey = re.compile('flashvars.filekey="(.+?)"').findall(html) filekeyStr = None if len(filekey) == 0: filekeyStr = re.compile('flashvars.filekey=(.+?);').findall(html)[0] filekeyStr = re.compile('var ' + filekeyStr + '="(.+?)"').findall(html)[0] else: filekeyStr = filekey[0] video_info_link = domainStr + '/api/player.api.php?user=undefined&pass=undefined&codes=1&file=' + fileStr + '&key=' + filekeyStr html = http.HttpClient().get_html_content(url=video_info_link) video_link = re.compile(r'url=(.+?)&').findall(html)[0] http.HttpClient().disable_cookies() video_info.set_stopped(False) video_info.add_stream_link(STREAM_QUAL_SD, urllib.unquote(video_link)) except: video_info.set_stopped(True) return video_info
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'https://config.playwire.com/videos/v2/%s/player.json' % str(video_id) logging.debug('get video info: ' + video_link) html = http.HttpClient().get_html_content(url=video_link) jsonObj = json.loads(html) video_link = str(jsonObj['src']) video_info = re.compile('config.playwire.com/(.+?)/videos/v2/(.+?)/manifest.f4m').findall(video_link)[0] video_link = 'http://cdn.phoenix.intergi.com/' + video_info[0] + '/videos/' + video_info[1] + '/video-sd.mp4?hosting_id=' + video_info[0] img_link = str(jsonObj['poster']) name = str(jsonObj['title']) video.add_stream_link(STREAM_QUAL_SD, video_link) video.set_stopped(False) video.set_thumb_image(img_link) video.set_name(name) except Exception, e: logging.getLogger().error(e) video.set_stopped(True)
def retrieveAudioInfo(audioUrl): url = 'https://api.soundcloud.com/' + audioUrl jObj = json.loads(http.HttpClient().get_html_content(url=url)) video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(url) video_info.add_stream_link(STREAM_QUAL_SD, jObj['http_mp3_128_url']) video_info.set_thumb_image('') video_info.set_name('') logging.getLogger().debug(jObj['http_mp3_128_url']) video_info.set_stopped(False) return video_info
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: video_info_link = 'http://stagevu.com/video/' + str(video_id) html = http.HttpClient().get_html_content(url=video_info_link) html = ''.join(html.splitlines()).replace('\t', '').replace('\'', '"') match = re.compile('<param name="src" value="(.+?)"(.+?)<param name="movieTitle" value="(.+?)"(.+?)<param name="previewImage" value="(.+?)"').findall(html) video_info.add_stream_link(STREAM_QUAL_SD, match[0][0]) video_info.set_name(match[0][2]) video_info.set_thumb_image(match[0][4]) video_info.set_stopped(False) except: video_info.set_stopped(True) return video_info
def retrieveVideoInfo(videoUrl): try: xbmcaddon.Addon('plugin.video.iplayer') except: dialog = xbmcgui.Dialog() dialog.ok('[B][COLOR red]MISSING: [/COLOR][/B] BBC IPlayer v2 add-on', '', 'Please install BBC IPlayer v2 add-on created by Hitcher!', 'Available at http://code.google.com/p/xbmc-iplayerv2/') raise video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(videoUrl) video_info.set_url(videoUrl) addon_url = 'plugin://plugin.video.iplayer/?' video_params = videoUrl.split('/') addon_url += 'pid=%s' % video_params[0] video_info.add_stream_link(STREAM_QUAL_SD, addon_url) video_info.set_thumb_image('http://www.bbc.co.uk/iplayer/images/episode/%s_512_288.jpg' % video_params[0]) video_info.set_name(video_params[1].replace('_', ' ')) logging.getLogger().debug('addon_url : %s' % addon_url) video_info.set_stopped(False) return video_info
from xoze.utils import http >>>>>>> origin/master import logging import re VIDEO_HOST_NAME = 'letwatch' def getVideoHost(): video_host = VideoHost() video_host.set_icon('http://letwatch.us.com/images/logo.png') video_host.set_name(VIDEO_HOST_NAME) return video_host def retrieveVideoInfo(video_id): <<<<<<< HEAD video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://letwatch.us/embed-' + str(video_id) + '-620x496.html' logging.getLogger().debug('URL : ' + video_link) html = http.HttpClient().get_html_content(url=video_link) paramSet = re.compile("return p\}\(\'(.+?)\',(\d*),(\d*),\'(.+?)\'").findall(html) video_info_link = None if len(paramSet) > 0: video_info_link = encoders.parse_packed_value(paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'') logging.getLogger().debug(video_info_link) img_link = re.compile("image\:'(.+?)'").findall(video_info_link)[0] hd_video_link = re.compile("file\:'(.+?)',label\:'SD'").findall(video_info_link) if len(hd_video_link) > 0: video.add_stream_link(STREAM_QUAL_HD_720, hd_video_link[0])
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: video_info_link = 'http://www.zalaa.com/' + str(video_id) html = http.HttpClient().get_html_content(url=video_info_link) link = ''.join(html.splitlines()).replace('\'', '"') video_link = re.compile('s1.addVariable\("file","(.+?)"\);').findall(link)[0] video_info.add_stream_link(STREAM_QUAL_SD, video_link) video_info.set_stopped(False) except: video_info.set_video_stopped(True) return video_info
def retrieveVideoInfo(videoUrl): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(videoUrl) sources = [] hosted_media = urlresolver.HostedMediaFile(url=videoUrl) sources.append(hosted_media) source = urlresolver.choose_source(sources) stream_url = '' if source: stream_url = source.resolve() video_info.set_stopped(False) video_info.set_thumb_image('') video_info.set_name(' ') video_info.add_stream_link(STREAM_QUAL_SD, stream_url) return video_info
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: video_info_link = 'http://videobam.com/' + str(video_id) html = http.HttpClient().get_html_content(url=video_info_link) streams = re.compile('(low|high): \'(.+?)\'').findall(html) for streamType, streamUrl in streams: if streamType == 'low': video_info.add_stream_link(STREAM_QUAL_SD, streamUrl) elif streamType == 'high': video_info.add_stream_link(STREAM_QUAL_HD_720, streamUrl) video_info.set_stopped(False) except: video_info.set_stopped(True) return video_info
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://config.playwire.com/' + str(video_id) + '.json' html = http.HttpClient().get_html_content(url=video_link) jsonObj = json.loads(html) logging.getLogger().debug(jsonObj) img_link = str(jsonObj['poster']) video_link = str(jsonObj['src']) logging.debug('get video info: ' + video_link) video_info = re.compile('config.playwire.com/(.+?)/videos/v2/(.+?)/manifest.f4m').findall(video_link)[0] logging.getLogger().debug('video_serial_no ' + str(video_info)) video_link = 'http://cdn.phoenix.intergi.com/' + video_info[0] + '/videos/' + video_info[1] + '/video-sd.mp4?hosting_id=' + video_info[0] logging.getLogger().debug('video_link ' + str(video_link)) video.set_stopped(False) video.set_thumb_image(img_link) video.set_name("PLAYWIRE Video") if re.search(r'\Artmp', video_link): video.add_stream_link(STREAM_QUAL_HD_720, video_link) else: video.add_stream_link(STREAM_QUAL_HD_720, video_link) except: video.set_stopped(True) return video
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_info_link = 'http://watchers.to/embed-' + str(video_id) + '.html' html = http.HttpClient().get_html_content(url=video_info_link) paramSet = re.compile( "return p\}\(\'(.+?)\',(\d+),(\d+),\'(.+?)\'").findall(html) if len(paramSet) > 0: video_info_link = encoders.parse_packed_value( paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'') img_data = re.compile(r"image:\'(.+?)\'").findall(video_info_link) if len(img_data) == 1: video.set_thumb_image(img_data[0]) video_link = 'http' + re.compile( "file\:\'http(.+?)m3u8\'").findall(video_info_link)[0] + 'm3u8' if len(video_link) == 0: video_link = 'http' + re.compile( "file\:\'http(.+?)mp4\'").findall( video_info_link)[0] + 'mp4' else: html = html.replace(' ', '') html = html.replace('\'', '"') try: video_link = 'http' + re.compile( 'file:"http(.+?)m3u8"').findall(html)[0] + 'm3u8' except: video_link = 'http' + re.compile( 'file:"http(.+?)mp4"').findall(html)[0] + 'mp4' img_link = re.compile('image:"(.+?)"').findall(html)[0] video.set_thumb_image(img_link) video.set_stopped(False) video.add_stream_link(STREAM_QUAL_SD, video_link) except: video.set_stopped(True) return video
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: video_link = 'http://playcineflix.com/' + str(video_id) + '.mp4' video_info.add_stream_link(STREAM_QUAL_SD, video_link) video_info.set_stopped(False) except: video_info.set_stopped(True) return video_info
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_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 = http.parse_url_params(values[0]) outk = http.parse_url_params(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_name(jsonObj["cfg"]["info"]["video"]["title"]) video_info.set_thumb_image(jsonObj["cfg"]["environment"]["thumbnail"]) video_info.set_stopped(False) video_info.add_stream_link(STREAM_QUAL_SD, video_link) except: video_info.set_video_stopped(True) return video_info
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_info_link = 'http://movzap.com/' + str(video_id) html = http.HttpClient().get_html_content(url=video_info_link) video_link = None paramSet = re.compile("return p\}\(\'(.+?)\',(\d\d),(\d\d),\'(.+?)\'").findall(html) if len(paramSet) > 0: video_info_link = encoders.parse_packed_value(paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'') img_data = re.compile(r"image:\'(.+?)\'").findall(video_info_link) if len(img_data) == 1: video.set_thumb_image(img_data[0]) video_link = re.compile(r"file:\'(.+?)\'").findall(video_info_link)[0] else: video_link = re.compile("'file': '(.+?)'").findall(html)[0] video.set_stopped(False) video.add_stream_link(STREAM_QUAL_SD, video_link) except Exception, e: logging.getLogger().error(e) video.set_stopped(True)
def retrieveVideoInfo(videoUrl): try: xbmcaddon.Addon('plugin.video.iplayer') except: dialog = xbmcgui.Dialog() dialog.ok('[B][COLOR red]MISSING: [/COLOR][/B] BBC IPlayer v2 add-on', '', 'Please install BBC IPlayer v2 add-on created by Hitcher!', 'Available at http://code.google.com/p/xbmc-iplayerv2/') raise video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(videoUrl) video_info.set_url(videoUrl) addon_url = 'plugin://plugin.video.iplayer/?' video_params = videoUrl.split('/') addon_url += 'pid=%s' % video_params[0] video_info.add_stream_link(STREAM_QUAL_SD, addon_url) video_info.set_thumb_image( 'http://www.bbc.co.uk/iplayer/images/episode/%s_512_288.jpg' % video_params[0]) video_info.set_name(video_params[1].replace('_', ' ')) logging.getLogger().debug('addon_url : %s' % addon_url) video_info.set_stopped(False) return video_info
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: http.HttpClient().enable_cookies() html = http.HttpClient().get_html_content( url='http://www.vplay.ro/watch/' + str(video_id)) html = http.HttpClient().get_html_content( url='http://www.vplay.ro/play/dinosaur.do', params={'key': str(video_id)}) params = http.parse_url_params(html) video_link = http.get_redirected_url(url=params['nqURL']) http.HttpClient().disable_cookies() video_info.set_stopped(False) video_info.add_stream_link(STREAM_QUAL_SD, video_link) video_info.set_thumb_image(params['th']) except: video_info.set_stopped(True) return video_info
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_info_link = 'http://www.facebook.com/video/video.php?v=' + str(video_id) html = urllib.unquote_plus(http.HttpClient().get_html_content(url=video_info_link).replace('\u0025', '%')) video_title = re.compile('addVariable\("video_title"\, "(.+?)"').findall(html)[0] img_link = re.compile('addVariable\("thumb_url"\, "(.+?)"').findall(html)[0] high_video_link = re.compile('addVariable\("highqual_src"\, "(.+?)"').findall(html) low_video_link = re.compile('addVariable\("lowqual_src"\, "(.+?)"').findall(html) video_link = re.compile('addVariable\("video_src"\, "(.+?)"').findall(html) if len(high_video_link) > 0: video.add_stream_link(STREAM_QUAL_HD_720, high_video_link[0]) if len(low_video_link) > 0: video.add_stream_link(STREAM_QUAL_SD, low_video_link[0]) if len(video_link) > 0: video.add_stream_link(STREAM_QUAL_SD, video_link[0]) video.set_stopped(False) video.set_name(video_title) video.set_thumb_image(img_link) except Exception, e: video.set_stopped(True) logging.getLogger().error(e)
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://config.playwire.com/' + str(video_id) + '.json' html = http.HttpClient().get_html_content(url=video_link) jsonObj = json.loads(html) logging.getLogger().debug(jsonObj) img_link = str(jsonObj['poster']) video_link = str(jsonObj['src']) logging.debug('get video info: ' + video_link) video_info = re.compile( 'config.playwire.com/(.+?)/videos/v2/(.+?)/manifest.f4m').findall( video_link)[0] logging.getLogger().debug('video_serial_no ' + str(video_info)) video_link = 'http://cdn.phoenix.intergi.com/' + video_info[ 0] + '/videos/' + video_info[ 1] + '/video-sd.mp4?hosting_id=' + video_info[0] logging.getLogger().debug('video_link ' + str(video_link)) video.set_stopped(False) video.set_thumb_image(img_link) video.set_name("PLAYWIRE Video") if re.search(r'\Artmp', video_link): video.add_stream_link(STREAM_QUAL_HD_720, video_link) else: video.add_stream_link(STREAM_QUAL_HD_720, video_link) except: video.set_stopped(True) return video
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: http.HttpClient().enable_cookies() video_info.set_thumb_image('http://i.ytimg.com/vi/' + video_id + '/default.jpg') html = http.HttpClient().get_html_content(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('+', ' ') + '.') logging.getLogger().info('YouTube video is removed for Id = ' + video_id + ' reason = ' + html) video_info.set_stopped(True) return video_info title = urllib.unquote_plus(re.compile('title=(.+?)&').findall(html)[0]).replace('/\+/g', ' ') video_info.set_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 = http.parse_url_params(html) logging.getLogger().debug('ENTERING live video scenario...') for key in params: logging.getLogger().debug(key + " : " + urllib.unquote_plus(params[key])) hlsvp = urllib.unquote_plus(params['hlsvp']) playlistItems = http.HttpClient().get_html_content(url=hlsvp).splitlines() qualityIdentified = None for item in playlistItems: logging.getLogger().debug(item) if item.startswith('#EXT-X-STREAM-INF'): if item.endswith('1280x720'): qualityIdentified = STREAM_QUAL_HD_720 elif item.endswith('1080'): qualityIdentified = STREAM_QUAL_HD_1080 elif item.endswith('854x480'): qualityIdentified = STREAM_QUAL_SD elif item.endswith('640x360'): qualityIdentified = STREAM_QUAL_LOW elif item.startswith('http') and qualityIdentified is not None: videoUrl = http.HttpClient().add_http_cookies_to_url(item, extraExtraHeaders={'Referer':'https://www.youtube.com/watch?v=' + video_id}) video_info.add_stream_link(qualityIdentified, videoUrl) qualityIdentified = None video_info.set_stopped(False) return video_info stream_map = urllib.unquote_plus(stream_map) logging.getLogger().debug(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: logging.getLogger().error(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: logging.getLogger().error(e) if formatUrl == '': continue logging.getLogger().debug('************************') logging.getLogger().debug(formatContent) 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 = http.HttpClient().add_http_cookies_to_url(formatUrl, addHeaders=False,addCookies=False, extraExtraHeaders={'Referer':'https://www.youtube.com/watch?v=' + video_id}) streams[int(qual)] = url
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: html = http.HttpClient().get_html_content(url='http://vimeo.com/' + str(video_id)) referrerObj = re.compile( '"timestamp":(.+?),"signature":"(.+?)"').findall(html)[0] req_sig_exp = referrerObj[0] req_sig = referrerObj[1] img_link = re.compile( 'itemprop="thumbnailUrl" content="(.+?)"').findall(html)[0] video_title = re.compile('"title":"(.+?)"').findall(html)[0] qual = 'sd' video_link = "http://player.vimeo.com/play_redirect?clip_id=%s&sig=%s&time=%s&quality=%s&codecs=H264,VP8,VP6&type=moogaloop_local&embed_location=" % ( video_id, req_sig, req_sig_exp, qual) video_info.add_stream_link(STREAM_QUAL_SD, video_link) if (re.search('"hd":1', html)): qual = 'hd' video_link = "http://player.vimeo.com/play_redirect?clip_id=%s&sig=%s&time=%s&quality=%s&codecs=H264,VP8,VP6&type=moogaloop_local&embed_location=" % ( video_id, req_sig, req_sig_exp, qual) video_info.add_stream_link(STREAM_QUAL_HD_720, video_link) video_info.set_stopped(False) video_info.set_thumb_image(img_link) video_info.set_name(video_title) except Exception, e: logging.getLogger().error(e) video_info.set_stopped(True)
def retrieveVideoInfo(videoUrl): try: xbmcaddon.Addon('plugin.video.vevo') except: dialog = xbmcgui.Dialog() dialog.ok('[B][COLOR red]MISSING: [/COLOR][/B] VEVO add-on', '', 'Please install VEVO add-on created by BlueCop!', 'Available at http://code.google.com/p/bluecop-xbmc-repo/') raise video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(videoUrl) addon_url = 'plugin://plugin.video.vevo/?' vevo_id = videoUrl.split('/')[-1] if videoUrl.startswith('playlist'): url = urllib.quote_plus('http://api.vevo.com/mobile/v2/playlist/%s.json?' % vevo_id) addon_url += 'url=%s' % url addon_url += '&mode=playPlaylist' addon_url += '&duration=210' addon_url += '&page=1' video_info.add_stream_link(XBMC_EXECUTE_PLUGIN, addon_url) video_info.set_thumb_image('') video_info.set_name(' ') else: url = 'http://videoplayer.vevo.com/VideoService/AuthenticateVideo?isrc=%s&extended=true' % vevo_id video = json.loads(http.HttpClient().get_html_content(url=url))['video'] title = '' try:title = video['title'].encode('utf-8') except: title = '' video_image = video['imageUrl'] if len(video['featuredArtists']) > 0: feats = '' for featuredartist in video['featuredArtists']: # featuredartist_image = featuredartist['image_url'] featuredartist_name = featuredartist['artistName'].encode('utf-8') feats += featuredartist_name + ', ' feats = feats[:-2] title += ' (ft. ' + feats + ')' addon_url += 'url=%s' % vevo_id addon_url += '&mode=playVideo' addon_url += '&duration=210' video_info.add_stream_link(STREAM_QUAL_SD, addon_url) video_info.set_thumb_image(video_image) video_info.set_name(title) logging.getLogger().debug(addon_url) video_info.set_stopped(False) return video_info
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: http.HttpClient().enable_cookies() html = http.HttpClient().get_html_content(url='http://www.vplay.ro/watch/' + str(video_id)) html = http.HttpClient().get_html_content(url='http://www.vplay.ro/play/dinosaur.do', params={'key':str(video_id)}) params = http.parse_url_params(html) video_link = http.get_redirected_url(url=params['nqURL']) http.HttpClient().disable_cookies() video_info.set_stopped(False) video_info.add_stream_link(STREAM_QUAL_SD, video_link) video_info.set_thumb_image(params['th']) except: video_info.set_stopped(True) return video_info
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://www.dailymotion.com/embed/video/' + str(video_id) html = http.HttpClient().get_html_content(url=video_link) http.HttpClient().disable_cookies() player = re.compile('document\.getElementById\(\'player\'\), (.+?)\);').findall(html) player_obj = json.loads(player[0]) video_qual = player_obj['metadata']['qualities'] print video_qual dm_LD = None if video_qual.has_key('380'): dm_LD = video_qual['380'][0]['url'] dm_SD = None if video_qual.has_key('480'): dm_SD = video_qual['480'][0]['url'] dm_720 = None if video_qual.has_key('720'): dm_720 = video_qual['720'][0]['url'] dm_1080 = None if video_qual.has_key('1080'): dm_1080 = video_qual['1080'][0]['url'] if dm_LD is not None: video.add_stream_link(STREAM_QUAL_LOW, dm_LD, addUserAgent=False , addReferer=False, refererUrl=video_link) if dm_SD is not None: video.add_stream_link(STREAM_QUAL_SD, dm_SD, addUserAgent=False , addReferer=False, refererUrl=video_link) if dm_720 is not None: video.add_stream_link(STREAM_QUAL_HD_720, dm_720, addUserAgent=False , addReferer=False, refererUrl=video_link) if dm_1080 is not None: video.add_stream_link(STREAM_QUAL_HD_1080, dm_1080, addUserAgent=False , addReferer=False, refererUrl=video_link) if len(video.get_streams()) == 0: video.set_stopped(True) else: video.set_stopped(False) except Exception, e: logging.getLogger().error(e) video.set_stopped(True)
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: video_info_link = 'http://veevr.com/embed/' + str(video_id) soup = http.HttpClient().get_beautiful_soup(url=video_info_link) thumbTag = soup.findChild('img', attrs={'id': 'vid-thumb'}) imageUrl = thumbTag['src'] videoTitle = thumbTag['alt'] vidTag = soup.findChild('img', attrs={'id': 'smil-load'}) videoUrl = vidTag['src'] video_info.add_stream_link(STREAM_QUAL_SD, videoUrl) video_info.set_name(videoTitle) video_info.set_thumb_image(imageUrl) video_info.set_stopped(False) except: video_info.set_stopped(True) return video_info
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: html = http.HttpClient().get_html_content(url='http://vimeo.com/' + str(video_id)) referrerObj = re.compile('"timestamp":(.+?),"signature":"(.+?)"').findall(html)[0] req_sig_exp = referrerObj[0] req_sig = referrerObj[1] img_link = re.compile('itemprop="thumbnailUrl" content="(.+?)"').findall(html)[0] video_title = re.compile('"title":"(.+?)"').findall(html)[0] qual = 'sd' video_link = "http://player.vimeo.com/play_redirect?clip_id=%s&sig=%s&time=%s&quality=%s&codecs=H264,VP8,VP6&type=moogaloop_local&embed_location=" % (video_id, req_sig, req_sig_exp, qual) video_info.add_stream_link(STREAM_QUAL_SD, video_link) if(re.search('"hd":1', html)): qual = 'hd' video_link = "http://player.vimeo.com/play_redirect?clip_id=%s&sig=%s&time=%s&quality=%s&codecs=H264,VP8,VP6&type=moogaloop_local&embed_location=" % (video_id, req_sig, req_sig_exp, qual) video_info.add_stream_link(STREAM_QUAL_HD_720, video_link) video_info.set_stopped(False) video_info.set_thumb_image(img_link) video_info.set_name(video_title) except Exception, e: logging.getLogger().error(e) video_info.set_stopped(True)
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://tvlogy.to/watch.php?v=' + str(video_id) html = http.HttpClient().get_html_content(url=video_link) video_link = re.compile("file: '(.+?)',").findall(html)[0] logging.debug('get video info: ' + video_link) logging.getLogger().debug('video_link ' + str(video_link)) video.set_stopped(False) video.set_name("TVlogy Video") video.add_stream_link(STREAM_QUAL_HD_720, video_link) except: video.set_stopped(True) return video
def retrieveVideoInfo(video_id): # Old Method #import urlresolver #videoUrl = 'http://letwatch.us/embed-' + str(video_id) + '-595x430.html' #media = urlresolver.HostedMediaFile(url=videoUrl, title='') #New method to get 720links video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://letwatch.us/embed-' + str( video_id) + '-595x430.html' html = http.HttpClient().get_html_content(url=video_link) paramSet = re.compile( "return p\}\(\'(.+?)\',(\d+),(\d+),\'(.+?)\'").findall(html) print paramSet if len(paramSet) > 0: video_info_link = encoders.parse_packed_value( paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'') img_data = re.compile(r"image:\'(.+?)\'").findall(video_info_link) if len(img_data) == 1: video.set_thumb_image(img_data[0]) video_link = re.compile(r"file:\'(.+?)\'").findall( video_info_link)[0] else: html = html.replace(' ', '') html = html.replace('\'', '"') try: video_link = 'http' + re.compile( 'file:"http(.+?)m3u8"').findall(html)[0] + 'm3u8' except: video_link = 'http' + re.compile( 'file:"http(.+?)mp4"').findall(html)[0] + 'mp4' img_link = re.compile('image:"(.+?)"').findall(html)[0] video.set_thumb_image(img_link) video.set_stopped(False) video.add_stream_link(STREAM_QUAL_SD, video_link) except: video.set_stopped(True) return video
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: http.HttpClient().enable_cookies() video_info_link = 'http://www.divxstage.eu/video/' + str(video_id) html = http.HttpClient().get_html_content(url=video_info_link) if re.search(r'Video hosting is expensive. We need you to prove you\'re human.', html): html = http.HttpClient().get_html_content(url=video_info_link) http.HttpClient().disable_cookies() fileKey = re.compile('flashvars.filekey="(.+?)";').findall(html)[0] video_info_link = 'http://www.divxstage.eu/api/player.api.php?file=' + video_id + '&key=' + fileKey html = http.HttpClient().get_html_content(url=video_info_link) video_link = re.compile('url=(.+?)&').findall(html)[0] video.set_stopped(False) video.add_stream_link(STREAM_QUAL_SD, video_link) except Exception, e: logging.exception(e) video.set_stopped(True)
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: http.HttpClient().enable_cookies() video_info_link = 'http://www.dittotv.com/' + str(video_id) html = http.HttpClient().get_html_content(url=video_info_link) video_link = re.compile('"file"\:"(.+?)"').findall(html)[0] video.set_stopped(False) video.add_stream_link(STREAM_QUAL_SD, video_link) except Exception, e: logging.exception(e) video.set_stopped(True)
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_info_link = 'http://vidwatch3.me/embed-' + str( video_id) + '-540x304.html' html = http.HttpClient().get_html_content(url=video_info_link) html = html.replace(' ', '') html = html.replace('\'', '"') final_video_link = '' try: video_link = 'http' + re.compile('file:"http(.+?)m3u8"').findall( html)[0] + 'm3u8' img_link = re.compile('image:"(.+?)"').findall(html)[0] video.set_thumb_image(img_link) except: try: video_link = 'http' + re.compile( 'file:"http(.+?)mp4"').findall(html)[0] + 'mp4' except: video_link = '' if ('.m3u8' in video_link): try: html = cache_page(url=video_link) final_video_link = 'http' + re.compile( 'http(.+?)m3u8').findall(html)[0] + 'm3u8' except: final_video_link = video_link if final_video_link == '' or final_video_link == None: paramSet = re.compile( "returnp\}\(\"(.+?)\",(\d+),(\d+),\"(.+?)\"").findall(html) try: if len(paramSet) > 0: video_info_link = encoders.parse_packed_value( paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace( '"', '\'') img_data = re.compile(r"image:\'(.+?)\'").findall( video_info_link) if len(img_data) == 1: video.set_thumb_image(img_data[0]) sources = re.compile(r"sources\:\[(.+?)\]").findall( video_info_link)[0] video_link = re.compile(r"file:\'(.+?)\'").findall( sources)[0] if 'm3u8' not in video_link: try: video_link = re.compile(r"file:\'(.+?)\'").findall( sources)[1] except: video_link = re.compile(r"file:\'(.+?)\'").findall( sources)[0] else: try: html = http.HttpClient().get_html_content( url=video_link) html = html.replace(' ', '') html = html.replace('\'', '"') final_video_link = 'http' + re.compile( 'http(.+?)m3u8').findall(html)[0] + 'm3u8' except: final_video_link = video_link except: final_video_link = '' if final_video_link == '' or final_video_link == None: final_video_link = video_link video.set_stopped(False) video.add_stream_link(STREAM_QUAL_SD, final_video_link) except: video.set_stopped(True) return video
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'https://config.playwire.com/videos/v2/%s/player.json' % str( video_id) logging.debug('get video info: ' + video_link) html = http.HttpClient().get_html_content(url=video_link) jsonObj = json.loads(html) video_link = str(jsonObj['src']) video_info = re.compile( 'config.playwire.com/(.+?)/videos/v2/(.+?)/manifest.f4m').findall( video_link)[0] video_link = 'http://cdn.phoenix.intergi.com/' + video_info[ 0] + '/videos/' + video_info[ 1] + '/video-sd.mp4?hosting_id=' + video_info[0] img_link = str(jsonObj['poster']) name = str(jsonObj['title']) video.add_stream_link(STREAM_QUAL_SD, video_link) video.set_stopped(False) video.set_thumb_image(img_link) video.set_name(name) except Exception, e: logging.getLogger().error(e) video.set_stopped(True)
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://cdn.playwire.com/' + str(video_id) + '.json' html = http.HttpClient().get_html_content(url=video_link) jsonObj = json.loads(html) logging.getLogger().debug(jsonObj) img_link = str(jsonObj['poster']) video_link = str(jsonObj['src']) video.set_stopped(False) video.set_thumb_image(img_link) video.set_name("PLAYWIRE Video") if re.search(r'\Artmp', video_link): video.add_stream_link(STREAM_QUAL_HD_720, video_link) else: video.add_stream_link(STREAM_QUAL_HD_720, video_link) except: video.set_stopped(True) return video
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: http.HttpClient().enable_cookies() video_info_link = "http://www.videoweed.es/file/" + str(video_id) html = http.HttpClient().get_html_content(url=video_info_link) if re.search(r"Video hosting is expensive. We need you to prove you\'re human.", html): html = http.HttpClient().get_html_content(url=video_info_link) domainStr = re.compile('flashvars.domain="(.+?)"').findall(html)[0] fileStr = re.compile('flashvars.file="(.+?)"').findall(html)[0] filekey = re.compile('flashvars.filekey="(.+?)"').findall(html) filekeyStr = None if len(filekey) == 0: filekeyStr = re.compile("flashvars.filekey=(.+?);").findall(html)[0] filekeyStr = re.compile("var " + filekeyStr + '="(.+?)"').findall(html)[0] else: filekeyStr = filekey[0] video_info_link = ( domainStr + "/api/player.api.php?user=undefined&pass=undefined&codes=1&file=" + fileStr + "&key=" + filekeyStr ) html = http.HttpClient().get_html_content(url=video_info_link) video_link = re.compile(r"url=(.+?)&").findall(html)[0] http.HttpClient().disable_cookies() video_info.set_stopped(False) video_info.add_stream_link(STREAM_QUAL_SD, video_link) except: video_info.set_stopped(True) return video_info
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://www.cloudy.ec/embed.php?id=' + str(video_id) html = http.HttpClient().get_html_content(url=video_link) video_key = re.compile('key\: "(.+?)"').findall(html)[0] video.set_stopped(False) video.set_thumb_image('') video.set_name("CloudEC Video") video_url = 'http://www.cloudy.ec/api/player.api.php?user=undefined&codes=1&file=' + video_id + '&pass=undefined&key=' + video_key html = http.HttpClient().get_html_content(url=video_url) video_link = re.compile('url=(.+?)&title=').findall(html)[0] video.add_stream_link(STREAM_QUAL_SD, urllib.unquote_plus(video_link)) logging.getLogger().debug(video.get_streams()) except: video.set_stopped(True) return video
def retrieveVideoInfo(video_id): # Old Method #import urlresolver #videoUrl = 'http://letwatch.us/embed-' + str(video_id) + '-595x430.html' #media = urlresolver.HostedMediaFile(url=videoUrl, title='') #New method to get 720links video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://letwatch.us/embed-' + str(video_id) + '-595x430.html' html = http.HttpClient().get_html_content(url=video_link) paramSet = re.compile("return p\}\(\'(.+?)\',(\d+),(\d+),\'(.+?)\'").findall(html) print paramSet if len(paramSet) > 0: video_info_link = encoders.parse_packed_value(paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'') img_data = re.compile(r"image:\'(.+?)\'").findall(video_info_link) if len(img_data) == 1: video.set_thumb_image(img_data[0]) video_link = re.compile(r"file:\'(.+?)\'").findall(video_info_link)[0] else: html = html.replace(' ', '') html = html.replace('\'', '"') try: video_link = 'http' + re.compile('file:"http(.+?)m3u8"').findall(html)[0] + 'm3u8' except: video_link = 'http' + re.compile('file:"http(.+?)mp4"').findall(html)[0] + 'mp4' img_link = re.compile('image:"(.+?)"').findall(html)[0] video.set_thumb_image(img_link) video.set_stopped(False) video.add_stream_link(STREAM_QUAL_SD, video_link) except: video.set_stopped(True) return video
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: http.HttpClient().enable_cookies() video_info_link = 'http://www.movshare.net/video/' + str(video_id) html = http.HttpClient().get_html_content(url=video_info_link) if re.search(r'Video hosting is expensive. We need you to prove you\'re human.', html): html = http.HttpClient().get_html_content(url=video_info_link) video_info_link = re.compile('<embed type="video/divx" src="(.+?)"').findall(html) video_link = '' if len(video_info_link) == 0: domainStr = re.compile('flashvars.domain="(.+?)"').findall(html)[0] fileStr = re.compile('flashvars.file="(.+?)"').findall(html)[0] filekeyStr = re.compile('flashvars.filekey="(.+?)"').findall(html)[0] video_info_link = domainStr + '/api/player.api.php?user=undefined&pass=undefined&codes=1&file=' + fileStr + '&key=' + filekeyStr html = http.HttpClient().get_html_content(url=video_info_link) video_link = re.compile(r'url=(.+?)&').findall(html)[0] else: video_link = video_info_link[0] http.HttpClient().disable_cookies() video.set_stopped(False) video.add_stream_link(STREAM_QUAL_SD, video_link) except: video.set_stopped(True) return video
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: video_link = 'http://vshare.io/d/' + str(video_id) html = http.HttpClient().get_html_content(url=video_link) match = re.compile( 'document.getElementById\(\'download-link\'\).innerHTML = \'<a style="text-decoration:none;" href="(.+?)"' ).findall(html) video_link = match[0] video_info.set_stopped(False) video_info.add_stream_link(STREAM_QUAL_SD, video_link) except: video_info.set_stopped(True) return video_info
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_info_link = 'http://www.vidpe.com/' + str(video_id) html = http.HttpClient().get_html_content(url=video_info_link) video_link = None paramSet = re.compile("return p\}\(\'(.+?)\',(\d\d),(\d\d),\'(.+?)\'").findall(html) if len(paramSet) > 0: video_info_link = encoders.parse_packed_value(paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'') img_data = re.compile(r"image:\'(.+?)\'").findall(video_info_link) if len(img_data) == 1: video.set_thumb_image(img_data[0]) video_link = re.compile(r"file:\'(.+?)\'").findall(video_info_link)[0] else: video_link = re.compile("'file': '(.+?)'").findall(html)[0] video.set_stopped(False) video.add_stream_link(STREAM_QUAL_SD, video_link) except: video.set_stopped(True) return video
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: video_link = 'http://www.vioku.com/flvideo/' + video_id video_info.add_stream_link(STREAM_QUAL_SD, video_link) video_info.set_stopped(False) except: video_info.set_stopped(True) return video_info
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://letwatch.us/embed-' + str(video_id) + '-620x496.html' logging.getLogger().debug('URL : ' + video_link) html = http.HttpClient().get_html_content(url=video_link) paramSet = re.compile("return p\}\(\'(.+?)\',(\d*),(\d*),\'(.+?)\'").findall(html) video_info_link = None if len(paramSet) > 0: video_info_link = encoders.parse_packed_value(paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'') logging.getLogger().debug(video_info_link) img_link = re.compile("image\:'(.+?)'").findall(video_info_link)[0] hd_video_link = re.compile("file\:'(.+?)',label\:'SD'").findall(video_info_link) if len(hd_video_link) > 0: video.add_stream_link(STREAM_QUAL_HD_720, hd_video_link[0]) sd_video_link = re.compile("file\:'(.+?)',label\:'HD'").findall(video_info_link) if len(sd_video_link) > 0: video.add_stream_link(STREAM_QUAL_SD, sd_video_link[0]) logging.getLogger().debug(video.get_streams()) video.set_stopped(False) video.set_thumb_image(img_link) video.set_name("LetWatch Video") except: video.set_stopped(True) return video
def retrieveVideoInfo(video_id): video_info = Video() video_info.set_video_host(getVideoHost()) video_info.set_id(video_id) try: http.HttpClient().enable_cookies() video_info.set_thumb_image('http://i.ytimg.com/vi/' + video_id + '/default.jpg') html = http.HttpClient().get_html_content( 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('+', ' ') + '.') logging.getLogger().info('YouTube video is removed for Id = ' + video_id + ' reason = ' + html) video_info.set_stopped(True) return video_info title = urllib.unquote_plus( re.compile('title=(.+?)&').findall(html)[0]).replace('/\+/g', ' ') video_info.set_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 = http.parse_url_params(html) logging.getLogger().debug('ENTERING live video scenario...') for key in params: logging.getLogger().debug(key + " : " + urllib.unquote_plus(params[key])) hlsvp = urllib.unquote_plus(params['hlsvp']) playlistItems = http.HttpClient().get_html_content( url=hlsvp).splitlines() qualityIdentified = None for item in playlistItems: logging.getLogger().debug(item) if item.startswith('#EXT-X-STREAM-INF'): if item.endswith('1280x720'): qualityIdentified = STREAM_QUAL_HD_720 elif item.endswith('1080'): qualityIdentified = STREAM_QUAL_HD_1080 elif item.endswith('854x480'): qualityIdentified = STREAM_QUAL_SD elif item.endswith('640x360'): qualityIdentified = STREAM_QUAL_LOW elif item.startswith('http') and qualityIdentified is not None: videoUrl = http.HttpClient().add_http_cookies_to_url( item, extraExtraHeaders={ 'Referer': 'https://www.youtube.com/watch?v=' + video_id }) video_info.add_stream_link(qualityIdentified, videoUrl) qualityIdentified = None video_info.set_stopped(False) return video_info stream_map = urllib.unquote_plus(stream_map) logging.getLogger().debug(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: logging.getLogger().error(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: logging.getLogger().error(e) if formatUrl == '': continue logging.getLogger().debug('************************') logging.getLogger().debug(formatContent) 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 = http.HttpClient().add_http_cookies_to_url( formatUrl, addHeaders=False, addCookies=False, extraExtraHeaders={ 'Referer': 'https://www.youtube.com/watch?v=' + video_id }) streams[int(qual)] = url
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_info_link = 'http://www.facebook.com/video/video.php?v=' + str( video_id) html = urllib.unquote_plus(http.HttpClient().get_html_content( url=video_info_link).replace('\u0025', '%')) video_title = re.compile( 'addVariable\("video_title"\, "(.+?)"').findall(html)[0] img_link = re.compile('addVariable\("thumb_url"\, "(.+?)"').findall( html)[0] high_video_link = re.compile( 'addVariable\("highqual_src"\, "(.+?)"').findall(html) low_video_link = re.compile( 'addVariable\("lowqual_src"\, "(.+?)"').findall(html) video_link = re.compile('addVariable\("video_src"\, "(.+?)"').findall( html) if len(high_video_link) > 0: video.add_stream_link(STREAM_QUAL_HD_720, high_video_link[0]) if len(low_video_link) > 0: video.add_stream_link(STREAM_QUAL_SD, low_video_link[0]) if len(video_link) > 0: video.add_stream_link(STREAM_QUAL_SD, video_link[0]) video.set_stopped(False) video.set_name(video_title) video.set_thumb_image(img_link) except Exception, e: video.set_stopped(True) logging.getLogger().error(e)
def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://www.comedyportal.net/' + str(video_id) html = http.HttpClient().get_html_content(url=video_link) match = re.compile("id='pl'.+?data='(.+?)'").findall(html) html = http.HttpClient().get_html_content(url=match[0].replace(' ', '%20')) video_link = re.compile("file : '(.+?)'").findall(html)[0].replace(' ', '%20') video.set_stopped(False) video.add_stream_link(STREAM_QUAL_SD, video_link) except: video.set_stopped(True) return video