def getIdols(url, hdr): content=util.getURL(url, hdr) if content!=False: alphabet=util.extractAll(content, '<ul class="links">', '</ul>') for letter in alphabet: idols=util.extractAll(letter, '<li>', '</li>') for idol in idols: if util.makeAscii(util.extract(idol, 'title="', '"'))!="": util.addDir(util.makeAscii(util.extract(idol, 'title="', '"')), util.extract(idol, 'href="', '"').encode('utf-8'), 1, "") xbmcplugin.endOfDirectory(int(sysarg))
def getStars(params): content=util.getURL(params['url'], hdr) if content!=False: alphabet=util.extractAll(content, "<ul class='small-block-grid-5 stars'>", '</ul>') for letter in alphabet: stars=util.extractAll(letter, '<li>', '</li>') for star in stars: name=util.extract(star, '">', '</a>') url=util.extract(star, 'href="', '"') util.addDir(name, url, 2, "","") xbmcplugin.endOfDirectory(int(sysarg))
def getID(name): url = urllib.urlopen(web) shows = url.read() url.close() shows = util.extractAll(shows, "<select name=\"SearchString\">", "</select>") shows = shows[0].strip() shows = util.extractAll(shows, "<option value=\"", "</option>") for show in shows: show = show.split("\">") if (re.search(name,show[1],re.IGNORECASE)): return (show[0])
def getID(name): url = urllib.urlopen(web) shows = url.read() url.close() shows = util.extractAll(shows, "<select name=\"SearchString\">", "</select>") shows = shows[0].strip() shows = util.extractAll(shows, "<option value=\"", "</option>") for show in shows: show = show.split("\">") if (re.search(name, show[1], re.IGNORECASE)): return (show[0])
def getStars(params): content = util.getURL(params['url'], hdr) if content != False: alphabet = util.extractAll(content, "<ul class='small-block-grid-5 stars'>", '</ul>') for letter in alphabet: stars = util.extractAll(letter, '<li>', '</li>') for star in stars: name = util.extract(star, '">', '</a>') url = util.extract(star, 'href="', '"') util.addDir(name, url, 2, "", "") xbmcplugin.endOfDirectory(int(sysarg))
def getPopular(url, hdr): param={'play':1} toReturn=[] content=util.getURL(url, hdr) if content!=False: gs = goslate.Goslate() popularFilms=util.extract(content, '<div id="slider1"', '<div class="peliculas">') films=util.extractAll(popularFilms, '<a href', '</a>') for film in films: title=util.extract(film, 'alt="', 'width=') if '[' in title and ']' in title: videoCode=util.extract(title.encode("utf-8"), "[", "]") videoTitle=gs.translate(util.extract(title.encode('utf-8'), "]", '"'), 'en').title() title=util.makeAscii("["+videoCode+"] ")+videoTitle.encode('utf-8') else: title=gs.translate(title.encode('utf-8').replace("width=", ""), 'en').title() plot="no plot" starring="no starring" studio="no studio" date="no date" url=util.extract(film, '="', '"') poster=util.extract(film, '<img src="', '" alt') fanart=poster.replace("ps.jpg", "pl.jpg") toReturn.append([title, plot, starring, studio, date, url, poster, fanart]) return toReturn
def getPopular(url, hdr): toReturn=[] content=util.getURL(url, hdr) if content!=False: gs = goslate.Goslate() popularFilms=util.extract(content, '<div id="dp-widget-posts-2" class="widget widget-posts">', '<!--end #sidebar-->') films=util.extractAll(popularFilms, '<div class="thumb">', '</div>') for film in films: title=util.extract(film, 'title="', 'href') if '[' in title and ']' in title: videoCode=util.extract(title.encode("utf-8"), "[", "]") videoTitle=gs.translate(util.extract(title.encode('utf-8'), "]", '"'), 'en').title() title=util.makeAscii("["+videoCode+"] ")+videoTitle.encode('utf-8') else: title=gs.translate(title.encode('utf-8').replace('"', ""), 'en').title() plot="no plot" starring="no starring" studio="no studio" date="no date" url=util.extract(film, 'href="', '"') poster=util.extract(film, '<img src="', '" alt') fanart=poster.replace("ps.jpg", "pl.jpg") toReturn.append([title, plot, starring, studio, date, url, poster, fanart]) return toReturn
def menuLink(params): caption = 'try HD first: #1--OK.ru ,#2--openload(try it several clicks until work) ' action = {'info': 1} cap_link = util.makeLink(action) util.addMenuItem(caption, cap_link, icon, fanart, False) url = (params['video']) videoPage = requests.get(url) if videoPage and videoPage.status_code == 200: cont = videoPage.text vidlinks = util.extractAll(cont, '<div id="tab', '/div>') for vidlink in vidlinks: t = util.extract(vidlink, '://', '/') v = util.extract(vidlink, 'SRC="', '"') or util.extract( vidlink, 'src="', '"') paramz = {'play': 1} paramz['title'] = t paramz['videolink'] = v paramz['image'] = params['image'] link = util.makeLink(paramz) util.addMenuItem(paramz['title'], link, 'DefaultVideo.png', paramz['image'], False) else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url)) util.endListing()
def getCategories(url): param = {'category': 1} content = util.getURL(url, hdr) if content != False: cats = util.extractAll(content, '<div class="item">', '<div class="item">') for film in cats: param['title'] = makeAscii(util.extract(film, 'title="', '"')) param['url'] = 'http://www.likuoo.com' + util.extract( film, '<a href="', '" title="') param['poster'] = util.extract(film, 'src="', '" title="') param['fanart'] = param['poster'] xbmc.log("Play URL:" + param['url'], xbmc.LOGERROR) if param['url'] != None: u = sys.argv[0] + "?url=" + param[ 'url'] + "&mode=2&name=" + urllib.quote_plus( param['title']) + "&poster=" + param['poster'] liz = xbmcgui.ListItem(param['title'], iconImage="DefaultVideo.png", thumbnailImage=param['poster']) liz.setInfo(type="Video", infoLabels={ "Title": param['title'], "Plot": "" }) liz.setProperty("Poster_Image", param['poster']) ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=True) xbmcplugin.endOfDirectory(int(sysarg))
def showVideos(url, hdr): content=util.getURL(url, hdr) toReturn=[] if content!=False: gs = goslate.Goslate() allfilms=util.extract(content, '<div class="nag cf">', '<!-- end .loop-content -->') if allfilms!=None: films=util.extractAll(allfilms, '<div id="post-', '<!-- end #post-') for film in films: details=util.extract(film, '<div class="thumb">', '</div>') title=util.replaceHTMLCodes(util.extract(details, 'title="', ' href')) if '[' in title and ']' in title: videoCode=util.extract(title.encode("utf-8"), "[", "]") videoTitle=gs.translate(util.extract(title.encode('utf-8'), "]", '"'), 'en').title() title=util.makeAscii("["+videoCode+"] ")+videoTitle.encode('utf-8') plot="no plot" starring="no starring" studio="no studio" date="no date" url=util.extract(film, 'href="', '"') poster=util.extract(film, '<img src="', '" alt').replace("pl.jpg", "ps.jpg") fanart=poster.replace("ps.jpg", "pl.jpg") toReturn.append([title, plot, starring, studio, date, url, poster, fanart]) checkNext=util.extract(content, '<a class="nextpostslink" rel="next" href="', '"') if checkNext!=None: toReturn.append(['next', checkNext]) return toReturn
def search(): dialog = xbmcgui.Dialog() i = dialog.input('Enter Movie Name:', type=xbmcgui.INPUT_ALPHANUM) q = urllib.quote(i, safe="%/:=&?~#+!$,;'@()*[]") baseurl = 'https://www.google.com.sa/search?rlz=1C1CHZL_enSA679SA679&espv=2&q=el7al.tv+' print q url = baseurl + q + '&oq=el7al.tv+' + q + '&gs_l=serp.3...33231.51533.0.52317.42.30.8.0.0.0.211.4360.0j21j4.25.0....0...1c.1.64.serp..11.22.2813.0..0j30i10k1j0i13k1j0i13i30k1j0i7i30k1j35i39k1j0i131k1j0i10i30k1j0i13i10k1.w4AW4pCV-E4' response = requests.get(url) if response and response.status_code == 200: cont = response.text videos = util.extractAll(cont, '<a href="/url?q=http://el7l.tv/online', 'class="_cD"') for video in videos: t = util.extract(video, '>', '</a>') t1 = (t.replace('\n', '').replace('\t', '').replace('</b>', '').replace('<b>', '').lstrip()) u1 = (util.extract(video, '/', '&')) u = 'http://el7l.tv/play/' + u1 params = {'search': 1} params['url'] = u params['title'] = t1 link = util.makeLink(params) util.addMenuItem(params['title'], link, None, None, True) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def ololink(params): caption = 'If you have trouble:goto:https://sites.google.com/site/kokiarbic/help' action = {'info': 1} cap_link = util.makeLink(action) util.addMenuItem(caption, cap_link, icon, fanart, False) url = (params['video']) videoPage = requests.get(url) if videoPage and videoPage.status_code == 200: cont = videoPage.text vidlinks = util.extractAll(cont, '"playerst"', '/iframe>') for vidlink in vidlinks: t = 'Movielink' v = util.extract(vidlink, 'SRC="', '"') or util.extract( vidlink, 'src="', '"') paramz = {'play': 1} paramz['title'] = t paramz['videolink'] = v paramz['image'] = params['image'] link = util.makeLink(paramz) util.addMenuItem(paramz['title'], link, 'DefaultVideo.png', paramz['image'], False) else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url)) util.endListing()
def pages(params): page = int(params['page']) p = 'page:' + str(page) util.addMenuItem(p, None, None, None, False) Baseurl = 'http://el7l.tv/online2/12/_%D8%A7%D9%81%D9%84%D8%A7%D9%85_%D8%B9%D8%B1%D8%A8%D9%8A%D8%A9/' url = Baseurl + '%d.html' % (page) response = requests.get(url) if response and response.status_code == 200: cont = response.text videos = util.extractAll(cont, '<div class="file_index">', '/div>') for video in videos: t = util.extract(video, 'alt="', '"') v = util.extract(video, 'a href="http://el7l.tv/online', '"') vp = 'http://el7l.tv/play' + v i = util.extract(video, 'img src="', '"') params = {'listing': 1} params['title'] = t params['video'] = vp params['image'] = i link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], True) else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url)) parms = {'old': 1, 'page': str(page + 1)} page_link = util.makeLink(parms) util.addMenuItem('Next Page:>> ', page_link, None, None, True) util.endListing()
def showVideos(url, hdr): content=util.getURL(url, hdr) toReturn=[] if content!=False: gs = goslate.Goslate() allfilms=util.extract(content, '<div class="items">', '<div class="lateral">') films=util.extractAll(allfilms, '<div class="item">', '<div class="item">') for film in films: title=util.replaceHTMLCodes(util.extract(film, '<h2>', 'h2>')) if '[' in title and ']' in title: videoCode=util.extract(title.encode("utf-8"), "[", "]") videoTitle=gs.translate(util.extract(title.encode('utf-8'), "]", '</'), 'en').title() title=util.makeAscii("["+videoCode+"] ")+videoTitle.encode('utf-8') else: title=gs.translate(title.encode('utf-8').replace("</", ""), 'en').title() plot="no plot" starring="no starring" studio="no studio" date="no date" url=util.extract(film, '<a href="', '"') poster=util.extract(film, '<img src="', '" alt') fanart=poster.replace("ps.jpg", "pl.jpg") toReturn.append([title, plot, starring, studio, date, url, poster, fanart]) if '<link rel="next" href="' in content: toReturn.append(["next", util.extract(content, '<link rel="next" href="', '"')]) return toReturn
def getCategories(params) : param={'categories':1} content=util.getURL(params['url'], hdr) if content!=False: contents=util.extract(content, '<ul class="small-block-grid-4 videos-cats">', '</ul>') films=util.extractAll(contents, '<li>', '</li>') for film in films: title=util.extract(film, '<div class="media-panel-title category-title">', '</div>') param['title']=util.extract(title, '">', '</a>') param['plot']=util.extract(film, '<div class="media-panel-info">', '</div>') param['url']=util.extract(title, '<a href="', '"') param['poster']=util.extract(film, '<img src="', '" />') param['fanart']=param['poster'] if param['url']!=None: u=sys.argv[0]+"?url="+param['url']+"&mode=2&name="+urllib.quote_plus(param['title'])+"&poster="+param['poster'] liz=xbmcgui.ListItem(param['title'], iconImage="DefaultVideo.png", thumbnailImage=param['poster']) liz.setInfo( type="Video", infoLabels={ "Title": param['title'],"Plot": param['plot']} ) liz.setProperty("Fanart_Image", param['fanart']) liz.setProperty("Landscape_Image", param['fanart']) liz.setProperty("Poster_Image", param['poster']) ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True) next=util.extract(content, '<div class="pagination">', '</div>') if next!=None: next=util.extract(next, '<li class="active">', '</a>') if next!=None: url=util.extract(next, '<a href="', '"') util.addDir("Next >", url, 2, "","") xbmcplugin.endOfDirectory(int(sysarg))
def getVids(params) : param={'play':1} content=util.getURL(params['url'], hdr) if content!=False: films=util.extractAll(content, '<div class="item">', '<div class="item">') for film in films: param['title']=makeAscii(util.extract(film, 'title="', '"')) param['url']=util.extract(film, '<a href="', '" title="') param['poster']=util.extract(film, 'src="', '" title="') param['fanart']=param['poster'] if param['url']!=None: u=sys.argv[0]+"?url="+param['url']+"&play="+str(4)+"&name="+urllib.quote_plus(param['title'])+"&poster="+param['poster'] liz=xbmcgui.ListItem(param['title'], iconImage="DefaultVideo.png", thumbnailImage=param['poster']) liz.setInfo( type="Video", infoLabels={ "Title": param['title'],"Plot": ""} ) liz.setProperty("Poster_Image", param['poster']) ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True) next=util.extract(content, '<span class="current">', '</span>') #xbmc.log(">>>>>"+str(next), xbmc.LOGERROR) if next!=None: next=int(next)+1 #xbmc.log('http://www.likuoo.com/new/'+str(next), xbmc.LOGERROR) if 'http://www.likuoo.com/new/'+str(next) in content: util.addDir("Next >", 'http://www.likuoo.com/new/'+str(next), 2, "","") xbmcplugin.endOfDirectory(int(sysarg))
def playVideo(params): content=util.getURL(params['url'].encode('utf-8'), hdr) if content!=False: """if "https://openload" in content: xbmc.log("openload", xbmc.LOGERROR) download=util.extract(content, '<iframe src="https://openload', '"') openloadurl ='http://openload'+download.encode('utf-8') videourl=resolve(openloadurl) ol=util.getURL(openloadurl, hdr) videourl=util.extract(ol, '<source type="video/mp4" src="', '"') """ if 'videourl' not in locals() and "http://videowood.tv/embed/" in content: xbmc.log("videowood", xbmc.LOGERROR) download=util.extract(content, 'http://videowood.tv/embed/', '"') videowoodurl='http://videowood.tv/embed/'+download vw=util.getURL(videowoodurl, hdr) #xbmc.log(vw, xbmc.LOGERROR) videourls=util.extractAll(vw, "file: '", "',") for vid in videourls: if '.mp4' in vid: videourl=vid break try: videourl except: result="eval("+util.extract(vw, "eval(", "</script") xbmc.log(result, xbmc.LOGERROR) result=jsunpack.unpack(result) xbmc.log(result, xbmc.LOGERROR) if 'videourl' not in locals() and "videomega.tv" in content: xbmc.log("videomega", xbmc.LOGERROR) videosource=content if re.search("videomega.tv/iframe.js", videosource, re.DOTALL | re.IGNORECASE): hashref = re.compile("""javascript["']>ref=['"]([^'"]+)""", re.DOTALL | re.IGNORECASE).findall(videosource) elif re.search("videomega.tv/iframe.php", videosource, re.DOTALL | re.IGNORECASE): hashref = re.compile(r"iframe\.php\?ref=([^&]+)&", re.DOTALL | re.IGNORECASE).findall(videosource) else: hashkey = re.compile("""hashkey=([^"']+)""", re.DOTALL | re.IGNORECASE).findall(videosource) if len(hashkey) > 1: i = 1 hashlist = [] for x in hashkey: hashlist.append('Part ' + str(i)) i += 1 vmvideo = dialog.select('Multiple parts found', hashlist) hashkey = hashkey[vmvideo] else: hashkey = hashkey[0] hashpage = getHtml('http://videomega.tv/validatehash.php?hashkey='+hashkey, params['url'].encode('utf-8')) hashref = re.compile('ref="([^"]+)', re.DOTALL | re.IGNORECASE).findall(hashpage) videopage = getHtml('http://videomega.tv/view.php?ref='+hashref[0], params['url'].encode('utf-8')) videourl = re.compile('<source src="([^"]+)"', re.DOTALL | re.IGNORECASE).findall(videopage) videourl = videourl[0] xbmc.log(videourl, xbmc.LOGERROR) util.playMedia(params['name'], params['poster'],videourl, "Video")
def buildMenu(): url = "http://nottstv.com/programmes/" response = urllib2.urlopen(url) path = addon.getAddonInfo('path') if response and response.getcode() == 200: content = response.read() params = {'programme': 1} params['label'] = "Notts TV News Reports" params['tag'] = "news" link = util.makeLink(params) util.addMenuItem(params['label'], link, 'news.png', path + '/images/news.png', True) programmes = util.extractAll(content, 'http://nottstv.com/programmes/', '</a>') for programmelist in programmes: if "jQuery" in programmelist: continue programme = programmelist.split('">') if programme[1] == "Programmes": continue params = {'programme': 1} params['label'] = programme[1] params['tag'] = programme[0] link = util.makeLink(params) thumb = 'DefaultVideo.png' if programme[1] == 'Nottingham Now and Then': thumb = path + '/images/nowandthen.png' if programme[1] == 'Mass Bolero': thumb = path + '/images/massbolero.png' if programme[1] == 'The 6:30 Show': thumb = path + '/images/630show.png' if programme[1] == 'Channel 8 Debate': thumb = path + '/images/8debate.png' if programme[1] == 'Day in the Life': thumb = path + '/images/dayinthelife.png' if programme[1] == 'Inside Industry Week': thumb = path + '/images/insideindustry.jpg' if programme[1] == 'Noise Floor': thumb = path + '/images/noisefloor.png' if programme[1] == 'The Boot Room': thumb = path + '/images/bootroom.png' if programme[1] == 'The Locker Room': thumb = path + '/images/lockerroom.png' if programme[1] == 'Working Week': thumb = path + '/images/workingweek.png' print path util.addMenuItem(params['label'], link, thumb, thumb, True) util.addCategory('>> Current Affairs', 'current-affairs') util.addCategory('>> Entertainment', 'entertainment') util.addCategory('>> Lifestyle', 'lifestyle') util.addCategory('>> Sport', 'sport', path + '/images/sport.jpg') util.addCategory('>> Music', 'music') util.addCategory('>> Specials', 'specials') util.endListing() else: util.showError('plugin.video.nottstv', 'Could not open URL %s to create menu' % (url)) pass
def getGenres(url, hdr): content=util.getURL(url, hdr) if content!=False: allGenres=util.extract(content, '<ul class="scrolling cat">', '</ul>') genres=util.extractAll(allGenres, '<a href', 'a>') for genre in genres: util.addDir(util.extract(genre, '>', '</'), util.extract(genre, '="', '"'), 1, "") xbmcplugin.endOfDirectory(int(sysarg))
def getStudios(url, hdr): content=util.getURL(url, hdr) if content!=False: studios=util.extractAll(content, '<a href="http://ivhunter.com/studios', 'a>') for studio in studios: if util.extract(studio, '">', '</')!="Studios": util.addDir(util.extract(studio, '">', '</'), "http://ivhunter.com/studios/"+util.extract(studio, '/', '/'), 1, "") xbmcplugin.endOfDirectory(int(sysarg))
def buildSubMenu(params): content=util.getURL('http://www.asianteensfor.me/javlist/blank/', hdr) if content!=False: xoxo=util.extract(content, '<ul id="'+params['url']+'">', '</ul>') subOptions=util.extractAll(xoxo, '<li class="cat-item', '</li>') for sub in subOptions: name=util.extract(sub, '/" >', '</a>') url=util.extract(sub, '<a href="', '" >') util.addDir(name, url, 5, "","") xbmcplugin.endOfDirectory(int(sysarg))
def buildMenu(): url = WEB_PAGE_BASE response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() makeLinks = util.extract(content, '"nav navbar-nav menu"', '</ul>') links = util.extractAll(makeLinks,'a href="','</a>') for link in links: params = {'makeCategories':1} params['link'] = util.extract(link,'href="','\"') #params['title'] = util.extract(link,'/1">','</a>') print makeLinks
def getVids(url) : param={'play':1} content=util.getURL(url, hdr) if content!=False: films=util.extractAll(content, '<vid>', '</vid>') movielist = "[" currentrow = 0 itemlist = list() for film in films: param['title']=replaceHTMLCodes(util.extract(film, '<name>', '</name>')) param['plot']=makeAscii(replaceHTMLCodes(util.extract(film, '<plot>', '</plot>'))) param['starring']=makeAscii(replaceHTMLCodes(util.extract(film, '<starring>', '</starring>'))) param['studio']=makeAscii(replaceHTMLCodes(util.extract(film, '<studio>', '</studio>'))) param['date']=util.extract(film, '<date>', '</date>') param['url']=util.extract(film, '<url>', '</url>') param['poster']=util.extract(film, 'class="cover" src="', '" />') param['fanart']=util.extract(film, 'class="preview" src="', '" />') u=sys.argv[0]+"?url="+param['url']+"&play="+str(4)+"&name="+param['title']+"&poster="+param['poster'] liz=xbmcgui.ListItem(param['title'], iconImage="DefaultVideo.png", thumbnailImage=param['poster']) liz.setInfo( type="Video", infoLabels={ "Title": param['title'],"Plot": param['plot']} ) liz.setProperty("Fanart_Image", param['fanart']) liz.setProperty("Landscape_Image", param['fanart']) liz.setProperty("Poster_Image", param['poster']) #moo movielist += json.dumps({ 'title': param["title"], 'url': param["url"] }) + "," linkMenu = [] #reset item context menu for a reason linkMenu.append(('Download', 'RunPlugin(plugin://%s/?action=download&videoname=%s&videourl=%s)' % (ADDON_ID,param['title'],param['url']))) #liz.addContextMenuItems(linkMenu,replaceItems=True) entry = (u,liz,True,linkMenu); itemlist.append(entry) movielist = movielist[:-1] + "]" if len(itemlist) > 0: #movielist = urllib.unquote_plus(str(movielist)) settings.setSetting(id="movielist", value=movielist) for item in itemlist: linkMenu = item[3] linkMenu.append(('Download All', 'RunPlugin(plugin://%s/?action=downloadall)' % (ADDON_ID))) item[1].addContextMenuItems(linkMenu,replaceItems=True) del itemlist[-1] ok=xbmcplugin.addDirectoryItems(handle=int(sys.argv[1]),items=itemlist) if "Older posts" in content: next=util.extract(content, '<div id="next">', '</div>') url=util.extract(next, '"', '"') util.addDir("Next >", url, 5, "","") xbmcplugin.endOfDirectory(int(sysarg))
def buildMainMenu(): util.addDir("Recently Added","Recently Added", 2, "","") # get the rest of the menu items from the website, should be easier to update content=util.getURL('http://www.asianteensfor.me/javlist/blank/', hdr) if content!=False: xoxo=util.extract(content, '<ul class="xoxo">','</body>') headings=util.extractAll(xoxo, '<li id="lc_taxonomy-', '</ul></div></li>') for heading in headings: name=util.extract(heading, '<h3 class="widget-title">', '</h3>') url="lct-widget-"+name.lower() util.addDir(name, url, 3, "","") util.addDir("Search","Search", 4, "","") xbmcplugin.endOfDirectory(int(sysarg))
def buildSubMenu(params): response = urllib2.urlopen(params['video']) if response and response.getcode() == 200: content = response.read() videos = util.extractAll(content, '<td width="40%" align="center">', '/td>') for video in videos: params = {'play':1} params['video'] = WEB_PAGE_BASE + util.extract(video, 'a href="', '\"') params['image'] = WEB_PAGE_BASE + util.extract(video, 'img src="', '\"') params['title'] = util.extract(video, '<p align="center">', '</p>') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], False) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def getCategories(params): param = {'categories': 1} content = util.getURL(params['url'], hdr) if content != False: contents = util.extract(content, '<ul class="small-block-grid-4 videos-cats">', '</ul>') films = util.extractAll(contents, '<li>', '</li>') for film in films: title = util.extract( film, '<div class="media-panel-title category-title">', '</div>') param['title'] = util.extract(title, '">', '</a>') param['plot'] = util.extract(film, '<div class="media-panel-info">', '</div>') param['url'] = util.extract(title, '<a href="', '"') param['poster'] = util.extract(film, '<img src="', '" />') param['fanart'] = param['poster'] if param['url'] != None: u = sys.argv[0] + "?url=" + param[ 'url'] + "&mode=2&name=" + urllib.quote_plus( param['title']) + "&poster=" + param['poster'] liz = xbmcgui.ListItem(param['title'], iconImage="DefaultVideo.png", thumbnailImage=param['poster']) liz.setInfo(type="Video", infoLabels={ "Title": param['title'], "Plot": param['plot'] }) liz.setProperty("Fanart_Image", param['fanart']) liz.setProperty("Landscape_Image", param['fanart']) liz.setProperty("Poster_Image", param['poster']) ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=True) next = util.extract(content, '<div class="pagination">', '</div>') if next != None: next = util.extract(next, '<li class="active">', '</a>') if next != None: url = util.extract(next, '<a href="', '"') util.addDir("Next >", url, 2, "", "") xbmcplugin.endOfDirectory(int(sysarg))
def buildMenu(): url = WEB_PAGE_BASE + '/livetv' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() videos = util.extractAll(content, '<a class="channel_link"', '</a>') for video in videos: params = {'play':1} params['video'] = WEB_PAGE_BASE + util.extract(video,'href="','\"') params['image'] = util.extract(video,'img src="','\"') params['title'] = util.extract(video,'channel="','\"') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], False) xbmc.executebuiltin("Container.SetViewMode(52)") util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' %(url))
def getCategories(url): param={'category':1} content=util.getURL(url, hdr) if content!=False: cats=util.extractAll(content, '<div class="item">', '<div class="item">') for film in cats: param['title']=makeAscii(util.extract(film, 'title="', '"')) param['url']='http://www.likuoo.com'+util.extract(film, '<a href="', '" title="') param['poster']=util.extract(film, 'src="', '" title="') param['fanart']=param['poster'] xbmc.log("Play URL:"+param['url'], xbmc.LOGERROR) if param['url']!=None: u=sys.argv[0]+"?url="+param['url']+"&mode=2&name="+urllib.quote_plus(param['title'])+"&poster="+param['poster'] liz=xbmcgui.ListItem(param['title'], iconImage="DefaultVideo.png", thumbnailImage=param['poster']) liz.setInfo( type="Video", infoLabels={ "Title": param['title'],"Plot": ""} ) liz.setProperty("Poster_Image", param['poster']) ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True) xbmcplugin.endOfDirectory(int(sysarg))
def buildMenu(): url = WEB_PAGE_BASE response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() videos = util.extractAll(content, '<video duration', '</video>') for video in videos: params = {'play': 1} params['video'] = util.extract(video, 'video_id="', '"') params['image'] = util.extract(video, 'default_thumb="', '"') params['title'] = util.extract(video, '<title><![CDATA[', ']]') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], False) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def buildPlay(inputParams): url = WEB_PAGE_BASE + inputParams['link'] response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() links = util.extractAll(content, '<div class="col">', '</span>') for link in links: params = {'makePlay':1} params['title'] = util.extract(link,'data-original-title="','\"') params['link'] = util.extract(link,'href="','\"') params['image'] = util.extract(link,'img src="','"') link = util.makeLink(params) util.addMenuItem(params['title'], link, params['image'], params['image'], True) util.endListing() xbmc.executebuiltin("Container.SetViewMode(506)") else: util.showError(ADDON_ID, 'Could not open URL SHOW %s to create menu' %(url))
def buildCategories(): url = WEB_PAGE_BASE + '/the-loai/music' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() links = util.extractAll(content, 'idscroll="', '<ul class="thumn">') for link in links: params = {'makeCategories':1} params['link'] = util.extract(link,'href="','\"') params['title'] = util.extract(link,'/1">','</a>') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', 'DefaultVideo.png', True) util.endListing() xbmc.executebuiltin("Container.SetViewMode(506)") else: util.showError(ADDON_ID, 'Could not open URL CATEGORIES %s to create menu' %(url))
def buildMenu(): url = 'http://play.fpt.vn/' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() makeLinks = util.extract(content, '"nav navbar-nav menu"', '</ul>') links = util.extractAll(makeLinks,'<li >','a>') for link in links: params = {'key':'makeMenu'} params['link'] = util.extract(link,'href="','\"') params['title'] = util.extract(link,'\">','</') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', 'DefaultVideo.png', True) util.endListing() xbmc.executebuiltin("Container.SetViewMode(500)") else: util.showError(ADDON_ID, 'Could not open URL CATEGORIES %s to create menu' %(url))
def buildMenu(): url = WEB_PAGE_BASE + '/livetv' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() videos = util.extractAll(content, '<a class="channel_link"', '</a>') for video in videos: params = {'play': 1} params['video'] = WEB_PAGE_BASE + util.extract( video, 'href="', '\"') params['image'] = util.extract(video, 'img src="', '\"') params['title'] = util.extract(video, 'channel="', '\"') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], False) xbmc.executebuiltin("Container.SetViewMode(52)") util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def buildMenu(): url = WEB_PAGE_BASE + 'tv_rec.php' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() videos = util.extractAll(content, '<td class="td_ser">', '</td>') for video in videos: params = {'play': 1} params['video'] = WEB_PAGE_BASE + util.extract( video, '<a href="', '"') params['image'] = "" params['title'] = util.extract( video, 'title="', '"').decode('windows-1251').encode('utf-8') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], False) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def searchp(params): url = (params['url']) videoPage = requests.get(url) if videoPage and videoPage.status_code == 200: cont = videoPage.text vidlinks = util.extractAll(cont, '<div id="tab', '/div>') for vidlink in vidlinks: t = util.extract(vidlink, '://', '/') v = util.extract(vidlink, 'SRC="', '"') or util.extract( vidlink, 'src="', '"') paramz = {'play': 1} paramz['title'] = t paramz['videolink'] = v paramz['image'] = icon link = util.makeLink(paramz) util.addMenuItem(paramz['title'], link, paramz['image'], None, False) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def buildPlay(inputParams): url = WEB_PAGE_BASE + inputParams['link'] response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() links = util.extract(content, 'a href="#">«', 'href="#">»') extractLinks = util.extractAll(links,'a href="','"') for link in extractLinks: params = {'key':'makePlaymakePlay'} params['title'] = util.extractTitle(link) params['link'] = link params['image'] = inputParams['image'] link = util.makeLink(params) util.addMenuItem(params['title'], link, params['image'], params['image'], False) util.endListing() xbmc.executebuiltin("Container.SetViewMode(500)") else: util.showError(ADDON_ID, 'Could not open URL PLAY %s to create menu' %(url))
def getVids(params): param = {'play': 1} content = util.getURL(params['url'], hdr) if content != False: films = util.extractAll(content, '<div class="item">', '<div class="item">') for film in films: param['title'] = makeAscii(util.extract(film, 'title="', '"')) param['url'] = util.extract(film, '<a href="', '" title="') param['poster'] = util.extract(film, 'src="', '" title="') param['fanart'] = param['poster'] if param['url'] != None: u = sys.argv[0] + "?url=" + param['url'] + "&play=" + str( 4) + "&name=" + urllib.quote_plus( param['title']) + "&poster=" + param['poster'] liz = xbmcgui.ListItem(param['title'], iconImage="DefaultVideo.png", thumbnailImage=param['poster']) liz.setInfo(type="Video", infoLabels={ "Title": param['title'], "Plot": "" }) liz.setProperty("Poster_Image", param['poster']) ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=True) next = util.extract(content, '<span class="current">', '</span>') #xbmc.log(">>>>>"+str(next), xbmc.LOGERROR) if next != None: next = int(next) + 1 #xbmc.log('http://www.likuoo.com/new/'+str(next), xbmc.LOGERROR) if 'http://www.likuoo.com/new/' + str(next) in content: util.addDir("Next >", 'http://www.likuoo.com/new/' + str(next), 2, "", "") xbmcplugin.endOfDirectory(int(sysarg))
def searchEpisodes(): quality = util.getQuality() conn = util.connection() cursor = conn.cursor() cursor.execute('select * from shows') shows = cursor.fetchall() cursor.close() conn.close() for show in shows: name = show[0] currentEpisode = [int(show[2]), int(show[3])] newEpisodes = [] processedEpisodes = [] params = {"SearchString": show[1]} query = urllib.urlencode(params) url = str(web) + "/search/" tvShow = urllib.urlopen(url, query) episodes = tvShow.read() tvShow.close() episodes = util.extractAll(episodes, '<tr name="hover" class="forum_header_border">', '</tr>') for episode in episodes: info = util.extractAll(episode, '<td class="forum_thread_post">', '</td>') info = info[0].strip() info = util.extractAll(info, 'class="epinfo">', '</a>') if (re.search('720p', info[0], re.I)): info = re.findall(r'(\d{1,2})(?:e|x|episode)(\d{1,2})', info[0], re.I) info = [int(info[0][0]), int(info[0][1]), "720p"] else: info = re.findall(r'(\d{1,2})(?:e|x|episode)(\d{1,2})', info[0], re.I) info = [int(info[0][0]), int(info[0][1]), "hdtv"] urls = util.extractAll(episode, '<td align="center" class="forum_thread_post">', '</td>') linkNumber = re.findall('class="download_', urls[0], re.IGNORECASE) linkNumber = len(linkNumber) links = [] for link in (util.extractAll(urls[0], '</a><a href=\"', '"')): links.append(link.strip()) if currentEpisode >= [info[0], info[1]]: break else: if quality.__contains__("|"): prefer = quality.split("|") if len(newEpisodes) > 0: for newEpisode in newEpisodes: if newEpisode.__contains__(info) or newEpisode.__contains__([info[0], info[1], prefer[0]]): print "Episode already in download queue or preferred quality already found for " + str(name) + "!" break elif info == [info[0], info[1], prefer[0]] and newEpisode.__contains__([info[0], info[1], prefer[1]]): print "Preferred Quality found, removing other qualities for " + str(name) + "!" newEpisodes.append([info, links]) newEpisodes.remove(newEpisode) else: print "Newer Episode found for " + str(name) + "!" newEpisodes.append([info, links]) else: util.sendNotification("Found new Episode for " + str(name) + "!", 3000) print "Found new Episode for " + str(name) + "!" newEpisodes.append([info, links]) else: if info[2] == quality or quality == "first": newEpisodes.append([info, links]) break if len(newEpisodes) > 0: for newEpisode in newEpisodes: try: valid = False for link in newEpisode[1]: url = urllib.urlopen(link) if url.getcode() == 200: util.download(link) print "Downloading " + str(link) valid = True break if valid == False: print "No working link for " + str(name) + " Season: " + str(info[0]) + " Episode: " + str(info[1]) except: print "Unable to download: " + str(link) else: util.sendNotification("No new episodes for " + str(name), 3000) print "No new episodes for " + str(name)
def searchEpisodes(): quality = util.getQuality() conn = util.connection() cursor = conn.cursor() cursor.execute('select * from shows') shows = cursor.fetchall() cursor.close() conn.close() for show in shows: name = show[0] currentEpisode = [int(show[2]), int(show[3])] newEpisodes = [] processedEpisodes = [] params = {"SearchString": show[1]} query = urllib.urlencode(params) url = str(web) + "/search/" tvShow = urllib.urlopen(url, query) episodes = tvShow.read() tvShow.close() episodes = util.extractAll( episodes, '<tr name="hover" class="forum_header_border">', '</tr>') for episode in episodes: info = util.extractAll(episode, '<td class="forum_thread_post">', '</td>') info = info[0].strip() info = util.extractAll(info, 'class="epinfo">', '</a>') if (re.search('720p', info[0], re.I)): info = re.findall(r'(\d{1,2})(?:e|x|episode)(\d{1,2})', info[0], re.I) info = [int(info[0][0]), int(info[0][1]), "720p"] else: info = re.findall(r'(\d{1,2})(?:e|x|episode)(\d{1,2})', info[0], re.I) info = [int(info[0][0]), int(info[0][1]), "hdtv"] urls = util.extractAll( episode, '<td align="center" class="forum_thread_post">', '</td>') linkNumber = re.findall('class="download_', urls[0], re.IGNORECASE) linkNumber = len(linkNumber) links = [] for link in (util.extractAll(urls[0], '</a><a href=\"', '"')): links.append(link.strip()) if currentEpisode >= [info[0], info[1]]: break else: if quality.__contains__("|"): prefer = quality.split("|") if len(newEpisodes) > 0: for newEpisode in newEpisodes: if newEpisode.__contains__( info) or newEpisode.__contains__( [info[0], info[1], prefer[0]]): print "Episode already in download queue or preferred quality already found for " + str( name) + "!" break elif info == [info[0], info[1], prefer[0] ] and newEpisode.__contains__( [info[0], info[1], prefer[1]]): print "Preferred Quality found, removing other qualities for " + str( name) + "!" newEpisodes.append([info, links]) newEpisodes.remove(newEpisode) else: print "Newer Episode found for " + str( name) + "!" newEpisodes.append([info, links]) else: util.sendNotification( "Found new Episode for " + str(name) + "!", 3000) print "Found new Episode for " + str(name) + "!" newEpisodes.append([info, links]) else: if info[2] == quality or quality == "first": newEpisodes.append([info, links]) break if len(newEpisodes) > 0: for newEpisode in newEpisodes: try: valid = False for link in newEpisode[1]: url = urllib.urlopen(link) if url.getcode() == 200: util.download(link) print "Downloading " + str(link) valid = True break if valid == False: print "No working link for " + str( name) + " Season: " + str( info[0]) + " Episode: " + str(info[1]) except: print "Unable to download: " + str(link) else: util.sendNotification("No new episodes for " + str(name), 3000) print "No new episodes for " + str(name)