本文整理汇总了Python中urllib.unquote_plus函数的典型用法代码示例。如果您正苦于以下问题:Python unquote_plus函数的具体用法?Python unquote_plus怎么用?Python unquote_plus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unquote_plus函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_clean_body
def get_clean_body(response):
"""
:see: BlindSqliResponseDiff.get_clean_body()
Definition of clean in this method:
- input:
- response.get_url() == http://host.tld/aaaaaaa/
- response.get_body() == 'spam aaaaaaa eggs'
- output:
- self._clean_body( response ) == 'spam eggs'
The same works with file names.
All of them, are removed encoded and "as is".
:param response: The HTTPResponse object to clean
:return: A string that represents the "cleaned" response body of the
response.
"""
body = response.body
if response.is_text_or_html():
url = response.get_url()
to_replace = url.url_string.split('/')
to_replace.append(url.url_string)
for repl in to_replace:
if len(repl) > 6:
body = body.replace(repl, '')
body = body.replace(urllib.unquote_plus(repl), '')
body = body.replace(cgi.escape(repl), '')
body = body.replace(cgi.escape(urllib.unquote_plus(repl)), '')
return body
开发者ID:0x554simon,项目名称:w3af,代码行数:34,代码来源:fingerprint_404.py
示例2: processWithMap
def processWithMap(qs):
r = {}
for item in qs.split("&"):
item = item.split("=", 1)
if not item[1:]:
item[1] = None
key, val = item
if "[" in key:
brackets = key.split("[")
# It's a Array, and it's recursive
children = r # Children is just a pointer to r
c = 0 # Initialize at zero
l = len(brackets) - 1 # Length-1 to detect end
for bracket in brackets:
key_child = bracket.split("]")[0]
if not key_child and c > 0:
key_child = str(len(children))
children[key_child] = children.get(key_child, {})
if c == l:
children[key_child] = urllib.unquote_plus(val)
else:
children = children[key_child] # Replaces the pointer
c += 1
else:
# It's not a array \o/
r[key] = urllib.unquote_plus(val)
return convertToList(r)
开发者ID:fjorgemota,项目名称:Thupy,代码行数:27,代码来源:querystring.py
示例3: __init__
def __init__(self):
global action
params = {}
splitparams = sys.argv[2][sys.argv[2].find('?') + 1:].split('&')
for param in splitparams:
if (len(param) > 0):
splitparam = param.split('=')
key = splitparam[0]
try: value = splitparam[1].encode("utf-8")
except: value = splitparam[1]
params[key] = value
try: action = urllib.unquote_plus(params["action"])
except: action = None
try: categoryid = urllib.unquote_plus(params["categoryid"])
except: categoryid = None
try: offset = urllib.unquote_plus(params["offset"])
except: offset = 0
try: movie_id = urllib.unquote_plus(params["movie_id"])
except: movie_id = 0
try: episode = urllib.unquote_plus(params["episode"])
except: episode = 0
if action == None: self.main_menu()
elif action == 'list_movies': self.list_movies(categoryid, offset)
elif action == 'play_movie': self.play_movie(movie_id, episode)
elif action == 'list_seasons': self.list_seasons(movie_id)
elif action == 'list_episodes': self.list_episodes(movie_id)
elif action == 'Search': self.Search()
开发者ID:minhtuancn,项目名称:kodi-vietkeynet,代码行数:30,代码来源:default.py
示例4: parse_uri
def parse_uri(uri_string):
"""Creates a Uri object which corresponds to the URI string.
This method can accept partial URIs, but it will leave missing
members of the Uri unset.
"""
parts = urlparse.urlparse(uri_string)
uri = Uri()
if parts[0]:
uri.scheme = parts[0]
if parts[1]:
host_parts = parts[1].split(':')
if host_parts[0]:
uri.host = host_parts[0]
if len(host_parts) > 1:
uri.port = int(host_parts[1])
if parts[2]:
uri.path = parts[2]
if parts[4]:
param_pairs = parts[4].split('&')
for pair in param_pairs:
pair_parts = pair.split('=')
if len(pair_parts) > 1:
uri.query[urllib.unquote_plus(pair_parts[0])] = (
urllib.unquote_plus(pair_parts[1]))
elif len(pair_parts) == 1:
uri.query[urllib.unquote_plus(pair_parts[0])] = None
return uri
开发者ID:enyst,项目名称:plexnet,代码行数:28,代码来源:http_core.py
示例5: __init__
def __init__(self):
global action
params = {}
splitparams = sys.argv[2][sys.argv[2].find('?') + 1:].split('&')
for param in splitparams:
if (len(param) > 0):
splitparam = param.split('=')
key = splitparam[0]
try: value = splitparam[1].encode("utf-8")
except: value = splitparam[1]
params[key] = value
try: action = urllib.unquote_plus(params["action"])
except: action = None
try: channel = urllib.unquote_plus(params["channel"])
except: channel = None
if action == None: channels().get()
elif action == 'dialog': channels().dialog()
elif action == 'epg_menu': contextMenu().epg(channel)
elif action == 'refresh': index().container_refresh()
elif action == 'play': resolver().run(channel)
xbmcplugin.setContent(int(sys.argv[1]), 'Episodes')
xbmcplugin.setPluginFanart(int(sys.argv[1]), addonFanart)
xbmcplugin.endOfDirectory(int(sys.argv[1]))
return
开发者ID:1c0n,项目名称:lambda-xbmc-addons,代码行数:27,代码来源:default.py
示例6: get_clean_body
def get_clean_body(mutant, response):
'''
@see: Very similar to fingerprint_404.py get_clean_body() bug not quite
the same maybe in the future I can merge both?
Definition of clean in this method:
- input:
- response.get_url() == http://host.tld/aaaaaaa/?id=1 OR 23=23
- response.get_body() == '...<x>1 OR 23=23</x>...'
- output:
- self._clean_body( response ) == '...<x></x>...'
All injected values are removed encoded and "as is".
:param mutant: The mutant where I can get the value from.
:param response: The HTTPResponse object to clean
:return: A string that represents the "cleaned" response body.
'''
body = response.body
if response.is_text_or_html():
mod_value = mutant.get_mod_value()
body = body.replace(mod_value, '')
body = body.replace(urllib.unquote_plus(mod_value), '')
body = body.replace(cgi.escape(mod_value), '')
body = body.replace(cgi.escape(urllib.unquote_plus(mod_value)), '')
return body
开发者ID:HamzaKo,项目名称:w3af,代码行数:31,代码来源:blind_sqli_response_diff.py
示例7: remFav
def remFav(url):
log("> remFav()")
if url:
try:
favoritesRE=re.compile('(?i)name=(.+?)&url=(.+?)\n')
favorites = favoritesRE.findall(url)
for favorite in favorites:
name = favorite[0]
url = favorite[1]
nameurl = 'name=%s&url=%s%s' % (name, url, '\n')
if dialog.yesno( __plugin__ + ' v' + __version__, __language__(30009), '', urllib.unquote_plus(name).decode('utf-8') ):
doc = open(FILE_FAVS, "rU")
text = doc.read().decode('utf-8')
doc.close()
doc = open(FILE_FAVS, "w")
doc.write(text.replace(nameurl, ''))
doc.close()
xbmc.executebuiltin('Container.Refresh')
dialog.ok( __plugin__ + ' v' + __version__, __language__(30010), '', urllib.unquote_plus(name).decode('utf-8') )
doc = open(FILE_FAVS).read().decode('utf-8')
if doc == 'This is your favorites file.\n':
dialog.ok( __plugin__ + ' v' + __version__, __language__(30016) )
except:
dialog.ok( __plugin__ + ' v' + __version__, __language__(30011), '', urllib.unquote_plus(name).decode('utf-8') )
return True
开发者ID:Xycl,项目名称:plugin.audio.listenliveeu,代码行数:25,代码来源:default.py
示例8: variable_edit
def variable_edit(name=None, scope=None):
from models.variable import Variable
if name and scope:
variable = Variable.query.filter_by(name=urllib.unquote_plus(name), scope=urllib.unquote_plus(scope)).first_or_404()
else:
variable = Variable()
errors = []
if request.method == 'POST' and request.values.get( 'csrf_token', None ):
variable.scope = request.form.get('variable_scope')
variable.name = request.form.get('variable_name')
variable.raw_value = request.form.get('variable_raw_value')
errors = variable.validate()
if not len(errors):
variable.save()
flash( g._t('variable submit success'))
return redirect(url_for('variable_index'))
if name:
title = g._t('edit')
else:
title = g._t('add')
breadcrumbs = (
(g._t('administration'), url_for('administration_index')),
(g._t('variables'), url_for('variable_index')),
(title, "#")
)
return render_template('administration/variable/edit.html', title=title, breadcrumbs=breadcrumbs, variable=variable, errors=errors)
开发者ID:timur-glushan,项目名称:tt,代码行数:31,代码来源:variable.py
示例9: parse
def parse(self):
"""Call feed first"""
track = self.cut_content_simple('%2C+', '+%2A')[0]
artist, title = track.split('%2C+')
self.artist = self.capstext(urllib.unquote_plus(artist))
self.title = urllib.unquote_plus(title)
开发者ID:Leonidas-from-XIV,项目名称:whatsonair,代码行数:7,代码来源:gong.py
示例10: mirrors
def mirrors(params,url,category):
logger.info("[capitancinema.py] mirrors")
title = urllib.unquote_plus( params.get("title") )
thumbnail = urllib.unquote_plus( params.get("thumbnail") )
plot = urllib.unquote_plus( params.get("plot") )
# Descarga la página
data = scrapertools.cachePage(url)
patronvideos = '<li><strong>DISPONIBLE EN EL FORO</strong>[^<]+<a href="([^"]+)"'
matches = re.compile(patronvideos,re.DOTALL).findall(data)
if len(matches)>0:
url = matches[0]
data = scrapertools.cachePage(url)
# ------------------------------------------------------------------------------------
# Busca los enlaces a los videos
# ------------------------------------------------------------------------------------
listavideos = servertools.findvideos(data)
for video in listavideos:
videotitle = video[0]
url = video[1]
server = video[2]
xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , title.strip() + " - " + videotitle , url , thumbnail , plot )
# ------------------------------------------------------------------------------------
# Cierra el directorio
xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
开发者ID:HackJoues,项目名称:pelisalacarta-personal-fork,代码行数:31,代码来源:capitancinema.py
示例11: playDM
def playDM(id):
try:
if xbox:
addToHistory("plugin://video/My Music TV/?url="+id+"&mode=playDM")
else:
addToHistory("plugin://"+addonID+"/?url="+id+"&mode=playDM")
content = opener.open("http://www.dailymotion.com/embed/video/"+id).read()
if '"statusCode":410' in content or '"statusCode":403' in content:
xbmc.executebuiltin('XBMC.Notification(Dailymotion:, Video is not available,5000)')
else:
matchFullHD = re.compile('"stream_h264_hd1080_url":"(.+?)"', re.DOTALL).findall(content)
matchHD = re.compile('"stream_h264_hd_url":"(.+?)"', re.DOTALL).findall(content)
matchHQ = re.compile('"stream_h264_hq_url":"(.+?)"', re.DOTALL).findall(content)
matchSD = re.compile('"stream_h264_url":"(.+?)"', re.DOTALL).findall(content)
matchLD = re.compile('"stream_h264_ld_url":"(.+?)"', re.DOTALL).findall(content)
url = ""
if matchFullHD and resolutionDM == "1080p":
url = urllib.unquote_plus(matchFullHD[0]).replace("\\", "")
elif matchHD and (resolutionDM == "720p" or resolutionDM == "1080p"):
url = urllib.unquote_plus(matchHD[0]).replace("\\", "")
elif matchHQ:
url = urllib.unquote_plus(matchHQ[0]).replace("\\", "")
elif matchSD:
url = urllib.unquote_plus(matchSD[0]).replace("\\", "")
elif matchLD:
url = urllib.unquote_plus(matchLD[0]).replace("\\", "")
listitem = xbmcgui.ListItem(path=url)
xbmcplugin.setResolvedUrl(pluginhandle, True, listitem)
if infoEnabled:
showInfo()
except:
pass
开发者ID:DayVeeBoi,项目名称:addonscriptorde-beta-repo,代码行数:32,代码来源:default.py
示例12: parse
def parse(query_string, unquote=True):
'''
Main parse function
@param query_string:
@param unquote: unquote html query string ?
'''
mydict = {}
plist = []
if query_string == "":
return mydict
for element in query_string.split("&"):
try:
if unquote:
(var, val) = element.split("=")
var = urllib.unquote_plus(var)
val = urllib.unquote_plus(val)
else:
(var, val) = element.split("=")
except ValueError:
raise MalformedQueryStringError
plist.append(parser_helper(var, val))
for di in plist:
(k, v) = di.popitem()
tempdict = mydict
while k in tempdict and type(v) is dict:
tempdict = tempdict[k]
(k, v) = v.popitem()
if k in tempdict and type(tempdict[k]).__name__ == 'list':
tempdict[k].append(v)
elif k in tempdict:
tempdict[k] = [tempdict[k], v]
else:
tempdict[k] = v
return mydict
开发者ID:goldsoft1206,项目名称:querystring-parser,代码行数:34,代码来源:parser.py
示例13: playLiveVideo
def playLiveVideo(id):
content = getUrl2("http://www.dailymotion.com/sequence/"+id)
if content.find('"statusCode":410') > 0 or content.find('"statusCode":403') > 0:
xbmc.executebuiltin('XBMC.Notification(Info:,'+translation(30022)+' (DailyMotion)!,5000)')
else:
matchFullHD = re.compile('"hd1080URL":"(.+?)"', re.DOTALL).findall(content)
matchHD = re.compile('"hd720URL":"(.+?)"', re.DOTALL).findall(content)
matchHQ = re.compile('"hqURL":"(.+?)"', re.DOTALL).findall(content)
matchSD = re.compile('"sdURL":"(.+?)"', re.DOTALL).findall(content)
matchLD = re.compile('"video_url":"(.+?)"', re.DOTALL).findall(content)
url = ""
if matchFullHD and maxVideoQuality == "1080p":
url = urllib.unquote_plus(matchFullHD[0]).replace("\\", "")
elif matchHD and (maxVideoQuality == "720p" or maxVideoQuality == "1080p"):
url = urllib.unquote_plus(matchHD[0]).replace("\\", "")
elif matchHQ:
url = urllib.unquote_plus(matchHQ[0]).replace("\\", "")
elif matchSD:
url = urllib.unquote_plus(matchSD[0]).replace("\\", "")
elif matchLD:
url = urllib.unquote_plus(matchSD2[0]).replace("\\", "")
if url:
url = getUrl(url)
listitem = xbmcgui.ListItem(path=url)
xbmcplugin.setResolvedUrl(pluginhandle, True, listitem)
开发者ID:AddonScriptorDE,项目名称:plugin.video.dailymotion_com,代码行数:25,代码来源:default.py
示例14: get_media_url
def get_media_url(self, host, media_id):
if self.get_setting('login') == 'true':
if self.login_stale():
self.login()
self.net.set_cookies(self.cookie_file)
web_url = self.get_url(host, media_id)
if web_url[-1:1]=="#": web_url.replace("#","");
#find session_hash
try:
html = self.net.http_GET(web_url).content
if ">This file doesn't exist, or has been removed.<" in html: raise Exception (host+": This file doesn't exist, or has been removed.")
elif "This file might have been moved, replaced or deleted.<" in html: raise Exception (host+": This file might have been moved, replaced or deleted.")
#Shortcut for logged in users
pattern = '<a href="(/.+?)" class="download_file_link" style="margin:0px 0px;">Download File</a>'
link = re.search(pattern, html)
if link:
common.addon.log('Direct link found: %s' % link.group(1))
if 'putlocker' in host:
return 'http://www.filedrive.com%s' % link.group(1)
#return 'http://www.putlocker.com%s' % link.group(1)
elif 'filedrive' in host:
return 'http://www.filedrive.com%s' % link.group(1)
elif 'firedrive' in host:
return 'http://www.firedrive.com%s' % link.group(1)
if ('firedrive' in host) or ('filedrive' in host) or ('putlocker' in host):
try:
data = {}; r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"/>', html); #data['usr_login']=''
for name, value in r: data[name] = value
#data['imhuman']='Proceed to video'; data['btn_download']='Proceed to video'
#xbmc.sleep(2000)
html = self.net.http_POST(web_url, data).content
except urllib2.URLError, e:
common.addon.log_error(host+': got http error %d fetching 2nd url %s' % (e.code, web_url))
return self.unresolvable(code=3, msg='Exception: %s' % e) #return False
if "file: '" in html:
r = re.search("file\s*:\s*'(.+?)'", html)
if r: return urllib.unquote_plus(r.group(1))
if '" target="_blank" '+"id='top_external_download' title='Download This File'>" in html:
r = re.search('<a href="(.+?)" target="_blank" '+"id='top_external_download' title='Download This File'>", html)
if r: return urllib.unquote_plus(r.group(1))
if "id='external_download' title='Download This File'>" in html:
r = re.search('<a href="(.+?)" id=\'external_download\' title=\'Download This File\'>', html)
if r: return urllib.unquote_plus(r.group(1))
if "<a id='fd_vid_btm_download_front' title='Copy to my computer' class='video_bottom_buttons' target='_blank' href='" in html:
r = re.search("<a id='fd_vid_btm_download_front' title='Copy to my computer' class='video_bottom_buttons' target='_blank' href='(.+?)'>", html)
if r: return urllib.unquote_plus(r.group(1))
#if r:
# return urllib.unquote_plus(r.group(1))
#else:
# common.addon.log_error(host+': stream url not found')
# return self.unresolvable(code=0, msg='no file located') #return False
r = re.search("$.post('(.+?)', function(data) {", html)
if r:
return urllib.unquote_plus(r.group(1))
else:
common.addon.log_error(host+': stream url not found')
return self.unresolvable(code=0, msg='no file located') #return False
else:
开发者ID:irfancharania,项目名称:script.module.urlresolver,代码行数:60,代码来源:putlocker.py
示例15: parse_params
def parse_params(param_str):
param_dic = {}
# Parameters are on the 3rd arg passed to the script
param_str = sys.argv[2]
if len(param_str) > 1:
param_str = param_str.replace('?', '')
# Ignore last char if it is a '/'
if param_str[len(param_str) - 1] == '/':
param_str = param_str[0:len(param_str) - 2]
# Processing each parameter splited on '&'
for param in param_str.split('&'):
try:
# Spliting couple key/value
key, value = param.split('=')
except:
key = param
value = ''
key = urllib.unquote_plus(key)
value = urllib.unquote_plus(value)
# Filling dictionnary
param_dic[key] = value
return param_dic
开发者ID:Konubinix,项目名称:weboob,代码行数:27,代码来源:common_xbmc.py
示例16: play
def play(params,url,category):
xbmc.output("[yotix.py] play")
title = urllib.unquote_plus( params.get("title") )
thumbnail = urllib.unquote_plus( params.get("thumbnail") )
plot = urllib.unquote_plus( params.get("plot") )
server = urllib.unquote_plus( params.get("server") )
# Abre dialogo
dialogWait = xbmcgui.DialogProgress()
dialogWait.create( 'Accediendo al video...', title , plot )
if server=="Directo":
# Descarga la página del reproductor
# http://yotix.com/flash/UPY6KEB4/cleaner.html
xbmc.output("url="+url)
data = scrapertools.cachePage(url)
patron = 'so.addParam\(\'flashvars\',\'\&file\=([^\&]+)\&'
matches = re.compile(patron,re.DOTALL).findall(data)
if len(matches)>0:
url = matches[0]
else:
patron = 'http://yotix.tv/flash/([^\/]+)/'
matches = re.compile(patron,re.DOTALL).findall(url)
if len(matches)>0:
url = matches[0]
xbmc.output("url="+url)
# Cierra dialogo
dialogWait.close()
del dialogWait
xbmctools.playvideo(CHANNELNAME,server,url,category,title,thumbnail,plot)
开发者ID:HackJoues,项目名称:pelisalacarta-personal-fork,代码行数:35,代码来源:yotix.py
示例17: removePlaylist
def removePlaylist(title,murl,folders):
if os.path.exists(PlaylistFile):
playlist=re.compile("{'name': '(.*?)', 'url': '(.*?)', 'fanart': '(.*?)', 'folder': '(.*?)', 'typeXml': '(.*?)', 'thumb': '(.*?)'}").findall(open(PlaylistFile,'r').read())
if len(playlist)<=1 and str(playlist).find(title):
os.remove(PlaylistFile)
xbmc.executebuiltin("Container.Refresh")
if os.path.exists(PlaylistFile):
for name,url,fanart,folder,typeXml,thumb in reversed (playlist):
if title == urllib.unquote_plus(name) and urllib.unquote_plus(folders)==urllib.unquote_plus(folder):
playlist.remove((name,url,fanart,folder,typeXml,thumb))
os.remove(PlaylistFile)
for name,url,fanart,folder,typeXml,thumb in playlist:
try:
playlists = {}
playlists['name'] = name
playlists['url'] = url.replace('\\\\','\\')
playlists['thumb'] = thumb
playlists['fanart'] = fanart
playlists['folder'] = folder
playlists['typeXml'] = typeXml
open(PlaylistFile,'a').write(str(playlists))
xbmc.executebuiltin("Container.Refresh")
xbmc.executebuiltin("XBMC.Notification([B][COLOR=FF67cc33]"+title+"[/COLOR][/B],[B]Playlist Removed[/B],4000,"")")
except: pass
else: xbmc.executebuiltin("XBMC.Notification([B][COLOR green]Mash Up[/COLOR][/B],[B]You Have No Playlists[/B],1000,"")")
return
开发者ID:fsharath,项目名称:MashUp,代码行数:26,代码来源:customchannel.py
示例18: getGenreList
def getGenreList(params):
http = client.GET(urllib.unquote_plus(params['href']), httpSiteUrl)
if http is None:
return False
beautifulSoup = BeautifulSoup(http)
items = beautifulSoup.find('div', params['css']).findAll('a')
if len(items) == 0:
show_message('ОШИБКА', 'Неверная страница', 3000)
return False
else:
for item in items:
li = xbmcgui.ListItem(item.string)
li.setProperty('IsPlayable', 'false')
uri = strutils.construct_request({
'href': client.get_full_url(item['href'].encode('utf-8')),
'mode': 'readcategory',
'section': params['section'],
'filter': '',
'cleanUrl': urllib.unquote_plus(params['cleanUrl']),
'start': 0,
'hideFirstPageData': 1
})
xbmcplugin.addDirectoryItem(h, uri, li, True)
xbmcplugin.endOfDirectory(h)
开发者ID:vkravets,项目名称:ru,代码行数:26,代码来源:default.py
示例19: params_end
def params_end():
url=None
name=None
mode=None
iconimage=None
fanart=None
description=None
try:
url=urllib.unquote_plus(params["url"])
except:
pass
try:
name=urllib.unquote_plus(params["name"])
except:
pass
try:
iconimage=urllib.unquote_plus(params["iconimage"])
except:
pass
try:
mode=int(params["mode"])
except:
pass
try:
fanart=urllib.unquote_plus(params["fanart"])
except:
pass
try:
description=urllib.unquote_plus(params["description"])
except:
pass
开发者ID:ssneoh,项目名称:sstv,代码行数:33,代码来源:parameters.py
示例20: construct_video_url_keepvid
def construct_video_url_keepvid( self, url, quality=18, encoding="utf-8" ):
try:
url = unquote_plus( url )
video_id = url.split( "v=" )[ 1 ]
# we need to unquote the play url
url = "http://keepvid.com/?url=" + quote_plus( url )
# spam url to log for checking
if ( not DEBUG ):
xbmc.log( "[PLUGIN] '%s: version %s' - (quality=%d, video url=%s)" % ( sys.modules[ "__main__" ].__plugin__, sys.modules[ "__main__" ].__version__, quality, url, ), xbmc.LOGDEBUG )
# we need to request the url to be redirected to the swf player url to grab the session id
request = urllib2.Request( url )
# add a faked header, we use ie 8.0. it gives correct results for regex
request.add_header( 'User-Agent', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727)' )
# create an opener object to grab the info
opener = urllib2.urlopen( request )
# read source
htmlSource = opener.read()
# close opener
opener.close()
# get the video id and session id
video_url = unquote_plus( re.findall( "<a href=\"/save-video.mp4?(.+?)\"", htmlSource )[ 0 ] )[ 1 : ]
# get details for the video and return the details
title, author, genre, rating, runtime, count, date, thumbnail_url, plot = self.get_details( video_id )
# return our values
return video_url, title, author, genre, rating, runtime, count, date, thumbnail_url, plot, video_id
except:
# oops return an empty string
print "ERROR: %s::%s (%d) - %s" % ( self.__class__.__name__, sys.exc_info()[ 2 ].tb_frame.f_code.co_name, sys.exc_info()[ 2 ].tb_lineno, sys.exc_info()[ 1 ], )
return [ "" ] * 11
开发者ID:nuka1195,项目名称:plugin.video.youtube,代码行数:29,代码来源:YoutubeClient.py
注:本文中的urllib.unquote_plus函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论