本文整理汇总了Python中resources.libs.main.addLink函数的典型用法代码示例。如果您正苦于以下问题:Python addLink函数的具体用法?Python addLink怎么用?Python addLink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addLink函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LISTHOST
def LISTHOST(mname,murl,thumb):
epi = re.findall('\ss(\d+)e(\d+)\s',mname + " ",re.I)
for s,e in epi: pass
if e[0:1]=='0': epis=e[1:]
else: epis=e
CheckNextEpi= int(epis)+1
if(len(str(CheckNextEpi))==1): CheckNextEpi = "0" + str(CheckNextEpi)
CheckNextEpi ="S" + str(s) + "E" + str(CheckNextEpi)
CurrentEpi = re.search('(?i)(s\d+e\d+)',mname)
link=main.OPENURL(murl)
link=link.replace('\r','').replace('\n','').replace('\t','')
if selfAddon.getSetting("hide-download-instructions") != "true": main.addLink("[COLOR red]For Download Options, Bring up Context Menu Over Selected Link.[/COLOR]",'','')
if CheckNextEpi in link: links = re.search('<td class="mnllinklist" align="right"><div class="right">'+CurrentEpi.group(1)+'.+?</div>(.+?)<div class="right">'+CheckNextEpi+'.+?</div>', link)
else: links = re.search('<td class="mnllinklist" align="right"><div class="right">'+CurrentEpi.group(1)+'.+?</div>(.+?)<!-- End of the page footer -->', link)
if links:
links = links.group(1)
match=re.compile('''<a onclick='.+?href="([^"]+?)" target=".+?"><div>.+?</div><span>Loading Time: <span class='.+?'>([^<]+?)</span><br/>Host:(.+?)<br/>''', re.DOTALL).findall(links)
for url, loadtime, name in match:
domain=name
name=name.replace(' ','')
if name[0:1]=='.': name=name[1:]
name=name.split('.')[0]
if main.supportedHost(name.strip().lower()):
try:mediaID=url.split('?id=')[1]
except:mediaID=url.split('http://')[1].split('/')[1]
main.addDown2(mname+' [COLOR red](Loading Time: '+loadtime+')[/COLOR]'+' [COLOR blue]'+name.upper()+'[/COLOR]',name.lower().strip()+'x1x8x'+mediaID,462,art+'/hosts/'+name.lower()+'.png',art+'/hosts/'+name.lower()+'.png')
示例2: resolveURL
def resolveURL(name,url):
main.addLink("[COLOR red]For Download Options, Bring up Context Menu Over Selected Link.[/COLOR]",'','')
html = main.OPENURL(url)
html = main.unescapes(html).replace('IFRAME SRC','iframe src')
match = re.findall('<iframe.+?src="([^"]*?)"',html)
for url in match:
main.addDown2(name.strip(),str(url),2,'.png','.png')
示例3: LINKSP4
def LINKSP4(mname,murl):
html = main.OPENURL(murl)
html = html.replace('href="http://oneclickmoviez.com/dws/MEGA','')
if selfAddon.getSetting("hide-download-instructions") != "true":
main.addLink("[COLOR red]For Download Options, Bring up Context Menu Over Selected Link.[/COLOR]",'','')
match=re.compile('<a rel="nofollow" href="([^"]+?)"[^>]*?>([^<]+?)</a>\s*?\(Single\)<',re.DOTALL).findall(html)
if match:
urls = []
exlude = "(BAYFILES|RYUSHARE)"
for url, host in match:
if not re.search(exlude,host):
urls.append(url)
if urls:
contents = main.batchOPENURL(urls, merge=False)
i = 0
for url, host in match:
if not re.search('(?i)'+exlude,host):
thumb = host.lower()
thumb = thumb.replace('www.','').replace('.in','').replace('.net','').replace('.com','').replace('.to','').replace('.org','').replace('.ch','')
vlink = getlink(contents[i])
i += 1
archive = re.compile('rar').findall(vlink)
if not archive:
import urlresolver
hosted_media = urlresolver.HostedMediaFile(url=vlink, title=host)
match2=re.compile("{'url': '(.+?)', 'host': '(.+?)', 'media_id': '.+?'}").findall(str(hosted_media))
for murl,name in match2:
main.addDown2(mname+' [COLOR blue]'+host+'[/COLOR]',murl,211,art+'/hosts/'+thumb+".png",art+'/hosts/'+thumb+".png")
示例4: LINKSP
def LINKSP(name,url):
link=main.OPENURL(url)
putlocker=re.compile('<a href="(.+?)">putlocker.com</a><br />').findall(link)
for url in putlocker:
match=re.compile('http://pastebin.com/.+?').findall(url)
if (len(match) > 0):
link=main.OPENURL(url)
main.addLink('If list is empty,means the links are downloadable only','','')
else:
main.addPlayb(name,url,134,"%s/art/put.png"%selfAddon.getAddonInfo("path"),"%s/art/put.png"%selfAddon.getAddonInfo("path"))
flashx=re.compile('<a href="(.+?)">flashx.tv</a><br />').findall(link)
for url in flashx:
main.addPlayb(name,url,134,"%s/art/flash.png"%selfAddon.getAddonInfo("path"),"%s/art/flash.png"%selfAddon.getAddonInfo("path"))
nowvideo=re.compile('<a href="(.+?)">nowvideo.eu</a><br />').findall(link)
for url in nowvideo:
main.addPlayb(name,url,134,"%s/art/nov.png"%selfAddon.getAddonInfo("path"),"%s/art/nov.png"%selfAddon.getAddonInfo("path"))
uploadc=re.compile('<a href="(.+?)">uploadc.com</a><br />').findall(link)
for url in uploadc:
main.addPlayb(name,url,134,"%s/art/uc.png"%selfAddon.getAddonInfo("path"),"%s/art/uc.png"%selfAddon.getAddonInfo("path"))
vidxden=re.compile('<a href="(.+?)">vidxden.com</a><br />').findall(link)
for url in vidxden:
main.addPlayb(name,url,134,"%s/art/vidx.png"%selfAddon.getAddonInfo("path"),"%s/art/vidx.png"%selfAddon.getAddonInfo("path"))
vidbux=re.compile('<a href="(.+?)">vidbux.com</a><br />').findall(link)
for url in vidbux:
main.addPlayb(name,url,134,"%s/art/vidb.png"%selfAddon.getAddonInfo("path"),"%s/art/vidb.png"%selfAddon.getAddonInfo("path"))
示例5: LINKLIST2
def LINKLIST2(mname,url):
if selfAddon.getSetting("hide-download-instructions") != "true": main.addLink("[COLOR red]For Download Options, Bring up Context Menu Over Selected Link.[/COLOR]",'','')
match=re.compile('href="(.+?)" target="_blank">(.+?)</a>',re.DOTALL).findall(url)
for url,host in match:
if main.supportedHost(host):
mname=main.removeColoredText(mname)
main.addDown2(mname+' [COLOR blue]'+host.upper()+' [/COLOR]',url,314,art+'/hosts/'+host.lower()+".png",art+'/hosts/'+host.lower()+".png")
示例6: History
def History():
main.GA("None","WatchHistory")
if selfAddon.getSetting("whistory") == "true":
history_items = wh.get_my_watch_history()
for item in history_items:
item_title = item['title']
item_url = item['url']
item_image = item['image_url']
item_fanart = item['fanart_url']
item_infolabels = item['infolabels']
item_isfolder = item['isfolder']
if item_image =='':
item_image= art+'/noimage.png'
main.addLink(item_title,item_url,item_image)
else:
dialog = xbmcgui.Dialog()
ok=dialog.ok('[B]MashUp History[/B]', 'Watch history is disabled' ,'To enable go to addon settings','and enable Watch History')
history_items = wh.get_my_watch_history()
for item in history_items:
item_title = item['title']
item_url = item['url']
item_image = item['image_url']
item_fanart = item['fanart_url']
item_infolabels = item['infolabels']
item_isfolder = item['isfolder']
main.addLink(item_title,item_url,item_image)
示例7: playlistList3
def playlistList3(mname, murl):
main.GA("Playlists-" + mname, "Watched")
link = main.OPENURL(murl)
link = (
link.replace("\r", "")
.replace("\n", "")
.replace("\t", "")
.replace(" ", "")
.replace("type=playlistname=Sorted by user-assigned order", "")
.replace("name=Sorted [COLOR=FF00FF00]by user-assigned order[/COLOR]", "")
.replace("name=Live Tv Channels Twothumb", "")
)
match = re.compile("name=(.+?)thumb=(.+?)date=.+?URL=(.+?)#").findall(link)
for name, thumb, url in match:
match2 = re.compile("http://(.+?)URL").findall(thumb)
if len(match2) > 0:
thumb = "http://" + match2[0]
url = url.replace("player=defaultrating=-1.00", "")
match3 = re.compile("rtmp").findall(url)
match4 = re.compile("timeout").findall(url)
if len(match3) > 0 and len(match4) == 0:
url = url + " timeout=15"
main.addLink(name, url, thumb)
match = re.compile("name=(.+?)thumb=(.+?)URL=(.+?)#").findall(link)
for name, thumb, url in match:
match2 = re.compile("http://(.+?)URL").findall(thumb)
if len(match2) > 0:
thumb = "http://" + match2[0]
url = url.replace("player=defaultrating=-1.00", "").replace("%20", " ").replace("player=default", "")
match3 = re.compile("rtmp").findall(url)
match4 = re.compile("timeout").findall(url)
if len(match3) > 0 and len(match4) == 0:
url = url + " timeout=15"
main.addLink(name, url, thumb)
示例8: LINKTV4
def LINKTV4(mname,url):
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting Hosts,3000)")
link=main.OPENURL(url)
link= link.replace('TV Rage','').replace('Homepage','').replace('href="http://www.tvrage.com','').replace('href="http://www.cbs.com','').replace('Torrent Search','').replace('Season Download','').replace('href="http://uppix.net','').replace('href="http://www.torrentz.com','').replace('href="http://directdownload.tv','')
ok=True
main.addLink("[COLOR red]For Download Options, Bring up Context Menu Over Selected Link.[/COLOR]",'','')
match=re.compile('<a href="(.+?)" target="_blank">(.+?)</a>').findall(link)
print len(match)
for url, host in match:
thumb=host.lower()
match5=re.compile('Part').findall(host)
if len(match5)>0:
match6=re.compile('http://(.+?)/.+?').findall(url)
for url2 in match6:
host2 = url2.replace('www.','').replace('.in','').replace('.net','').replace('.com','').replace('.to','').replace('.org','').replace('.ch','')
thumb=host2.lower()
match3=re.compile('720p').findall(url)
match4=re.compile('mp4').findall(url)
if len(match3)>0:
host =host+' [COLOR red]HD[/COLOR]'
elif len(match4)>0:
host =host+' [COLOR green]SD MP4[/COLOR]'
else:
host =host+' [COLOR blue]SD[/COLOR]'
match2=re.compile('rar').findall(url)
if len(match2)==0:
hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
match2=re.compile("{'url': '(.+?)', 'host': '(.+?)', 'media_id': '.+?'}").findall(str(hosted_media))
for murl,name in match2:
main.addDown2(mname+' [COLOR blue]'+host+'[/COLOR]',murl,210,art+thumb+".png",art+thumb+".png")
示例9: LISTHOSTERS
def LISTHOSTERS(name,url):
html = GETHTML(url)
if html == None: return
main.addLink("[COLOR red]For Download Options, Bring up Context Menu Over Selected Link.[/COLOR]",'','')
r = re.findall(r'class="td_cols"><a target=\'_blank\'.+?href=\'(.+?)\'>',html, re.M|re.DOTALL)
try:
t = re.findall(r'rel="nofollow">((?!.*\.rar).*)</a>', html, re.I)
r = r+t
except:
pass
if len(r) == 0:
addon.show_ok_dialog(['No Playable Streams Found,','It Might Be That They Are Still Being Uploaded,',
'Or They Are Unstreamable Archive Files'],'MashUP: TV-Release')
return
sources = []
for url in r:
media = urlresolver.HostedMediaFile(url=url)
sources.append(media)
sources = urlresolver.filter_source_list(sources)
r = re.findall(r'\'url\': \'(.+?)\', \'host\': \'(.+?)\'', str(sources), re.M)
for url, host in r:
r = re.findall(r'(.+?)\.',host)
if 'www.real-debrid.com' in host:
host = re.findall(r'//(.+?)/', url)
host = host[0].replace('www.','')
host = host.rpartition('.')
host = host[0]
else:
host = r[0]
main.addDown2(name+"[COLOR blue] :"+host.upper()+"[/COLOR]",url,1005,art+'/hosts/'+host+'.png',art+'/hosts/'+host+'.png')
示例10: Mplaylists
def Mplaylists(murl):
link=main.OPENURL(murl)
link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','')
r=re.findall('<poster>(.+?)</poster>',link)
if r:
vip=r[0]
else:
vip='Unknown'
f=re.findall('<fanart>(.+?)</fanart>',link)
if f:
fan=f[0]
else:
fan=art+'/fanart2.jpg'
match=re.compile('<name>(.+?)</name><link>(.+?)</link><thumbnail>(.+?)</thumbnail><date>(.+?)</date>').findall(link)
for name,url,thumb,date in match:
if '</vip>' in url:
main.addDirc(name+' [COLOR red] '+date+'[/COLOR]',url,260,thumb,'',fan,'','','')
else:
main.addDirc(name+' [COLOR red] '+date+'[/COLOR]',url,236,thumb,'',fan,'','','')
info=re.findall('<info><message>(.+?)</message><thumbnail>(.+?)</thumbnail></info>',link)
if info:
for msg,pic in info:
main.addLink(msg,'',pic)
popup=re.compile('<popup><name>([^<]+)</name.+?popImage>([^<]+)</popImage.+?thumbnail>([^<]+)</thumbnail></popup>').findall(link)
for name,image,thumb in popup:
main.addPlayc(name,image,244,thumb,'',fan,'','','')
main.GA("MoviePL",vip+"-Directory")
示例11: playlistList3
def playlistList3(mname,murl):
main.GA("Playlists-"+mname,"Watched")
link=main.OPENURL(murl)
link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','').replace('type=playlistname=Sorted by user-assigned order','').replace('name=Sorted [COLOR=FF00FF00]by user-assigned order[/COLOR]','').replace('name=Live Tv Channels Twothumb','')
match=re.compile('name=(.+?)thumb=(.+?)date=.+?URL=(.+?)#').findall(link)
for name,thumb,url in match:
match2=re.compile('http://(.+?)URL').findall(thumb)
if len(match2)>0:
thumb ='http://'+match2[0]
url=url.replace('player=defaultrating=-1.00','')
match3=re.compile('rtmp').findall(url)
match4=re.compile('timeout').findall(url)
if len(match3)>0 and len(match4)==0:
url=url+' timeout=15'
main.addLink(name,url,thumb)
match=re.compile('name=(.+?)thumb=(.+?)URL=(.+?)#').findall(link)
for name,thumb,url in match:
match2=re.compile('http://(.+?)URL').findall(thumb)
if len(match2)>0:
thumb ='http://'+match2[0]
url=url.replace('player=defaultrating=-1.00','').replace('%20',' ').replace('player=default','')
match3=re.compile('rtmp').findall(url)
match4=re.compile('timeout').findall(url)
if len(match3)>0 and len(match4)==0:
url=url+' timeout=15'
main.addLink(name,url,thumb)
示例12: playlistList6
def playlistList6(mname,murl):
main.GA("Playlists-"+mname,"Watched")
link=main.OPENURL(murl)
link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','').replace('type=playlistname=Sorted by user-assigned order','').replace('name=Sorted [COLOR=FF00FF00]by user-assigned order[/COLOR]','').replace('name=Live Tv Channels Twothumb','')
match=re.compile('<item><titl[^>]+>([^<]+)</title><link>(.+?)</link><thumbnail>(.+?)</thumbnail></item>').findall(link)
for name,url,thumb in sorted(match):
main.addLink(name,url,thumb)
示例13: Mplaylists
def Mplaylists(murl):
link = main.OPENURL(murl)
link = link.replace("\r", "").replace("\n", "").replace("\t", "").replace(" ", "")
r = re.findall("<poster>(.+?)</poster>", link)
if r:
vip = r[0]
else:
vip = "Unknown"
f = re.findall("<fanart>(.+?)</fanart>", link)
if f:
fan = f[0]
else:
fan = art + "/fanart2.jpg"
match = re.compile("<name>(.+?)</name><link>(.+?)</link><thumbnail>(.+?)</thumbnail><date>(.+?)</date>").findall(
link
)
for name, url, thumb, date in match:
if "</vip>" in url:
main.addDirc(name + " [COLOR red] " + date + "[/COLOR]", url, 260, thumb, "", fan, "", "", "")
else:
main.addDirc(name + " [COLOR red] " + date + "[/COLOR]", url, 236, thumb, "", fan, "", "", "")
info = re.findall("<info><message>(.+?)</message><thumbnail>(.+?)</thumbnail></info>", link)
if info:
for msg, pic in info:
main.addLink(msg, "", pic)
popup = re.compile(
"<popup><name>([^<]+)</name.+?popImage>([^<]+)</popImage.+?thumbnail>([^<]+)</thumbnail></popup>"
).findall(link)
for name, image, thumb in popup:
main.addPlayc(name, image, 244, thumb, "", fan, "", "", "")
main.GA("MoviePL", vip + "-Directory")
示例14: LIST
def LIST(murl):
main.addLink('[COLOR red]Not the best source, but some links work in HSBS[/COLOR]','mess',art+'/link.png')
main.addLink('[COLOR red]Try to avoid the same Hosts that are in groups of 4, possible rar files[/COLOR]','mess',art+'/link.png')
link=main.OPENURL(murl)
link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','')
link=main.unescapes(link)
match=re.compile('''entry-title'><a href='(.+?)'>.+?<img alt="(.+?)" src="(.+?)"''').findall(link)
dialogWait = xbmcgui.DialogProgress()
ret = dialogWait.create('Please wait until Movie list is cached.')
totalLinks = len(match)
loadedLinks = 0
remaining_display = 'Movies loaded :: [B]'+str(loadedLinks)+' / '+str(totalLinks)+'[/B].'
dialogWait.update(0,'[B]Will load instantly from now on[/B]',remaining_display)
for url,name,thumb in match:
name=name.replace('Download ','').replace('" height="400','')
main.addPlayM(name,url,225,thumb,'','','','','')
loadedLinks = loadedLinks + 1
percent = (loadedLinks * 100)/totalLinks
remaining_display = 'Movies loaded :: [B]'+str(loadedLinks)+' / '+str(totalLinks)+'[/B].'
dialogWait.update(percent,'[B]Will load instantly from now on[/B]',remaining_display)
if (dialogWait.iscanceled()):
return False
dialogWait.close()
del dialogWait
paginate=re.compile("""<a class='blog-pager-older-link' href='(.+?)' id='.+?' title='.+?'>Next.+?</a>""").findall(link)
if (len(paginate)>0):
for purl in paginate:
main.addDir('[COLOR blue]Next[/COLOR]',purl,224,art+'/next2.png')
示例15: MAINNHL
def MAINNHL(murl):
source_media = {}
from datetime import datetime
datex=datetime.now().strftime('%Y%m%d')
xml='http://live.nhl.com/GameData/SeasonSchedule-20142015.json'
link=main.OPENURL(xml)
link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','').replace(' ','')
main.addDir('[COLOR red]Archived Games[/COLOR]','Archived',394,art+'/nhl.png')
if 'Archived' not in murl:
main.addLink("[COLOR red]Live Games Windows Only, Requires some modifications to get working visit forum.[/COLOR]",'','')
match=re.compile('{"id":(.+?),"est":"(.+?)","a":"(.+?)","h":"(.+?)"}',re.DOTALL).findall(link)
for id,timed,ateam,hteam in match:
split= re.search('(.+?)\s(\d+:\d+):\d+',timed)
split1=str(split.group(1))
split2=str(split.group(2))
if 'Archived' in murl:
if int(split1)<=int(datex):
dates= re.search('(\d{4})(\d{2})(\d{2})',split1)
date=str(dates.group(2))+"/"+str(dates.group(3))+"/"+str(dates.group(1))
timed = time.strftime("%I:%M %p", time.strptime(split2, "%H:%M"))
main.addDir(ateam+' at '+hteam+' [COLOR red]('+timed+')[/COLOR] [COLOR blue]('+date+')[/COLOR]',id,395,art+'/nhl.png')
else:
if datex == split1:
dates= re.search('(\d{4})(\d{2})(\d{2})',split1)
date=str(dates.group(2))+"/"+str(dates.group(3))+"/"+str(dates.group(1))
timed = time.strftime("%I:%M %p", time.strptime(split2, "%H:%M"))
main.addDir(ateam+' at '+hteam+' [COLOR red]('+timed+')[/COLOR] [COLOR blue]('+date+')[/COLOR]',id,395,art+'/nhl.png')