本文整理匯總了Python中xoze.snapvideo.Video類的典型用法代碼示例。如果您正苦於以下問題:Python Video類的具體用法?Python Video怎麽用?Python Video使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Video類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: retrieveVideoInfo
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
示例2: retrieveVideoInfo
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
示例3: retrieveVideoInfo
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)
示例4: retrieveVideoInfo
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)
示例5: retrieveVideoInfo
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
示例6: retrieveVideoInfo
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
示例7: retrieveVideoInfo
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
示例8: retrieveVideoInfo
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
示例9: retrieveVideoInfo
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)
示例10: retrieveVideoInfo
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
示例11: retrieveAudioInfo
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
示例12: retrieveVideoInfo
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
示例13: retrieveVideoInfo
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)
示例14: retrieveVideoInfo
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
示例15: retrieveVideoInfo
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)