def newlist(params, url, category): logger.info("[watchanimeon.py] newlist") # Descarga la página data = scrapertools.cachePage(url) # Extrae las categorias # <div class="newpostz"><div class="newposts"><img src="http://www.watchanimeon.com/images/thumbs/75.jpg" alt="series" /><ul><li> # <a href="http://www.watchanimeon.com/naruto-shippuden-episode-126/">Naruto Shippuden Episode 126</a></li></ul> # <span><em>More Episodes:</em> <a href="http://www.watchanimeon.com/anime/naruto-shippuden/">Naruto Shippuden</a></span><span><em>Date Published </em>September 4th, 2009</span></div><div class="clear"></div></div> patron = '<div class="newpostz"><div class="newposts"><img src="([^"]+)"[^>]+><ul><li>' patron += '<a href="([^"]+)">([^<]+)</a></li></ul>' patron += '<span><em>More Episodes.</em> <a href="([^"]+)">([^<]+)</a></span><span><em>Date Published </em>([^<]+)</span></div><div class="clear"></div></div>' matches = re.compile(patron, re.DOTALL).findall(data) scrapertools.printMatches(matches) # Las añade a XBMC for match in matches: scrapedtitle = match[2] + " (" + match[5] + ")" scrapedurl = urlparse.urljoin(url, match[1]) scrapedthumbnail = urlparse.urljoin(url, match[0]) scrapedplot = "" if DEBUG: logger.info("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME, "detallecapitulo", category, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot ) # Asigna el título, desactiva la ordenación, y cierra el directorio xbmcplugin.setPluginCategory(handle=pluginhandle, category=category) xbmcplugin.addSortMethod(handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
def TagList(params,url,category): logger.info("[nolomires.py] TagList") # Descarga la p�gina data = scrapertools.cachePage(url) #logger.info(data) # Patron de las entradas patronvideos = "<a href='([^']+)' class='[^']+' title='[^']+' style='[^']+'" # URL patronvideos += ">([^<]+)</a>" # TITULO matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) # A�ade las entradas encontradas for match in matches: # Atributos scrapedtitle = acentos(match[1]) scrapedurl = match[0] scrapedthumbnail = "" scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # A�ade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Asigna el t�tulo, desactiva la ordenaci�n, y cierra el directorio xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def mainlist(params, url, category): logger.info("[watchanimeon.py] mainlist") # Menu principal xbmctools.addnewfolder(CHANNELNAME, "newlist", category, "Novedades", "http://www.watchanimeon.com/", "", "") xbmctools.addnewfolder( CHANNELNAME, "airinglist", category, "Series en curso", "http://www.watchanimeon.com/", "", "" ) xbmctools.addnewfolder( CHANNELNAME, "catlist", category, "Series por categoría", "http://www.watchanimeon.com/", "", "" ) xbmctools.addnewfolder( CHANNELNAME, "alphaserieslist", category, "Series por orden alfabético", "http://www.watchanimeon.com/anime-list/", "", "", ) xbmctools.addnewfolder( CHANNELNAME, "allmovieslist", category, "Todas las películas", "http://www.watchanimeon.com/anime/anime-movies/", "", "", ) # Asigna el título, desactiva la ordenación, y cierra el directorio xbmcplugin.setPluginCategory(handle=int(sys.argv[1]), category=category) xbmcplugin.addSortMethod(handle=int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
def airinglist(params, url, category): logger.info("[watchanimeon.py] airinglist") # Descarga la página data = scrapertools.cachePage(url) # Extrae las categorias patron = '<div class="btm-sidebar">(.*?)</div>' matches = re.compile(patron, re.DOTALL).findall(data) if len(matches) > 0: data = matches[0] patron = '<li><span class="[^"]+">([^<]+)</span> <a href="([^"]+)">([^<]+)</a></li>' matches = re.compile(patron, re.DOTALL).findall(data) scrapertools.printMatches(matches) # Las añade a XBMC for match in matches: scrapedtitle = match[2].strip() + " (" + match[0] + ")" scrapedurl = urlparse.urljoin(url, match[1]) scrapedthumbnail = "" scrapedplot = "" if DEBUG: logger.info("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME, "detallecapitulo", category, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot ) # Asigna el título, desactiva la ordenación, y cierra el directorio xbmcplugin.setPluginCategory(handle=pluginhandle, category=category) xbmcplugin.addSortMethod(handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
def catlist(params, url, category): logger.info("[watchanimeon.py] catlist") # Descarga la página data = scrapertools.cachePage(url) # Extrae las categorias patron = '<a href="(\/\?genre[^"]+)">([^<]+)</a>' matches = re.compile(patron, re.DOTALL).findall(data) scrapertools.printMatches(matches) # Las añade a XBMC for match in matches: scrapedtitle = match[1] scrapedurl = urlparse.urljoin(url, match[0]) scrapedthumbnail = "" scrapedplot = "" if DEBUG: logger.info("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME, "catdetail", category, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot ) # Asigna el título, desactiva la ordenación, y cierra el directorio xbmcplugin.setPluginCategory(handle=pluginhandle, category=category) xbmcplugin.addSortMethod(handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
def LastSearch(params,url,category): logger.info("[nolomires.py] LastSearch") # Descarga la p�gina data = scrapertools.cachePage(url) #logger.info(data) # Patron de las entradas patronvideos = '<li><a href="([^"]+)" ' # URL patronvideos += 'title="([^"]+)">[^<]+' # TITULO patronvideos += '</a></li>' # Basura matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) # A�ade las entradas encontradas for match in matches: # Atributos scrapedtitle = acentos(match[1]) scrapedtitle = scrapedtitle.replace("online","").replace("ver ","") scrapedurl = match[0] scrapedthumbnail = "" scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # A�ade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Asigna el t�tulo, desactiva la ordenaci�n, y cierra el directorio xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def ddlist(params,url,category): logger.info("[mcanime.py] ddcat") # Descarga la p·gina data = scrapertools.cachePage(url) # Extrae las entradas (carpetas) patronvideos = '<li class="dd_title"><h5><a href="([^"]+)">(.*?)</a>\s*<i>([^<]+)</i>\s*</h5></li>' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Atributos scrapedtitle = match[1].strip().replace("<b>","").replace("</b>","") scrapedurl = urlparse.urljoin(url,match[0]) scrapedthumbnail = "" scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # AÒade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "ddseriedetail" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Propiedades xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def DocuARCHIVO(params,url,category): logger.info("[peliculasonlineflv.py] DocuSeries") # Descarga la página data = scrapertools.cachePage(url) # Extrae las entradas (carpetas) patronvideos = "<li class='archivedate'>[^<]+" patronvideos += "<a href='([^']+)'>([^<]+)</a>([^<]+)</li>" matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Atributos scrapedurl = match[0] scrapedtitle = match[1] + match[2] scrapedthumbnail = "" scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "listvideosMirror" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Propiedades xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def searchresults(params,url,category): logger.info("[newdivx.py] SearchResult") #post = {"do": "search","subaction":"search","story":tecleado} # Descarga la p�gina data = scrapertools.cachePage(url) #print data # Extrae las entradas (carpetas) patronvideos = '<td class="copy" valign="top" colspan="2"><a href="([^"]+)" >' patronvideos += '<[^>]+><[^>]+><img src="([^"]+)" ' patronvideos += "alt=.*?title='([^']+)' /></div>" matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Atributos scrapedurl = match[0] scrapedtitle =match[2] scrapedtitle = scrapedtitle.replace("–","-") scrapedtitle = scrapedtitle.replace(" "," ") scrapedthumbnail = match[1] scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # A�ade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "detail" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Propiedades xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def searchresults(params,url,category): logger.info("[pelisflv.py] SearchResult") # Descarga la p�gina data = scrapertools.cachePage(url) #print data # Extrae las entradas (carpetas) patronvideos = '<div class="poster">[^<]+<a href="([^"]+)"' # URL patronvideos += '><img src="([^"]+)" width=[^\/]+\/>' # TUMBNAIL patronvideos += '</a>[^<]+<[^>]+>[^<]+<[^>]+>[^<]+<a href="[^"]+">([^<]+)</a>' # TITULO matches = re.compile(patronvideos,re.DOTALL).findall(data) matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Atributos scrapedurl = match[0] scrapedtitle =match[2] scrapedtitle = scrapedtitle.replace("–","-") scrapedtitle = scrapedtitle.replace(" "," ") scrapedthumbnail = match[1] scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # A�ade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "detail" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Propiedades xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def Listcat(params,url,category): logger.info("[pelispekes.py] Listcat") # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) # Patron de las entradas #<li class="cat-item cat-item-15"><a href="http://pelispekes.com/categoria/accion/" title="Ver todas las entradas archivadas en Accion" class="fadeThis"><span class="entry">Accion <span class="details inline">(39)</span></span></a><a class="rss bubble" href="http://pelispekes.com/categoria/accion/feed/" title="XML"></a> patron = '<li class="[^"]+"><a href="([^"]+)"[^>]+>' patron += '<span class="entry">([^<]+)<span class="details inline">([^<]+)</span' matches = re.compile(patron,re.DOTALL).findall(data) scrapertools.printMatches(matches) # Añade las entradas encontradas for match in matches: # Atributos scrapedtitle = match[1]+match[2] scrapedurl = match[0] scrapedthumbnail = "" scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "novedades" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Asigna el título, desactiva la ordenación, y cierra el directorio xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def novedades(params,url,category): logger.info("[pelispekes.py] novedades") # ------------------------------------------------------ # Descarga la página # ------------------------------------------------------ data = scrapertools.cachePage(url) #logger.info(data) # ------------------------------------------------------ # Extrae las películas # ------------------------------------------------------ #patron = '<div class="thumb">[^<]+<a href="([^"]+)"><img src="([^"]+)".*?alt="([^"]+)"/></a>' patron = '<div class="post-content clearfix">.+?' patron += '<a href="([^"]+)">' #Url patron += '<img src="([^"]+)".+?' #Caratula patron += 'alt="([^"]+)"/></a>.+?' #Titulo patron += '<p>([^<]+)</p>' matches = re.compile(patron,re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) for match in matches: scrapedtitle = match[2] scrapedurl = match[0] scrapedthumbnail = match[1].replace(" ","%20") scrapedplot = match[3] if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") try: print scrapedtitle scrapedtitle = scrapedtitle #scrapedtitle = unicode(scrapedtitle, "utf-8" ) except: pass # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "listmirrors" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # ------------------------------------------------------ # Extrae la página siguiente # ------------------------------------------------------ #patron = '<a href="([^"]+)" >\»\;</a>' patron = "class='current'>[^<]+</span><a href='([^']+)'" matches = re.compile(patron,re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) for match in matches: scrapedtitle = "!Pagina siguiente" scrapedurl = match scrapedthumbnail = "" scrapeddescription = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addthumbnailfolder( CHANNELNAME , scrapedtitle , scrapedurl , scrapedthumbnail, "novedades" ) # Label (top-right)... xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def ListCat(params,url,category): logger.info("[peliculasonlineflv.py] peliscat") # Descarga la página data = scrapertools.cachePage(url) patronvideos = '<li><a href="[^"]+" title="">Generos</a>(.*?)</ul>' matches = re.compile(patronvideos,re.DOTALL).findall(data) # Extrae las entradas (carpetas) if len(matches)>0: patronvideos = '<li><a href="([^"]+)" title="">([^<]+)</a>' matches = re.compile(patronvideos,re.DOTALL).findall(matches[0]) scrapertools.printMatches(matches) for match in matches: # Atributos scrapedtitle = match[1] scrapedurl = match[0] scrapedthumbnail = "" scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "listvideosMirror" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Propiedades xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def videolist(params,url,category): xbmc.output("[berriatb.py] videolist") # Page downloading data = scrapertools.cachePage(url) #xbmc.output(data) # Get #Next url ''' <span class="gehiago"><a class="hurrengoa" href="http://berria.info/berriatb/esanahala/zerrenda/6/">Hurrengoak »</a></span> ''' pattern = '<a class="hurrengoa" href="([^"]+)">Hurrengoak' # 0: url matches = re.compile(pattern,re.DOTALL).findall(data) try: urlnextpage = matches[0] except: urlnextpage = url if (DEBUG): xbmc.output("urlnextpage="+urlnextpage) # Add NEXT (as first item) xbmctools.addnewfolder( CHANNELCODE , "videolist" , CHANNELNAME , "#Hurrengoa" , urlnextpage , "" , "" ) # Parse video list ''' <div class="garbitzailea"></div> <div class="bideotxikiak"> <p><a href="http://berria.info/berriatb/esanahala/5/" title="" class="thickbox"><img src="http://208.79.203.90/berria/bideoak/bideoa653.jpg" width="158" alt="Aintzane Ezenarro" /></a></p> <p class="titularra"><a href="http://berria.info/berriatb/esanahala/5/" title="Aintzane Ezenarro">Aintzane Ezenarro</a></p> <div class="garbitzailea"></div> <p><span class="sinadura_data">2009-09-20</span></p> </div> ''' pattern = '<div class="bideotxikiak">.*?<p><a href="([^"]+)" title.*?' # 0: url pattern += '<img src="([^"]+)".*?' # 1: thumbnail pattern += '<p class="titularra">.*?title="([^"]+)".*?' # 2: title #pattern += 'sinadura_data">(.*?)<.*?' # 3: date matches = re.compile(pattern,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: #scrapedtitle = match[2].strip()+" ("+match[3]+")" scrapedtitle = match[2].replace("'","'").strip() scrapedurl = match[0].replace("&","&") scrapedthumbnail = match[1].replace("&","&") scrapedplot = scrapedtitle # Same as title if (DEBUG): xbmc.output("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Add item xbmctools.addnewvideo( CHANNELCODE , "play" , category , "Directo" , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot ) # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def newlist(params, url, category): logger.info("[vertelenovelasonline.py] listmirrors") # Descarga la página data = scrapertools.cachePage(url) # logger.info(data) # Extrae las entradas (carpetas) # <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.vertelenovelasonline.com/2009/11/amor-palos.html"> # <img style="cursor:pointer; cursor:hand;width: 186px; height: 320px;" src="http://1.bp.blogspot.com/__kdloiikFIQ/SwSWTExa3NI/AAAAAAAAl9Q/JmBSh1D40kE/s320/amor+a+palos.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5405610707194141906" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.vertelenovelasonline.com/2009/11/alcanzar-una-estrella-ii. # <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.vertelenovelasonline.com/2009/10/catalina-y-sebastian.html"> # <img style="cursor: pointer; width: 186px; height: 320px;" src="http://4.bp.blogspot.com/__kdloiikFIQ/SuH75qhmrfI/AAAAAAAAk8A/aLUZX2HAmUY/s320/catalina+y+sebastian.jpg" alt="" id="BLOGGER_PHOTO_ID_5395870796652916210" border="0" /></a><a onblur=" patron = '<a onblur="[^"]+" href="([^"]+)">' patron += '<img style="[^"]+" src="([^"]+)"[^>]+></a>' matches = re.compile(patron, re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # http://www.vertelenovelasonline.com/2009/10/dona-barbara.html scrapedtitle = match[0][44:-5] scrapedurl = urlparse.urljoin(url, match[0]) scrapedthumbnail = urlparse.urljoin(url, match[1]) scrapedplot = "" if DEBUG: logger.info("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME, "listmirrors", category, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot ) # Asigna el título, desactiva la ordenación, y cierra el directorio xbmcplugin.setPluginCategory(handle=pluginhandle, category=category) xbmcplugin.addSortMethod(handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
def fulllist(params,url,category): logger.info("[veranime.py] fulllist") # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) # Patron de las entradas #<li><a href="http://ver-anime.net/07-ghost/"><span>07 Ghost</span></a></li> #patron = '<li><a title="[^"]+" href="([^"]+)">([^<]+)</a></li>' patron = '<li><a href="(http://ver-anime.net/[^"]+)"><span>([^<]+)</span></a></li>' matches = re.compile(patron,re.DOTALL).findall(data) scrapertools.printMatches(matches) # Añade las entradas encontradas for match in matches: # Atributos scrapedtitle = match[1] scrapedurl = urlparse.urljoin(url,match[0]) scrapedthumbnail = "" scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "listmirrors" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Asigna el título, desactiva la ordenación, y cierra el directorio xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def CategoryList(params,url,category): logger.info("[delatv.py] CategoryList") # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) patronvideos = '<div class="titulo">Generos</div>(.*?)</div>' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) # Patron de las entradas patronvideos = '<a href="([^"]+)"[^>]+' # URL patronvideos += ">(.+?)<" # TITULO matches = re.compile(patronvideos,re.DOTALL).findall(matches[0]) scrapertools.printMatches(matches) # Añade las entradas encontradas for match in matches: # Atributos scrapedtitle = match[1] scrapedurl = urlparse.urljoin(url,match[0]) scrapedthumbnail = "" scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "novedades" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Asigna el título, desactiva la ordenación, y cierra el directorio xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def moviealphalist(params,url,category): logger.info("[descargapelis.py] moviealphalist") # ------------------------------------------------------ # Descarga la página # ------------------------------------------------------ data = scrapertools.cachePage(url) #logger.info(data) # ------------------------------------------------------ # Extrae las películas # ------------------------------------------------------ #<a href="http://www.descargapelis.net/peliculas-es-con-letra-a" title="Películas - Es con la letra a" class="listados_letras">a</a> - patron = '<a class="listado_alfabetico" href="(alfa(.)\.php)"' matches = re.compile(patron,re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) for match in matches: scrapedtitle = match[1] scrapedurl = url + match[0] scrapedthumbnail = "" scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "newlist" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Label (top-right)... xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def moviecategorylist(params,url,category): logger.info("[descargapelis.py] moviecategorylist") # ------------------------------------------------------ # Descarga la página # ------------------------------------------------------ data = scrapertools.cachePage(url) #logger.info(data) # ------------------------------------------------------ # Extrae las películas # ------------------------------------------------------ #<li class="cat-item cat-item-94"><a href="http://www.descargapelis.net/peliculas-online-es/accion" title="Ver todas las entradas de Acción">Acción</a> patron = '<a class="menu_cat" href="(cat_.+?)">-?(.+?)</a>' matches = re.compile(patron,re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) for match in matches: scrapedtitle = match[1] scrapedurl = url + match[0] scrapedthumbnail = "" scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "newlist" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Label (top-right)... xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def DocuTag(params,url,category): logger.info("[discoverymx.py] DocuSeries") # Descarga la página data = scrapertools.cachePage(url) # Extrae las entradas (carpetas) patronvideos = "<a dir='ltr' href='([^']+)'>([^<]+)</a>[^<]+<span class='label-count' dir='ltr'>(.+?)</span>" matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Atributos scrapedurl = match[0] scrapedtitle = match[1] + " " + match[2] scrapedthumbnail = "" scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Propiedades xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def busqueda(params,url,category): logger.info("busqueda") tecleado = "" keyboard = xbmc.Keyboard('') keyboard.doModal() if (keyboard.isConfirmed()): tecleado = keyboard.getText() if len(tecleado)<=0: return tecleado = tecleado.replace(" ", "+") data=scrapertools.cachePagePost("http://www.divxonline.info/buscador.html",'texto=' + tecleado + '&categoria=0&tipobusqueda=1&Buscador=Buscar') #logger.info(data) data=data[data.find('Se han encontrado un total de'):] #<li><a href="/pelicula/306/100-chicas-2000/">100 chicas (2000)</a></li> patronvideos = '<li><a href="(.+?)">(.+?)</a></li>' matches = re.compile(patronvideos,re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) for match in matches: xbmctools.addnewfolder( CHANNELNAME , "listmirrors" , category , match[1] , 'http://www.divxonline.info' + match[0] , 'scrapedthumbnail', 'scrapedplot' ) xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def peliscat(params,url,category): logger.info("[peliculas21.py] peliscat") # Descarga la página data = scrapertools.cachePage(url) # Extrae los Géneros de las Peliculas patronvideos = '<div id="textidgenero">Género:</div>(.*?)</select>' matches = re.compile(patronvideos,re.DOTALL).findall(data) patronvideos = '<option value="([^"]+)" >([^<]+)</option>' matches1 = re.compile(patronvideos,re.DOTALL).findall(matches[0]) for match in matches1: #http://www.peliculas21.com/ajaxs/ajax_periodos.php?valor=&periodo=0&idgenero=5&idactor=0&listado_style=2&pagina=&periodos_ajax=&valorperiodo=4&num_ale=0.5685049552958528 url = "http://www.peliculas21.com/ajaxs/ajax_periodos.php?valor=&periodo=0&idgenero=%s&idactor=0&listado_style=2&pagina=&periodos_ajax=&valorperiodo=4" %match[0] genero = match[1] xbmctools.addnewfolder( CHANNELNAME , "listsimpleMirror" , category , genero ,url,"","") # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def SearchResult(params,url,category): logger.info("[peliculasonlineflv.py] SearchResult") # Descarga la página data = scrapertools.cachePage(url) # Extrae las entradas (carpetas) patronvideos = '<p class="entry-title"><[^>]+>[^<]+</span><a href="([^"]+)"[^>]+>([^<]+)</a></p>' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Atributos scrapedurl = match[0] scrapedtitle =match[1] scrapedtitle = scrapedtitle.replace("–","-") scrapedtitle = scrapedtitle.replace(" "," ") scrapedthumbnail = "" scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "detail" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Propiedades xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def DocuSeries(params,url,category): logger.info("[peliculasonlineflv.py] DocuSeries") # Descarga la página data = scrapertools.cachePage(url) # Extrae las entradas (carpetas) patronvideos = '<a href="([^"]+)" target="_blank"><img src="([^"]+)"></a><br>' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Atributos scrapedurl = match[0] mobj = re.search(r"http://peliculasonlineflv.wordpress.com/tag/([^/]+)/", scrapedurl) scrapedtitle = mobj.group(1) scrapedtitle = scrapedtitle.replace("-"," ") scrapedthumbnail = match[1] scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Propiedades xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def mainlist(params, url, category): xbmc.output("[cineblog01.py] mainlist") # Añade al listado de XBMC xbmctools.addnewfolder(CHANNELNAME, "listvideos", category, "Film - Novità", "http://cineblog01.com/film/", "", "") xbmctools.addnewfolder(CHANNELNAME, "pelisalfa", category, "Film - Per Lettera", "", "", "") xbmctools.addnewfolder(CHANNELNAME, "searchmovie", category, " Cerca Film", "", "", "") xbmctools.addnewfolder(CHANNELNAME, "listserie", category, "Serie", "http://cineblog01.info/serietv/", "", "") xbmctools.addnewfolder(CHANNELNAME, "listanime", category, "Anime", "http://cineblog01.info/anime/", "", "") # Label (top-right)... xbmcplugin.setPluginCategory(handle=int(sys.argv[1]), category=category) # Disable sorting... xbmcplugin.addSortMethod(handle=int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_NONE) # End of directory... xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
def listcat(params,url,category): xbmc.output("[cineblog01.py] mainlist") if url =="": url = "http://cineblog01.com/film/" # Descarga la página data = scrapertools.cachePage(url) #xbmc.output(data) # Extrae las entradas (carpetas) patronvideos = '<div id="covershot".*?<a.*?<img src="(.*?)".*?' patronvideos += '<div id="post-title"><a href="(.*?)".*?' patronvideos += '<h3>(.*?)</h3>' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Titulo UnicodeDecodedTitle = match[2].decode("utf-8") unescapedTitle = unescape (UnicodeDecodedTitle) scrapedtitle = unescapedTitle.encode("latin1","ignore") # URL scrapedurl = urlparse.urljoin(url,match[1]) # Thumbnail scrapedthumbnail = urlparse.urljoin(url,match[0]) # Argumento # Depuracion if (DEBUG): xbmc.output("scrapedtitle="+scrapedtitle) xbmc.output("scrapedurl="+scrapedurl) xbmc.output("scrapedthumbnail="+scrapedthumbnail) # Añade al listado de XBMC xbmctools.addthumbnailfolder( CHANNELNAME , scrapedtitle , scrapedurl , scrapedthumbnail, "detail" ) # Remove the next page mark patronvideos = '<a href="(http://www.cineblog01.com/film/category/[a-z]+' patronvideos += '/page/[0-9]+)">Avanti >' matches = re.compile (patronvideos, re.DOTALL).findall (data) scrapertools.printMatches (matches) if len(matches)>0: scrapedtitle = "Pagina seguente" scrapedurl = matches[0] scrapedthumbnail = "" scrapedplot = "" if (DEBUG): xbmc.output("scrapedtitle="+scrapedtitle) xbmc.output("scrapedurl="+scrapedurl) xbmc.output("scrapedthumbnail="+scrapedthumbnail) xbmctools.addnewfolder( CHANNELNAME , "listcat" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Label (top-right)... xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def Videosnuevoslist(params,url,category): logger.info("[sonolatino.py] VideoesNuevos") # Descarga la p�gina data = scrapertools.cachePage(url) #logger.info(data) # Extrae las entradas (carpetas) patronvideos = '<tr><td.*?<a href="([^"]+)">' patronvideos += '<img src="([^"]+)" ' patronvideos += 'alt="[^"]+".*?' patronvideos += 'width="250">([^<]+)<' patronvideos += 'td class.*?<a href="[^>]+>([^<]+)</a></td><td class.*?>([^<]+)</td></tr>' matches = re.compile(patronvideos,re.DOTALL).findall(data) #logger.info("matches = "+str(matches)) if DEBUG: scrapertools.printMatches(matches) for match in matches: # Titulo # Titulo scrapedtitle = match[2] + " - " + match[3]+" - " + match[4].replace('í','i') print scrapedtitle scrapedtitle = scrapedtitle.decode("utf-8") # URL scrapedurl = match[0] # Thumbnail scrapedthumbnail = match[1] imagen = "" # procesa el resto scrapedplot = match[3] tipo = match[3] # Depuracion if (DEBUG): logger.info("scrapedtitle="+scrapedtitle.encode("utf-8")) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # A�ade al listado de XBMC #xbmctools.addthumbnailfolder( CHANNELNAME , scrapedtitle, scrapedurl , scrapedthumbnail, "detail" ) xbmctools.addnewfolder( CHANNELNAME , "detail" , category , scrapedtitle ,scrapedurl , scrapedthumbnail , scrapedplot ) # Busca enlaces de paginas siguientes... cat = "nuevo" patronvideo = patronvideos paginasiguientes(patronvideo,data,category,cat) # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def listaseries(params,url,category): logger.info("[sonolatino.py] listaseries") #url2 = "http://www.sonolatino.com/index.html" data = scrapertools.cachePage(url) patron = "Relacionadas</h4>(.*?)</ul>" matches = re.compile(patron,re.DOTALL).findall(data) if len(matches)>0: patron = '<a href="([^"]+)">([^<]+)</a>' matches2 = re.compile(patron,re.DOTALL).findall(matches[0]) scrapedplot = "" scrapedthumbnail= "" if len(matches)>0: for match in matches2: scrapedtitle = acentos(match[1]) print match[0] scrapedurl = match[0][:-18] print scrapedurl if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # A�ade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "listatipodocumental" , category , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot ) # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def ddseriedetail(params,url,category): logger.info("[mcanime.py] ddseriedetail") 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) # Foto de la serie de la enciclopedia patron = '<img src="([^"]+)" width="300".*?class="title_pic" />' matches = re.compile(patron,re.DOTALL).findall(data) if len(matches)>0: thumbnail = matches[0] logger.info("[mcanime.py] thumbnail="+thumbnail) # Argumento patron = '<h6>Sinopsis.*?</h6>(.*?)<h6>' matches = re.compile(patron,re.DOTALL).findall(data) if len(matches)>0: plot = matches[0] plot = plot.replace("\n"," ") plot = plot.replace("\r"," ") plot = plot.replace("\r\n"," ") plot = plot.strip() plot = scrapertools.htmlclean(matches[0]) logger.info("[mcanime.py] plot="+plot) # Aportaciones de los usuarios patron = '<h6 class="m">Por los Usuarios</h6>[^<]+' patron += '<div id="user_actions">(.*?)</div>' matches = re.compile(patron,re.DOTALL).findall(data) if len(matches)>0: data = matches[0] #logger.info("[mcanime.py] data="+data) patron = '<ul class="dd_row">[^<]+' patron += '<li class="dd_type"><img[^>]+></li>[^<]+' patron += '<li class="dd_update"> <img[^>]+>([^<]+)</li>[^<]+' patron += '<li class="dd_title">[^<]+' patron += '<h5><a href="([^"]+)">([^<]+)</a></h5>' matches = re.compile(patron,re.DOTALL).findall(data) for match in matches: # Atributos scrapedtitle = match[2].strip()+" ("+match[0].strip()+")" scrapedurl = urlparse.urljoin(url,match[1]) scrapedthumbnail = thumbnail scrapedplot = plot if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # AÒade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "ddpostdetail" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Cierra el directorio xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def listvideos(params,url,category): logger.info("[discoverymx.py] listvideos") scrapedthumbnail = "" scrapedplot = "" # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) # Extrae las entradas (carpetas) patronvideos = "<h3 class='post-title entry-title'>[^<]+" patronvideos += "<a href='([^']+)'>([^<]+)</a>.*?" patronvideos += "<div class='post-body entry-content'>(.*?)<div class='post-footer'>" matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: scrapedtitle = match[1] scrapedtitle = re.sub("<[^>]+>"," ",scrapedtitle) scrapedtitle = scrapertools.unescape(scrapedtitle) scrapedurl = match[0] regexp = re.compile(r'src="(http[^"]+)"') matchthumb = regexp.search(match[2]) if matchthumb is not None: scrapedthumbnail = matchthumb.group(1) matchplot = re.compile('<div align="center">(<img.*?)</span></div>',re.DOTALL).findall(match[2]) if len(matchplot)>0: scrapedplot = matchplot[0] #print matchplot else: scrapedplot = "" scrapedplot = re.sub("<[^>]+>"," ",scrapedplot) scrapedplot = scrapertools.unescape(scrapedplot) #scrapedplot = scrapedplot.replace("…","") if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "detail" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Extrae la marca de siguiente página patronvideos = "<a class='blog-pager-older-link' href='([^']+)'" matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) if len(matches)>0: scrapedtitle = "Página siguiente" scrapedurl = urlparse.urljoin(url,matches[0]) scrapedthumbnail = "" scrapedplot = "" xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Propiedades xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def forum(params,url,category): logger.info("[mcanime.py] forum") # Descarga la p·gina data = scrapertools.cachePage(url) #logger.info(data) # -------------------------------------------------------------------- # Extrae las entradas del foro (series / pelis) # -------------------------------------------------------------------- patronvideos = '<ul class="topic_row">[^<]+<li class="topic_type"><img.*?' patronvideos += '<li class="topic_title"><h5><a href="([^"]+)">([^<]+)</a>' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Extrae try: scrapedtitle = unicode( match[1], "utf-8" ).encode("iso-8859-1") except: scrapedtitle = match[1] scrapedurl = urlparse.urljoin(url,match[0].replace("&","&")) scrapedthumbnail = "" scrapedplot = "" # Depuracion xbmctools.logdebuginfo(DEBUG,scrapedtitle,scrapedurl,scrapedthumbnail,scrapedplot) # AÒade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "forumdetail" , CHANNELNAME , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # -------------------------------------------------------------------- # Extrae la siguiente p·gina # -------------------------------------------------------------------- patronvideos = '<a href="([^"]+)" class="next">(Siguiente »)</a>' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: scrapedtitle = "P·gina siguiente" scrapedurl = urlparse.urljoin(url,match[0].replace("&","&")) scrapedthumbnail = "" scrapedplot = "" # Depuracion xbmctools.logdebuginfo(DEBUG,scrapedtitle,scrapedurl,scrapedthumbnail,scrapedplot) # AÒade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "forum" , CHANNELNAME , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def mainlist(params, url, category): xbmc.output("[plus.py] mainlist") url = "http://www.plus.es/tv/canales.html" # -------------------------------------------------------- # Descarga la página # -------------------------------------------------------- data = scrapertools.cachePage(url) #xbmc.output(data) # -------------------------------------------------------- # Extrae los programas # -------------------------------------------------------- ''' <li class="canales estirar"> <h2><a href="index.html?idlist=PLTVCN">Cine </a></h2> <a href="index.html?idlist=PLTVCN"><img alt="imagen Cine " src="/images/plustv/categorias/PLTVCN.jpg"/></a> <ul> <li><span><a title="Taller Canal+: Jaume Balagueró y Paco Plaza" href="index.html?idlist=PLTVCN&idvid=834262&pos=0">Taller Canal+: Jaume Balagueró y Paco Plaza</a></span></li><li><span><a title="Canal+ en Hollywood: globos de oro 2009" href="index.html?idlist=PLTVCN&idvid=817622&pos=1">Canal+ en Hollywood: globos de oro 2009</a></span></li> <li class="sinPlay"><a title="ver mas" href="emisiones.html?id=PLTVCN">Más ...</a></li> </ul> ''' patron = '<li class="canales estirar[^"]*">[^<]+' patron += '<h2><a href="([^"]+)">([^<]+)</a></h2>[^<]+' patron += '<a href="[^"]+"><img alt="[^"]+" src="([^"]+)"/></a>' matches = re.compile(patron, re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) for match in matches: scrapedtitle = match[1] try: scrapedtitle = unicode(scrapedtitle, "utf-8").encode("iso-8859-1") except: pass scrapedurl = urlparse.urljoin(url, match[0]).replace( "index.html?idlist", "emisiones.html?id") scrapedthumbnail = urlparse.urljoin(url, match[2]) scrapedplot = "" if (DEBUG): xbmc.output("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") # Añade al listado de XBMC #addfolder( scrapedtitle , scrapedurl , "videolist" ) xbmctools.addnewfolder(CHANNELCODE, "videolist", CHANNELNAME, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot) # Label (top-right)... xbmcplugin.setPluginCategory(handle=pluginhandle, category=category) # Disable sorting... xbmcplugin.addSortMethod(handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE) # End of directory... xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
def mainlist(params, url, category): xbmc.output("[earthtv.py] mainlist") # Añade al listado de XBMC xbmctools.addnewfolder(CHANNELCODE, "novedades", CHANNELNAME, "Novedades", "", "", "") # Playlists itemlist = youtube.getplaylists("earthTV", 1, 13) for item in itemlist: xbmctools.addnewfolder(CHANNELCODE, "playlist", CHANNELNAME, item.title, item.url, item.thumbnail, item.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)
def mainlist(params, url, category): xbmc.output("[berriatb.py] mainlist") ### ### MAIN MENU ### # Full Video List xbmctools.addnewfolder(CHANNELCODE, "videolist", CHANNELNAME, "Zerrenda", "http://www.berria.info/berriatb/zerrenda/", "", "") # Interviews xbmctools.addnewfolder(CHANNELCODE, "videolist", CHANNELNAME, "Esan Ahala (Elkarrizketak)", "http://www.berria.info/berriatb/esanahala/", "", "") # Most Viewed (disabled) #xbmctools.addnewfolder( CHANNELCODE , "videolist" , CHANNELNAME , "Ikusienak" , "http://www.berria.info/berriatb/ikusienak/" , "" , "" ) # Label (top-right)... xbmcplugin.setPluginCategory(handle=int(sys.argv[1]), category=category) # Disable sorting... xbmcplugin.addSortMethod(handle=int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_NONE) # End of directory... xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
def videolist(params, url, category): xbmc.output("[berriatb.py] videolist") # Page downloading data = scrapertools.cachePage(url) #xbmc.output(data) # Get #Next url ''' <span class="gehiago"><a class="hurrengoa" href="http://berria.info/berriatb/esanahala/zerrenda/6/">Hurrengoak »</a></span> ''' pattern = '<a class="hurrengoa" href="([^"]+)">Hurrengoak' # 0: url matches = re.compile(pattern, re.DOTALL).findall(data) try: urlnextpage = matches[0] except: urlnextpage = url if (DEBUG): xbmc.output("urlnextpage=" + urlnextpage) # Add NEXT (as first item) xbmctools.addnewfolder(CHANNELCODE, "videolist", CHANNELNAME, "#Hurrengoa", urlnextpage, "", "") # Parse video list ''' <div class="garbitzailea"></div> <div class="bideotxikiak"> <p><a href="http://berria.info/berriatb/esanahala/5/" title="" class="thickbox"><img src="http://208.79.203.90/berria/bideoak/bideoa653.jpg" width="158" alt="Aintzane Ezenarro" /></a></p> <p class="titularra"><a href="http://berria.info/berriatb/esanahala/5/" title="Aintzane Ezenarro">Aintzane Ezenarro</a></p> <div class="garbitzailea"></div> <p><span class="sinadura_data">2009-09-20</span></p> </div> ''' pattern = '<div class="bideotxikiak">.*?<p><a href="([^"]+)" title.*?' # 0: url pattern += '<img src="([^"]+)".*?' # 1: thumbnail pattern += '<p class="titularra">.*?title="([^"]+)".*?' # 2: title #pattern += 'sinadura_data">(.*?)<.*?' # 3: date matches = re.compile(pattern, re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: #scrapedtitle = match[2].strip()+" ("+match[3]+")" scrapedtitle = match[2].replace("'", "'").strip() scrapedurl = match[0].replace("&", "&") scrapedthumbnail = match[1].replace("&", "&") scrapedplot = scrapedtitle # Same as title if (DEBUG): xbmc.output("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") # Add item xbmctools.addnewvideo(CHANNELCODE, "play", category, "Directo", scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot) # Label (top-right)... xbmcplugin.setPluginCategory(handle=int(sys.argv[1]), category=category) # Disable sorting... xbmcplugin.addSortMethod(handle=int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_NONE) # End of directory... xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
def videolist(params, url, category): xbmc.output("[plus.py] videolist") # -------------------------------------------------------- # Descarga la página # -------------------------------------------------------- data = scrapertools.cachePage(url) #xbmc.output(data) # -------------------------------------------------------- # Extrae los vídeos de la página # -------------------------------------------------------- ''' <li class="video estirar"> <div class="imagen"> <a title="Estrellas de Canal+: Heath Ledger" href="index.html?idlist=PLTVCN&idvid=537147&pos=3"> <img alt="" src="http://www.plus.es/plustv/images/fotogramas/plustv/PO805296.jpg"> <span>Play</span> </a> </div> <div class="tooltip" title="Programa que repasa la trayectoria de las caras más conocidas del cine."> <div class="textos"> <p class="titulo"><a href="index.html?idlist=PLTVCN&idvid=537147&pos=3">Estrellas de Canal+: Heath Ledger</a></p> </div> <a class="addmiplustv show" href="miplustv.html?id=537147&action=add" rel="nofollow">Añadir a Mi PLUSTV</a> <span>Añadido a Mi PlusTV</span> </div> </li> ''' patron = '<li class="video estirar">[^<]+' patron += '<div class="imagen">[^<]+' patron += '<a title="([^"]+)" href="([^"]+)">[^<]+' patron += '<img alt="[^"]*" src="([^"]+)">.*?' patron += '<div class="tooltip" title="([^"]+)"' matches = re.compile(patron, re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) for match in matches: # Datos scrapedtitle = match[0] scrapedurl = urlparse.urljoin(url, match[1]) scrapedthumbnail = urlparse.urljoin(url, match[2]) scrapedplot = match[3] if (DEBUG): xbmc.output("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") # Añade al listado de XBMC #addvideo( scrapedtitle , scrapedurl , category ) xbmctools.addnewvideo(CHANNELCODE, "play", CHANNELNAME, "", scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot) # -------------------------------------------------------- # Extrae el enlace a la siguiente página # -------------------------------------------------------- patron = '<li class="siguiente"><a href="([^"]+)">siguiente \>\;</a></li>' matches = re.compile(patron, re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) for match in matches: # Datos scrapedtitle = "Página siguiente" scrapedurl = "http://www.plus.es/plustv/emisiones.html" + match scrapedthumbnail = "" scrapedplot = "" if (DEBUG): xbmc.output("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") # Añade al listado de XBMC #addvideo( scrapedtitle , scrapedurl , category ) xbmctools.addnewfolder(CHANNELCODE, "videolist", CHANNELNAME, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot) # Label (top-right)... xbmcplugin.setPluginCategory(handle=pluginhandle, category=category) # Disable sorting... xbmcplugin.addSortMethod(handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE) # End of directory... xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
def listserie(params, url, category): xbmc.output("[cineblog01.py] mainlist") if url == "": url = "http://cineblog01.com/film/" # Descarga la página data = scrapertools.cachePage(url) #xbmc.output(data) # Extrae las entradas (carpetas) patronvideos = '<div id="covershot".*?<a.*?<img src="(.*?)".*?' patronvideos += '<div id="post-title"><a href="(.*?)".*?' patronvideos += '<h3>(.*?)</h3>' patronvideos += '(.*?)</p>' #patronvideos += '<div id="description"><p>(.?*)</div>' matches = re.compile(patronvideos, re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Titulo UnicodeDecodedTitle = match[2].decode("utf-8") unescapedTitle = unescape(UnicodeDecodedTitle) scrapedtitle = unescapedTitle.encode("latin1", "ignore") # URL scrapedurl = urlparse.urljoin(url, match[1]) # Thumbnail scrapedthumbnail = urlparse.urljoin(url, match[0]) # Argumento UnicodeDecodedTitle = match[3].decode("utf-8") unescapedTitle = unescape(UnicodeDecodedTitle) scrapedplot = unescapedTitle.encode("latin1", "ignore") #scrapedplot = match[3] # Depuracion if (DEBUG): xbmc.output("scrapedtitle=" + scrapedtitle) xbmc.output("scrapedurl=" + scrapedurl) xbmc.output("scrapedthumbnail=" + scrapedthumbnail) # xbmc.output("scrapeddescription="+scrapeddescription) # Añade al listado de XBMC xbmctools.addnewfolder(CHANNELNAME, "detail", category, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot) # Remove the next page mark patronvideos = '<a href="(http://www.cineblog01.info/serietv/page/[0-9]+)">>' matches = re.compile(patronvideos, re.DOTALL).findall(data) scrapertools.printMatches(matches) if len(matches) > 0: scrapedtitle = "Pagina seguente" scrapedurl = matches[0] scrapedthumbnail = "" scrapedplot = "" if (DEBUG): xbmc.output("scrapedtitle=" + scrapedtitle) xbmc.output("scrapedurl=" + scrapedurl) xbmc.output("scrapedthumbnail=" + scrapedthumbnail) xbmctools.addnewfolder(CHANNELNAME, "listserie", category, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot) # Label (top-right)... xbmcplugin.setPluginCategory(handle=pluginhandle, category=category) xbmcplugin.addSortMethod(handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
def pelisalfa(params, url, category): xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "0-9", "http://cineblog01.com/film/category/numero", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "A", "http://cineblog01.com/film/category/a", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "B", "http://cineblog01.com/film/category/b", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "C", "http://cineblog01.com/film/category/c", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "D", "http://cineblog01.com/film/category/d", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "E", "http://cineblog01.com/film/category/e", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "F", "http://cineblog01.com/film/category/f", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "G", "http://cineblog01.com/film/category/g", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "H", "http://cineblog01.com/film/category/h", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "I", "http://cineblog01.com/film/category/i", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "J", "http://cineblog01.com/film/category/j", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "K", "http://cineblog01.com/film/category/k", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "L", "http://cineblog01.com/film/category/l", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "M", "http://cineblog01.com/film/category/m", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "N", "http://cineblog01.com/film/category/n", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "O", "http://cineblog01.com/film/category/o", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "P", "http://cineblog01.com/film/category/p", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "Q", "http://cineblog01.com/film/category/q", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "R", "http://cineblog01.com/film/category/r", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "S", "http://cineblog01.com/film/category/s", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "T", "http://cineblog01.com/film/category/t", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "U", "http://cineblog01.com/film/category/u", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "V", "http://cineblog01.com/film/category/v", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "W", "http://cineblog01.com/film/category/w", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "X", "http://cineblog01.com/film/category/x", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "Y", "http://cineblog01.com/film/category/y", "", "") xbmctools.addnewfolder(CHANNELNAME, "listcat", category, "Z", "http://cineblog01.com/film/category/z", "", "") # Label (top-right)... xbmcplugin.setPluginCategory(handle=int(sys.argv[1]), category=category) # Disable sorting... xbmcplugin.addSortMethod(handle=int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_NONE) # End of directory... xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)