def home(params,url,category): logger.info("[mcanime.py] listvideos") # Descarga la p·gina data = scrapertools.cachePage(url) #logger.info(data) # Extrae las entradas (carpetas) patronvideos = '<div class="release" style="background-image.url\(\'([^\']+)\'\)\;">[^<]+' patronvideos += '<h4>([^<]+)<a href="([^"]+)">([^<]+)</a> <span class="date">([^<]+)</span></h4>[^<]+' patronvideos += '<div class="rimg"><img src="([^"]+)"[^>]+></div>[^<]+' patronvideos += '<div class="rtext">(.*?)</div>[^<]+' patronvideos += '<div class="rfinfo">(.*?)</div>[^<]+' patronvideos += '<div class="rflinks">(.*?)</div>[^<]+' patronvideos += '<div class="rinfo">(.*?)</div>' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: if match[0].endswith("anime.gif"): scrapedtitle = match[3].strip() + " " + match[1].strip() + " (" + match[4] + ")" scrapedurl = urlparse.urljoin(url,match[2]) scrapedthumbnail = urlparse.urljoin(url,match[5]) scrapedplot = scrapertools.htmlclean(match[6]) scrapedextra = match[8] if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # AÒade al listado de XBMC xbmctools.addnewfolderextra( CHANNELNAME , "homedetail" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot , scrapedextra ) # Extrae la marca de siguiente p·gina patronvideos = '<span class="next"><a href="([^"]+)">Anteriores</a>...</span>' 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 , "home" , 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): logger.info("[series21.py] mainlist") # Añade al listado de XBMC xbmctools.addnewfolderextra( CHANNELNAME , "listsimple" , category , "Series - Novedades" ,"http://www.series21.com","","","novedades") xbmctools.addnewfolderextra( CHANNELNAME , "listsimple" , category , "Series - Estrenos" ,"http://www.series21.com","","","estrenos") #xbmctools.addnewfolderextra( CHANNELNAME , "listsimple" , category , "Spoilers ","http://www.series21.com/","","","spoilers") xbmctools.addnewfolder( CHANNELNAME , "seriesalfa" , category , "Series - Lista alfabética (Con Sinopsis y Poster)" ,"","","") xbmctools.addnewfolder( CHANNELNAME , "SeriesBuscaAlfa" , category , "Series - Busqueda Alfabética (toda la base de datos)" ,"http://www.series21.com/listado-series/","","") #xbmctools.addnewfolder( CHANNELNAME , "listaActoresMasBuscados" , category , "Actores - Lista Los Más Buscados" ,"http://www.series21.com/","","") #xbmctools.addnewfolder( CHANNELNAME , "buscaporletraActor" , category , "Actores - Busqueda Alfabética" ,"http://www.series21.com/actores/","","") xbmctools.addnewfolder( CHANNELNAME , "search" , category , "Series - Buscar" ,"","","") # 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 listaActoresMasBuscados(params,url,category): logger.info("[series21.py] listaActoresMasBuscados") extra="actor" url1 = "http://www.series21.com" # Descarga la página data = scrapertools.cachePage(url) patronvideos = 'Los más buscados: <br />(.*?)</div>' matches1 = re.compile(patronvideos,re.DOTALL).findall(data) patronvideos = '<a href="([^"]+)">([^<]+)</a>' matches = re.compile(patronvideos,re.DOTALL).findall(matches1[0]) scrapertools.printMatches(matches) for match in matches: # Titulo scrapedtitle = match[1] # URL scrapedurl = urlparse.urljoin(url1,match[0]) # Thumbnail scrapedthumbnail = "" # Argumento scrapedplot = "Busca las Series existentes de este Actor ó Actriz" # Depuracion if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # Añade al listado de XBMC xbmctools.addnewfolderextra( CHANNELNAME , "listsimple" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot,extra ) # 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 buscaporletraActor(params,url,category): logger.info("[series21.py] buscaporletra") data = scrapertools.cachePage(url) patron = '<div class="title">Listado de Actores</div><br/>(.*?)<ul class="menustyle">' matches = re.compile(patron,re.DOTALL).findall(data) patron = '<a href="(.*?)">(.*?)</a>' matches = re.compile(patron,re.DOTALL).findall(matches[0]) letras = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" opciones = [] opciones.append("Buscar por palabras (Teclado)") #opciones.append("0-9") for letra in letras: opciones.append(letra) dia = xbmcgui.Dialog() seleccion = dia.select("busqueda rapida, elige uno : ", opciones) logger.info("seleccion=%d" % seleccion) if seleccion == -1 :return if seleccion == 0: keyboard = xbmc.Keyboard('') keyboard.doModal() if (keyboard.isConfirmed()): tecleado = keyboard.getText() if len(tecleado)>0: logger.info("Nuevo string tecleado "+tecleado) for match in matches: if (string.lower(tecleado)) in (string.lower(match[1])): scrapedurl = "http://www.series21.com"+match[0] scrapedtitle = match[1] scrapedthumbnail = "" scrapedplot = " " if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # Añade al listado de XBMC xbmctools.addnewfolderextra( CHANNELNAME , "listsimple" , category , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot,"actor" ) else: for match in matches: if match[1][0:1] == letras[seleccion-1]: scrapedurl = "http://www.series21.com"+match[0] scrapedtitle = match[1] scrapedthumbnail = "" scrapedplot = " " if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # Añade al listado de XBMC xbmctools.addnewfolderextra( CHANNELNAME , "listsimple" , category , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot,"actor" ) # 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 seriesalfa(params, url, category): xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "0-9","http://www.series21.com/0-9/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "A","http://www.series21.com/a/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "B","http://www.series21.com/b/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "C","http://www.series21.com/c/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "D","http://www.series21.com/d/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "E","http://www.series21.com/e/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "F","http://www.series21.com/f/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "G","http://www.series21.com/g/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "H","http://www.series21.com/h/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "I","http://www.series21.com/i/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "J","http://www.series21.com/j/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "K","http://www.series21.com/k/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "L","http://www.series21.com/l/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "M","http://www.series21.com/m/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "N","http://www.series21.com/n/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "O","http://www.series21.com/o/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "P","http://www.series21.com/p/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "Q","http://www.series21.com/q/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "R","http://www.series21.com/r/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "S","http://www.series21.com/s/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "T","http://www.series21.com/t/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "U","http://www.series21.com/u/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "V","http://www.series21.com/v/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "W","http://www.series21.com/w/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "X","http://www.series21.com/x/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "Y","http://www.series21.com/y/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listsimple", category , "Z","http://www.series21.com/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 )
def ListarVideos(params,url,category): url1 = "http://www.series21.com" url1 = urlparse.urljoin(url1,url) title = urllib.unquote_plus(params.get("title")) thumbnail = urllib.unquote_plus(params.get("thumbnail")) plot = urllib.unquote_plus(params.get("plot")) data = scrapertools.cachePage(url1) # Busca el area donde estan los videos y la descripcion patronvideos = '<div id="content">(.*?)<!-- FIN #content-->' matches = re.compile(patronvideos,re.DOTALL).findall(data) matchesBK = matches[0] # Extrae las entradas (videos) para megavideo patronvideos = '<span style="font-size:12px;"><strong>(.*?)</strong></span><br/>.*?' patronvideos += '<span.*?>.*?<a href="http\:\/\/www.megavideo.com\/([\?v=|v/|\?d=]+)([A-Z0-9]{8}).*?" target' matches = re.compile(patronvideos,re.DOTALL).findall(matches[0]) scrapertools.printMatches(matches) encontrados = set() for match in matches: if match[2] not in encontrados: encontrados.add(match[2]) if 'v' in match[1]: server = "Megavideo" else: server = "Megaupload" doblaje = scrapertools.entityunescape(match[0]) # Titulo scrapedtitle = title + " - [" +doblaje+ "]" + " ("+server+")" # URL scrapedurl = match[2] # Thumbnail scrapedthumbnail = thumbnail # Argumento #print 'este es el plot %s ' %plot #print ' doblaje %s ' %doblaje scrapedplot = plot if ("Español" in plot) and not (doblaje in plot): scrapedplot = scrapedplot.replace("Español",doblaje) elif "subtitulado" in plot and not (doblaje in plot): scrapedplot = scrapedplot.replace("Versión original (subtitulado)",doblaje) elif not doblaje in plot: scrapedplot += "\n" + "Doblaje : " + doblaje # Depuracion if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # Añade al listado de XBMC xbmctools.addnewvideo( CHANNELNAME , "play" , category ,server, scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) if len(matches)==0: listavideos = servertools.findvideos(data) encontrados = set() for titulo,scrapedurl,servidor in listavideos: if scrapedurl.strip() not in encontrados: encontrados.add(scrapedurl.strip()) xbmctools.addnewvideo( CHANNELNAME , "play" , category ,servidor, title+ " - %s" %titulo , scrapedurl , thumbnail, plot ) patronvideos = '<span class="bloque-doblaje">(.+?)</span>[^<]+' patronvideos +='<span class="bloque-link">[^<]+<a href="javascript\:goTo\(\'([^\']+)\'\, \'([^\']+)\'\)"(.+?)</span>' #patronvideos +='(?:\| <a href="javascript\:goTo\(\'([^\']+)\'\, \'([^\']+)\'\)".*?)</span>' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # URL if "megavideo" in match[2]: server = "Megavideo" elif "megaupload" in match[2]: server = "Megaupload" if "esp.gif" in match[0]: doblaje = "Español" else: doblaje = match[0].strip() base64 = decrypt21.Base64() try: url2 = re.compile("javascript\:goTo\(\'([^\']+)\'\, \'([^\']+)\'\)").findall(match[3])[0] scrapedurl2 = base64._extract_code(base64.decode(url2[0])) scrapedurl = base64._extract_code(base64.decode(match[1])) part1 = " Parte 1 " part2 = " Parte 2 " scrapedtitle2 = title + part2+ " - [" +doblaje+ "]" + " ("+server+")" #print match[3] except: scrapedurl = base64._extract_code(base64.decode(match[1])) part1 = "" part2 = "" scrapedtitle = title + part1+ " - [" +doblaje+ "]" + " ("+server+")" # Thumbnail scrapedthumbnail = thumbnail # Argumento scrapedplot = plot # Depuracion if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # Añade al listado de XBMC xbmctools.addnewvideo( CHANNELNAME , "play" , category ,server, scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) if part2: xbmctools.addnewvideo( CHANNELNAME , "play" , category ,server, scrapedtitle2 , scrapedurl2 , scrapedthumbnail, scrapedplot ) # Extrae las entradas (videos) directos patronvideos = 'flashvars="file=([^\&]+)\&controlbar=over' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) if len(matches)>0: data1 = scrapertools.cachePage(matches[0]) #logger.info(data) patron = 'author">(.*?)</media:credit>.*?<media\:content url="([^"]+)"' matches = re.compile(patron,re.DOTALL).findall(data1) scrapertools.printMatches(matches) for match in matches: # Añade al listado de XBMC xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title +" - ["+match[0]+"]"+ " (Directo)" , match[1] , thumbnail , plot ) # Busca el Spoiler patronvideos = '(http://www.youtube.com[^"]+)"' matchSpoiler = re.compile(patronvideos,re.DOTALL).findall(data) if len(matchSpoiler)>0: encontrados = set() for match in matchSpoiler: if match not in encontrados: encontrados.add(match) # Añade al listado de XBMC xbmctools.addnewvideo( CHANNELNAME , "youtubeplay" , category ,"Directo", "Ver El Spoiler de : "+title , match , thumbnail, "Ver Video Spoiler" ) # Lista series relacionadas titulo = "Ver otros capitulos de esta temporada" matches = buscarelacionados(matchesBK) plot2 = "CAPITULOS DE ESTA TEMPORADA :\n\n" for match in matches: plot2 = plot2 + "-"+match[2]+"\n" xbmctools.addnewfolderextra( CHANNELNAME , "listarelacionados" , category , titulo , url , thumbnail, plot2,matchesBK ) #<div class="film"><a href="/house/#t_57"><img src="/thumbs/temporadas/95/120/57.jpg" # Cambiar de Temporada patron = 'div class="film"><a href="([^"]+)"><img src="([^"]+)" style' matchSerie= re.compile(patron,re.DOTALL).findall(matchesBK) if len(matchSerie)>1: for temp in matchSerie: url2 = urlparse.urljoin(url1,temp[0]) thumbnail = urlparse.urljoin(url1,temp[1]) titulo = "Cambiar a otras temporadas" titulo_serie = temp[0].split("/") titulo2 = titulo_serie[1].replace("-"," ") #print ' titulo%s ' %titulo2 xbmctools.addnewfolderextra( CHANNELNAME , "listarTemporada" , category , titulo , url2 , thumbnail, plot,titulo2 ) break # Label (top-right)... xbmcplugin.setContent(int( sys.argv[ 1 ] ),"movies") xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def listarTemporada(params,url,category): logger.info("[series21.py] listvideos") url1 = "http://www.series21.com" if url=="": url = "http://www.series21.com" # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) titulo_serie = urllib.unquote_plus(params.get("title")) if titulo_serie == "Cambiar a otras temporadas": titulo_serie = urllib.unquote_plus(params.get("extradata")) #thumbnail = urllib.unquote_plus(params.get("thumbnail")) #plot = urllib.unquote_plus(params.get("plot")) actor="" # Busca el area donde estan los videos y la descripcion patronvideos = '<h3>(.*?)</h3>' # Temporada de la Serie patronvideos += '.*?<img.+?src="([^"]+)" width=.*?/>' # Thumbnail de la Serie patronvideos += '.*?<ul(.*?)</ul>' # Capitulos de la Serie matches = re.compile(patronvideos,re.DOTALL).findall(data) patroncapit = '<li><a href="([^"]+)".+?>(.+?)</a>(.+?)</li>' patronplot = '<div style="margin:0px; padding:0px; text-align:justify;">(.*?)</div>' sinopsis = re.compile(patronplot,re.DOTALL).findall(data) plot = "Serie : "+titulo_serie+"\n" # Busca los actores patronactor = '<div id="actores">(.*?)cursor:pointer' matchesactor = re.compile(patronactor,re.DOTALL).findall(data) matchesactores = "" if len(matchesactor)>0: matchesactores = buscactores(matchesactor[0]) print ' actores: %s' %str(len(matchesactores)) if len(matchesactores)>0: actor = "Actores: " c = 0 actores = "ACTORES DE ESTA SERIE :\n\n" for match in matchesactores: c = c + 1 actores = actores + "-"+match[1] + "\n" if c == 3 or c == 6 : actor = actor + match[1] + "\n" elif c == 4 or c == 7: actor = actor + "* " + match[1]+" , " else: actor = actor + match[1]+ " , " # Abre ventana de eleccion de temporadas if len(matches)>1: opciones = [] opciones.append(" Todas las Temporadas") for match in matches: temporada = re.sub("<[^>]+>"," ",match[0]).replace("-","").replace(">","") opciones.append(temporada) dia = xbmcgui.Dialog() seleccion = dia.select("Elige un tipo de Listado", opciones) logger.info("seleccion=%d" % seleccion) else: seleccion = 0 if seleccion == -1: return if seleccion == 0: for match in matches: print 'esta es la %s' %match[0] print 'este es el thumbnail %s ' %match[1] thumbnail = urlparse.urljoin(url1,match[1]) temporada = re.sub("<[^>]+>"," ",match[0]).replace("-","").replace(">","") temporada += "\n" +actor+"\n"+ "Sinopsis : " + str(sinopsis[0].replace("\n\t\t\t\t\t","")) matchescapit = re.compile(patroncapit,re.DOTALL).findall(match[2]) for match1 in matchescapit: esp = "" subt = "" url = match1[0] if "esp.gif" in match1[2]: esp = " (Español)" if "Subtitulado" in match1[2]: subt = " (VOS)" titulo = titulo_serie+" - "+match1[1]+ esp + subt xbmctools.addnewfolder( CHANNELNAME , "ListarVideos" , category , titulo , url , thumbnail, plot+temporada , fanart=thumbnail ) else: thumbnail = urlparse.urljoin(url1,matches[seleccion-1][1]) temporada = re.sub("<[^>]+>"," ",matches[seleccion-1][0]).replace("-","").replace(">","") #logger.info("matches "+matches[seleccion-1][2]) matchescapit = re.compile(patroncapit,re.DOTALL).findall(matches[seleccion-1][2]) plot += temporada + "\n" plot += actor+"\n"+"Sinopsis : " + str(sinopsis[0].replace("\n\t\t\t\t\t","")) if len(matchescapit)>0: for match1 in matchescapit: url = match1[0] titulo = titulo_serie + " - " + match1[1] xbmctools.addnewfolder( CHANNELNAME , "ListarVideos" , category , titulo , url , thumbnail, plot ) # Busca Series relacionadas con los actores if len(matchesactores)>0: titulo = "Lista Series relacionadas con los actores" xbmctools.addnewfolderextra( CHANNELNAME , "listaractores" , category , titulo , url , thumbnail, actores,matchesactor[0] , fanart=thumbnail ) # Label (top-right)... xbmcplugin.setContent(int( sys.argv[ 1 ] ),"movies") xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def listsimple(params,url,category): logger.info("[series21.py] listsimple") url1 = "http://www.series21.com" extra= urllib.unquote_plus(params.get("extradata")) title = urllib.unquote_plus(params.get("title")) # Descarga la página data = scrapertools.cachePage(url) logger.info("esta es la url: "+url) # Extrae las entradas (carpetas) scrapedplot = "" patronvideos = "" if (title == "Series - Estrenos") or url1+"/nuevo" in url: patronvideos = '<div class="film2"[^>]+>.*?' patronvideos += '<img src="([^"]+)".*?' # Imagen patronvideos += '<a href="([^"]+)".*?' # Url patronvideos += '<b>([^<]+)</b>.*?' # Nombre de la serie patronvideos += '<div style[^>]+>([^<]+)</div>' # Titulo del capitulo #patronvideos += '.*?<b>(Temporada:</b>.*?)<.*?</a>--><br/>' #patronvideos += '.*?<div style=[^>]+>' # Genero #patronvideos += '.*?<b>(Doblaje:</b>.*?)<.*?-->' # Idioma elif title in "0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ" or extra=="actor": patronvideos = '<a href="([^"]+)"' # url patronvideos += '.*?<img src="([^"]+)".*?' # Imagen patronvideos += 'class="titulo">([^<]+)</a>.*?' # Titulo patronvideos += '<b>(Sinopsis: </b>.*?)</div>' # Sinopsis #<li style="margin:0px; padding:0px; height:18px; margin-left:5px;"> # <b>Dexter</b>: <a href="/dexter/5x10-in-the-beginning/">5x10 - In the Beginning</a> | Subtitulado elif title == "Series - Novedades": patronvideos = '<li style=.*?margin-left[^>]+>[^<]+' patronvideos += '<b>([^<]+)</b>\: <a href="([^"]+)"' patronvideos += '>([^<]+)</a>(.+?)</li>' #patronvideos += '<br /><b>(.*?)</b><br />(.*?)</a></div>' logger.info("[ listsimple patronvideos: "+patronvideos) #<li style="margin:0px; padding:0px; height:18px; margin-left:5px;"><a style="text-decoration:none;" href="/bella-calamidades/1x124-capitulo-124/">Bella calamidades 1x124 - Capitulo - 124</a></li> matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) solo_capitulo = False #logger.info("[ listsimple matches") for match in matches: # Atributos #scrapedtitle = match[2] #scrapedtitle = scrapedtitle.replace("<span class='style4'>","") #scrapedtitle = scrapedtitle.replace("</span>","") scrapedurl = urlparse.urljoin(url1,match[1]) scrapedthumbnail = urlparse.urljoin(url1,match[0]) scrapedthumbnail = scrapedthumbnail.replace(" ","") if title in "0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ" or extra=="actor": scrapedtitle = match[2].replace("\n\t","") scrapedplot = match[3].replace("\n"," ")+"\n" scrapedurl = urlparse.urljoin(url1,match[0]) scrapedthumbnail = urlparse.urljoin(url1,match[1]) scrapedthumbnail = scrapedthumbnail.replace(" ","") if title == "Series - Novedades": scrapedurl = urlparse.urljoin(url1,match[1]) scrapedthumbnail = "" #scrapedthumbnail = scrapedthumbnail.replace(" ","") solo_capitulo = True #scrapedplot = "Serie: "+match[2]+"\n" #scrapedplot += "Capitulo: "+match[3] if "esp.gif" in match[3]: idioma = "Español" else: idioma = match[3].replace(" | ","").replace("\t\t\t\t\t\t","") scrapedtitle = "%s - %s (%s)" %(match[0],match[2],idioma) if (title == "Series - Estrenos") or url1+"/nuevo" in url: scrapedtitle = match[2] scrapedurl = urlparse.urljoin(url1,match[1]) scrapedthumbnail = urlparse.urljoin(url1,match[0]) scrapedthumbnail = scrapedthumbnail.replace(" ","") solo_capitulo = True scrapedtitle = scrapedtitle + " - " + match[3].replace("\t\t","") #scrapedplot = match[3].replace("\n","")+"\n" #scrapedplot = scrapedplot.replace(":",": ") #scrapedplot += match[5].replace("\n"," ")+"\n" #scrapedplot += match[6].replace(":",": ") #scrapedtitle = scrapedtitle.replace("\n\t"," ") scrapedplot = re.sub("<[^>]+>"," ",scrapedplot) scrapedplot = scrapedplot.replace("é","é") scrapedplot = scrapedplot.replace("ó","ó") scrapedplot = scrapedplot.replace("ñ","ñ") if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC if solo_capitulo: xbmctools.addnewfolder( CHANNELNAME , "ListarVideos" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot , fanart=scrapedthumbnail ) else: xbmctools.addnewfolder( CHANNELNAME , "listarTemporada" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot , fanart=scrapedthumbnail ) #<div class="pagination" align="center" ><p><span class='current'>1</span><a href='/estrenos/2/'>2</a><a href='/estrenos/2/'>Siguiente »</a><a href='/estrenos/2/'></a> # Extrae la marca de siguiente página if title == "Series - Novedades" or "http://www.series21.com/nuevo" in url: patronvideos = '<div class="pagination" align="center" ><div.*?<a href="([^"]+)">Más series' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) if len(matches)>0: extra = "siguiente" scrapedtitle = "Página siguiente" scrapedurl = urlparse.urljoin(url1,matches[0]) scrapedthumbnail = "" scrapedplot = "" xbmctools.addnewfolderextra( CHANNELNAME , "listsimple" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot,extra ) # Label (top-right)... xbmcplugin.setContent(int( sys.argv[ 1 ] ),"movies") xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def listalfa(params,url,category): logger.info("[filmesonlinebr.py] listalfa") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "0-9","http://www.filmesonlinebr.com/search/label/0-9/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "A","http://www.filmesonlinebr.com/search/label/a/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "B","http://www.filmesonlinebr.com/search/label/B/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "C","http://www.filmesonlinebr.com/search/label/C/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "D","http://www.filmesonlinebr.com/search/label/D/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "E","http://www.filmesonlinebr.com/search/label/E/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "F","http://www.filmesonlinebr.com/search/label/F/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "G","http://www.filmesonlinebr.com/search/label/G/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "H","http://www.filmesonlinebr.com/search/label/H/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "I","http://www.filmesonlinebr.com/search/label/I/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "J","http://www.filmesonlinebr.com/search/label/J/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "K","http://www.filmesonlinebr.com/search/label/K/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "L","http://www.filmesonlinebr.com/search/label/L/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "M","http://www.filmesonlinebr.com/search/label/M/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "N","http://www.filmesonlinebr.com/search/label/N/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "O","http://www.filmesonlinebr.com/search/label/O/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "P","http://www.filmesonlinebr.com/search/label/P/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "Q","http://www.filmesonlinebr.com/search/label/Q/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "R","http://www.filmesonlinebr.com/search/label/R/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "S","http://www.filmesonlinebr.com/search/label/S/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "T","http://www.filmesonlinebr.com/search/label/T/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "U","http://www.filmesonlinebr.com/search/label/U/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "V","http://www.filmesonlinebr.com/search/label/V/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "W","http://www.filmesonlinebr.com/search/label/W/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "X","http://www.filmesonlinebr.com/search/label/X/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "Y","http://www.filmesonlinebr.com/","","","") xbmctools.addnewfolderextra( CHANNELNAME ,"listvideos", category , "Z","http://www.filmesonlinebr.com/search/label/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 )
def listar_busquedas(params,url="",category=""): #print "category :" +category if url == "" and category == "": channel_preset = params.channel accion = params.action category = "Buscador_Generico" else: channel_preset = params.get("channel") accion = params.get("action") category = "Buscador_Normal" #print "listar_busquedas()" channel2 = "" itemlist=[] # Despliega las busquedas anteriormente guardadas try: presets = config.get_setting("presets_buscados") if channel_preset != CHANNELNAME: channel2 = channel_preset print "channel_preset :%s" %channel_preset matches = "" if "|" in presets: matches = presets.split("|") itemlist.append( Item(channel="buscador" , action="por_teclado" , title=config.get_localized_string(30103)+"..." , url=matches[0] ,thumbnail="" , plot=channel2, category = category , context = 1 )) #addfolder( "buscador" , config.get_localized_string(30103)+"..." , matches[0] , "por_teclado", channel2 ) # Buscar else: itemlist.append( Item(channel="buscador" , action="por_teclado" , title=config.get_localized_string(30103)+"..." , url="" ,thumbnail="" , plot=channel2 , category = category , context = 0 )) #addfolder( "buscador" , config.get_localized_string(30103)+"..." , "" , "por_teclado", channel2 ) if len(matches)>0: for match in matches: title=scrapedurl = match itemlist.append( Item(channel=channel_preset , action="searchresults" , title=title , url=scrapedurl, thumbnail="" , plot="" , category = category , context=1 )) #addfolder( channel_preset , title , scrapedurl , "searchresults" ) elif presets != "": title = scrapedurl = presets itemlist.append( Item(channel=channel_preset , action="searchresults" , title=title , url=scrapedurl, thumbnail= "" , plot="" , category = category , context = 1 )) #addfolder( channel_preset , title , scrapedurl , "searchresults" ) except: itemlist.append( Item(channel="buscador" , action="por_teclado" , title=config.get_localized_string(30103)+"..." , url="", thumbnail="" , plot=channel2 , category = category , context = 0 )) #addfolder( "buscador" , config.get_localized_string(30103)+"..." , "" , "por_teclado" , channel2 ) if url=="" and category=="Buscador_Generico": return itemlist else: for item in itemlist: channel = item.channel action = item.action category = category scrapedtitle = item.title scrapedurl = item.url scrapedthumbnail = item.thumbnail scrapedplot = item.plot extra=item.extra context = item.context xbmctools.addnewfolderextra( channel , action , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot , extradata = extra , context = context) # 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 )