本文整理汇总了Python中urlresolver.choose_source函数的典型用法代码示例。如果您正苦于以下问题:Python choose_source函数的具体用法?Python choose_source怎么用?Python choose_source使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了choose_source函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LINKSP3
def LINKSP3(mname, url):
main.GA("Dailyfix", "Watched")
sources = []
ok = True
link = main.OPENURL(url)
match = re.compile("<a href='(.+?)' class='.+?' title='.+?' rel='.+?'>.+?</a").findall(link)
for murl in match:
host = re.compile("http://(.+?).com/.+?").findall(murl)
for hname in host:
hname = hname.replace("www.", "")
hosted_media = urlresolver.HostedMediaFile(url=murl, title=hname)
sources.append(hosted_media)
if len(sources) == 0:
xbmc.executebuiltin("XBMC.Notification(Sorry!,Movie doesn't have playable links,5000)")
else:
source = urlresolver.choose_source(sources)
if source:
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Actual HD Movie Requires Buffer Time,7000)")
stream_url = source.resolve()
else:
stream_url = False
return
listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
listitem.setInfo("video", {"Title": mname, "Year": ""})
xbmc.Player().play(stream_url, listitem)
return ok
示例2: VIDEOLINKSSG
def VIDEOLINKSSG(mname,murl):
main.GA("SG","Watched")
sources = []
ok=True
link=main.OPENURL(murl)
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting hosts,5000)")
link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','')
match=re.compile('href="([^<]+)" TARGET=".+?" >([^<]+)</a>').findall(link)
for url, host in sorted(match):
hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
sources.append(hosted_media)
if (len(sources)==0):
xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
else:
source = urlresolver.choose_source(sources)
if source:
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,5000)")
stream_url = source.resolve()
else:
stream_url = False
return
listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
listitem.setInfo('video', {'Title': mname, 'Year': ''} )
xbmc.Player().play(stream_url, listitem)
return ok
示例3: VIDEOLINKST
def VIDEOLINKST(mname,url):
main.GA("iWatchonline","Watched")
Mainurl ='http://www.iwatchonline.org'
url=Mainurl+url
sources = []
ok=True
match=re.compile('http://www.iwatchonline.org/episode/(.+?)-.+?').findall(url)
for movieid in match:
url=url + '?tmpl=component&option=com_jacomment&view=comments%20&contentoption=com_content&contentid='+ movieid
link=main.OPENURL(url)
match=re.compile('<a href="(.+?)" target="_BLANK" class="vidLinks">(.+?)</a>').findall(link)
for url, name in match:
hosted_media = urlresolver.HostedMediaFile(url=url, title=name)
sources.append(hosted_media)
if (len(sources)==0):
xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
else:
source = urlresolver.choose_source(sources)
if source:
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,3000)")
stream_url = source.resolve()
else:
stream_url = False
return
listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
listitem.setInfo('video', {'Title': mname, 'Year': ''} )
xbmc.Player().play(stream_url, listitem)
return ok
示例4: LINK
def LINK(mname,murl):
main.GA("dubzonline-"+mname,"Watched")
sources = []
ok=True
link=main.OPENURL(murl)
link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','')
match = re.compile('''<span class='.+?'><b>.+?</b></span><iframe src="(.+?)"''').findall(link)
for url in match:
match2=re.compile('http://(.+?)/.+?').findall(url)
for host in match2:
host = host.replace('www.','')
if host =='putlocker.com' or host =='sockshare.com':
url=url.replace('embed','file')
hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
sources.append(hosted_media)
if (len(sources)==0):
xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
else:
source = urlresolver.choose_source(sources)
if source:
stream_url = source.resolve()
else:
stream_url = False
return
listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
listitem.setInfo('video', {'Title': mname, 'Year': ''} )
xbmc.Player().play(stream_url, listitem)
return ok
示例5: CHANNELCLink
def CHANNELCLink(mname,murl):
main.GA("ChannelCut","Watched")
sources = []
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting hosts,3000)")
link=main.OPENURL(murl)
ok=True
site = re.findall('channelcut',murl)
if len(site)>0:
match=re.compile('<p><a href="(.+?)" rel=".+?">.+?</a></p>').findall(link)
else:
match=re.compile('<td><a href="(.+?)" target="').findall(link)
for url in match:
match2=re.compile('http://(.+?)/.+?').findall(url)
for host in match2:
host = host.replace('www.','')
hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
sources.append(hosted_media)
if (len(sources)==0):
xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
else:
source = urlresolver.choose_source(sources)
if source:
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,5000)")
stream_url = source.resolve()
else:
stream_url = False
return
listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
listitem.setInfo('video', {'Title': mname, 'Year': ''} )
xbmc.Player().play(stream_url, listitem)
return ok
示例6: play_video
def play_video(siteid, cls, epid, partnum):
siteid = int(siteid)
api = BaseForum.__subclasses__()[siteid]()
part_media = plugin.request.args['media'][0]
media = []
import urlresolver
for host, vid in sorted(part_media, key=lambda x: x[0].server):
r = urlresolver.HostedMediaFile(
host=host.server, media_id=vid)
if r:
media.append(r)
source = urlresolver.choose_source(media)
plugin.log.debug('>>> Source selected')
plugin.log.debug(source)
if source:
url = source.resolve()
if not __is_resolved(url):
msg = str(url.msg)
raise Exception(msg)
else:
plugin.log.debug('play video: {url}'.format(url=url))
plugin.set_resolved_url(url)
else:
msg = [_('cannot_play'), _('choose_source')]
plugin.log.error(msg[0])
dialog = xbmcgui.Dialog()
dialog.ok(api.long_name, *msg)
示例7: LINKFMA
def LINKFMA(mname,murl):
main.GA("FMA","Watched")
sources = []
ok=True
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting hosts,3000)")
link=main.OPENURL(murl)
link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','')
desc=re.compile('<meta name="description" content="(.+?)"').findall(link)
match=re.compile('<span class=\'.+?\'>(.+?)</span></p><div class=\'.+?\'><img src=\'(.+?)\' /></div><a class=\'.+?\' href="(.+?)"').findall(link)
for host, thumb, url in match:
durl='http://www.freemoviesaddict.com/'+url
redirect=main.REDIRECT(durl)
print "fff "+redirect
hosted_media = urlresolver.HostedMediaFile(url=redirect, title=host)
sources.append(hosted_media)
if (len(sources)==0):
xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
else:
source = urlresolver.choose_source(sources)
if source:
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving links,3000)")
stream_url = source.resolve()
else:
stream_url = False
return
listitem = xbmcgui.ListItem(mname, thumbnailImage= thumb)
listitem.setInfo('video', {'Title': mname, 'Plot': desc[0]} )
xbmc.Player().play(stream_url, listitem)
return ok
示例8: PlayUrlSource
def PlayUrlSource(url,name):
try:
GA("PlayVideo",name)
xbmc.executebuiltin("XBMC.Notification(if this mirror is a trailer,try another mirror,5000)")
match=re.compile('(youtu\.be\/|youtube-nocookie\.com\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v|user)\/))([^\?&"\'>]+)').findall(url)
if(len(match) > 0):
lastmatch = match[0][len(match[0])-1].replace('v/','')
playVideo('youtube',lastmatch)
url1 = 'plugin://plugin.video.youtube?path=/root/video&action=play_video&videoid=' + lastmatch.replace('?','')
liz = xbmcgui.ListItem('[B]PLAY VIDEO[/B]', thumbnailImage="")
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
playlist.add(url=url1, listitem=liz)
else:
sources = []
#try:
label=name
hosted_media = urlresolver.HostedMediaFile(url=url, title=label)
sources.append(hosted_media)
#except:
print 'Error while trying to resolve %s' % url
source = urlresolver.choose_source(sources)
print "source info=" + str(source)
if source:
stream_url = source.resolve()
print 'Attempting to play url: %s' % stream_url
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
playlist.clear()
listitem = xbmcgui.ListItem(label, iconImage="", thumbnailImage="")
playlist.add(url=stream_url, listitem=listitem)
xbmc.Player().play(playlist)
except: pass
示例9: VIDEOLINKST3
def VIDEOLINKST3(mname,murl):
sources = []
main.GA("OneclickwatchT","Watched")
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting Hosts,5000)")
link=main.OPENURL(murl)
ok=True
match=re.compile('<a href="(.+?)">(.+?)</a><br />').findall(link)
for url, host in match:
hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
sources.append(hosted_media)
if (len(sources)==0):
xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
else:
source = urlresolver.choose_source(sources)
if source:
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,3000)")
stream_url = source.resolve()
else:
stream_url = False
return
listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
listitem.setInfo('video', {'Title': mname, 'Year': ''} )
xbmc.Player().play(stream_url, listitem)
return ok
示例10: loadVideos
def loadVideos(url,name):
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Loading selected video)")
link=GetContent(url)
link = ''.join(link.splitlines()).replace('\t','').replace('\'','"')
#try:
newlink = re.compile('"setMedia", {(.+?):"(.+?)"').findall(link)
if(len(newlink) > 0):
(vtmp1,vlink)=newlink[0]
else:
newlink = re.compile('<iframe [^>]*src=["\']?([^>^"^\']+)["\']?[^>]*>').findall(link)
vlink=newlink[0]
match=re.compile('(youtu\.be\/|youtube-nocookie\.com\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v|user)\/))([^\?&"\'>]+)').findall(vlink)
if(len(match) > 0):
lastmatch = match[0][len(match[0])-1].replace('v/','')
playVideo('youtube',lastmatch)
elif (vlink.find("vimeo") > -1):
print "newlink|" + vlink
idmatch =re.compile("http://player.vimeo.com/video/([^\?&\"\'>]+)").findall(vlink)
if(len(idmatch) > 0):
playVideo('vimeo',idmatch[0])
else:
sources = []
label=name
hosted_media = urlresolver.HostedMediaFile(url=vlink, title=label)
sources.append(hosted_media)
source = urlresolver.choose_source(sources)
if source:
print "in source"
vidlink = source.resolve()
else:
vidlink =vlink
print "vidlink" + vidlink
playVideo('khmerportal',urllib2.unquote(vidlink).decode("utf8"))
示例11: LINKINT3
def LINKINT3(name,murl):
sources = []
main.GA("Cinevip","Watched")
link=main.OPENURL(murl)
ok=True
match=re.compile('<span class=".+?">(.+?)</span></td>\n<td>(.+?)</td>\n<td>.+?</td>\n<td>.+?href=http://adf.ly/.+?/(.+?)>').findall(link)
if len(match) == 0:
match=re.compile('<span class=".+?">(.+?)</span></td>\n<td>(.+?)</td>\n<td>.+?</td>\n<td>.+?href="http://adf.ly/.+?/(.+?)"').findall(link)
for host, lang, url in match:
print url
hosted_media = urlresolver.HostedMediaFile(url=url, title=host+' [COLOR red]'+lang+'[/COLOR]')
sources.append(hosted_media)
if (len(sources)==0):
xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
else:
source = urlresolver.choose_source(sources)
if source:
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,3000)")
stream_url = source.resolve()
if source.resolve()==False:
xbmc.executebuiltin("XBMC.Notification(Sorry!,Link Cannot Be Resolved,5000)")
return
else:
stream_url = False
return
listitem = xbmcgui.ListItem(name, iconImage="DefaultVideo.png")
listitem.setInfo('video', {'Title': name, 'Year': ''} )
xbmc.Player().play(stream_url, listitem)
return ok
示例12: LINKSP4
def LINKSP4(mname, murl):
sources = []
main.GA("Oneclickmovies", "Watched")
link = main.OPENURL(murl)
ok = True
link = link.replace('href="http://oneclickmoviez.com/dws/MEGA', "")
match = re.compile('<a href="(.+?)" target="_blank">(.+?)</a>.+?</p>').findall(link)
for url, host in match:
vlink = getlink(url)
match2 = re.compile("rar").findall(vlink)
if len(match2) == 0:
hosted_media = urlresolver.HostedMediaFile(url=vlink, title=host)
sources.append(hosted_media)
if len(sources) == 0:
xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
else:
source = urlresolver.choose_source(sources)
if source:
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,3000)")
stream_url = source.resolve()
else:
stream_url = False
return
listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
listitem.setInfo("video", {"Title": mname, "Year": ""})
xbmc.Player().play(stream_url, listitem)
return ok
示例13: request_servidores
def request_servidores(url,name):
titles=[]; ligacao=[]
link=abrir_url(url)
recolha=re.compile('----- (.+?) ---- (.+?) ---').findall(link)
for titulo, endereco in recolha:
titles.append(titulo)
ligacao.append(endereco)
if len(ligacao)==1: index=0
elif len(ligacao)==0: ok=mensagemok('Gato Fedorento', 'Nenhum stream disponivel.'); return
else: index = menuescolha('Escolha a parte', titles)
if index > -1:
linkescolha=ligacao[index]
if linkescolha:
import urlresolver
sources=[]
hosted_media = urlresolver.HostedMediaFile(url=linkescolha)
sources.append(hosted_media)
source = urlresolver.choose_source(sources)
if source:
linkescolha=source.resolve()
if linkescolha==False:
okcheck = xbmcgui.Dialog().ok
okcheck(traducao(40000),traducao(40019))
return
comecarvideo(linkescolha,name)
示例14: getVideoUrl
def getVideoUrl(url,name):
#data = json.load(urllib2.urlopen(url))['streams']
#for i, item in enumerate(data):
if(url.find("dailymotion") > -1):
dailylink = url+"&dk;"
match=re.compile('www.dailymotion.pl/video/(.+?)-').findall(dailylink)
if(len(match) == 0):
match=re.compile('/video/(.+?)&dk;').findall(dailylink)
link = 'http://www.dailymotion.com/video/'+str(match[0])
vidlink=getDailyMotionUrl(str(match[0]))
elif(url.find("google") > -1):
vidcontent=GetContent(url)
vidmatch=re.compile('"application/x-shockwave-flash"\},\{"url":"(.+?)",(.+?),(.+?),"type":"video/mpeg4"\}').findall(vidcontent)
vidlink=vidmatch[0][0]
elif(url.find("youtube") > -1):
vidmatch=re.compile('(youtu\.be\/|youtube-nocookie\.com\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v|user)\/))([^\?&"\'>]+)').findall(url)
vidlink=vidmatch[0][len(vidmatch[0])-1].replace('v/','')
vidlink='plugin://plugin.video.youtube?path=/root/video&action=play_video&videoid='+vidlink
else:
sources = []
label=name
hosted_media = urlresolver.HostedMediaFile(url=url, title=label)
sources.append(hosted_media)
source = urlresolver.choose_source(sources)
print "urlrsolving" + url
if source:
vidlink = source.resolve()
else:
vidlink =""
return vidlink
示例15: VIDEOLINKSEXTRA
def VIDEOLINKSEXTRA(mname,murl):
main.GA("Extramina","Watched")
sources = []
link=main.OPENURL(murl)
ok=True
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting hosts,5000)")
match=re.compile('<div class="streamlink"><a target=".+?" href="http://adf.ly/.+?/(.+?)">(.+?)</a></div>').findall(link)
for url, host in match:
match3=re.compile('extraminamovies').findall(url)
if len(match3)>0:
link2=main.OPENURL(url)
match = re.compile('<iframe src="(.+?)"').findall(link2)
for url in match:
match2=re.compile('http://(.+?)/.+?').findall(url)
for host in match2:
host = host.replace('www.','')
if host =='putlocker.com':
url=url.replace('embed','file')
hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
sources.append(hosted_media)
if (len(sources)==0):
xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
else:
source = urlresolver.choose_source(sources)
if source:
stream_url = source.resolve()
else:
stream_url = False
return
listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
listitem.setInfo('video', {'Title': mname, 'Year': ''} )
xbmc.Player().play(stream_url, listitem)
return ok