def novedades(params,url,category): logger.info("[redestv.py] parseweb") # ------------------------------------------------------ # Descarga la página # ------------------------------------------------------ data = scrapertools.cachePage(url) #logger.info(data) #<div style="text-align: justify;">Cre?amos que el ser humano era el ?nico animal capaz de sentir empat?a. Sin embargo, el altruismo existe en muchos otros animales. Estar conectado con los dem?s, entenderlos y sentir su dolor no es exclusivo del ser humano. El prim?tologo Frans de Waal, gran estudiador de las emociones animales, habla con Punset sobre empat?a y simpat?a, capacidades clave para el ?xito en la vida social.</div><div class="jcomments-links"> <a href="/index.php?option=com_content&view=article&id=161:501-nuestro-cerebro-altruista&catid=2:cermen&Itemid=10#addcomments" class="comment-link">Escribir un comentario</a></div> patronvideos = '<td class="contentheading" width="100%">.+?<a href="(.+?)" class="contentpagetitle">\s+(\d+.+?)</a>' #patronvideos = '<div style="text-align: justify;">.+?</div>.+?<a href="(.+?)#' #logger.info("web"+data) matches = re.compile(patronvideos,re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) #xbmctools.addnewfolder( __channel__ , "buscavideos" , category, "redestv" , "http://www.redes-tv.com"+matches[0][0] , "" , "") #scrapertools.printMatches(matches) # patronvideos1 = 'src="http://www.megavideo.com/v/(.{8}).+?".+?></embed>.*?<p>(.+?)</p><div' # matches1 = re.compile(patronvideos1,re.DOTALL).findall(data) # if DEBUG: # scrapertools.printMatches(matches1) for i in range(len(matches)): xbmctools.addnewvideo( __channel__ , "buscavideos" , category , "redestv" , matches[i][1] , matches[i][0] , "thumbnail" , "") 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 buscartrailer(params,url,category): print "[trailertools.py] Modulo: buscartrailer()" thumbnail = "" solo = "false" videotitle = title = urllib.unquote_plus( params.get("title") ).strip() if ":]" in videotitle: solo = "true" videotitle = re.sub("\[[^\]]+\]","",videotitle).strip() if config.get_localized_string(30110) in videotitle: #"Buscar trailer para" videotitle = videotitle.replace(config.get_localized_string(30110),"").strip() if config.get_localized_string(30111) in videotitle: #"Insatisfecho?, busca otra vez : " videotitle = videotitle.replace(config.get_localized_string(30111),"").strip() listavideos = GetTrailerbyKeyboard(videotitle.strip(),category) else: listavideos = gettrailer(videotitle.strip().strip(),category,solo) if len(listavideos)>0: for video in listavideos: titulo = video[1] url = video[0] thumbnail = video[2] duracion = video[3] xbmctools.addnewvideo( "trailertools" , "youtubeplay" , category , "youtube" , titulo , url , thumbnail , "Ver Video","",duracion ) xbmctools.addnewfolder( CHANNELNAME , "buscartrailer" , category , config.get_localized_string(30111)+" "+videotitle , url , os.path.join(IMAGES_PATH, 'trailertools.png'), "" ) #"Insatisfecho?, busca otra vez : " # 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 parsewebcategorias(params,url,category): logger.info("[redestv.py] buscacategorias") data = scrapertools.cachePage("http://www.redes-tv.com/index.php?option=com_xmap&sitemap=1&Itemid=31") #href='http://www.redestv.com/category/arte/' title="ARTE">ARTE</a></li><li><a #href="/index.php?option=com_content&view=category&layout=blog&id=1&Itemid=9" title="Biotecnolog\xc3\xada y Salud" patronvideos = "index.php." + url + '(.*?)</ul>' #patronvideos=patronvideos.replace("&","\&") #patronvideos=patronvideos.replace(";","\;") #patronvideos=patronvideos.replace("=","\=") #patronvideos=patronvideos.replace("_","\_") #logger.info(patronvideos) #logger.info("web"+data) matches = re.compile(patronvideos,re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) if len(matches)>0: #href="/index.php?option=com_content&view=article&id=65:473-farmacos-para-las-emociones&catid=1:biosalud&Itemid=9" title="473: Fármacos para las emociones" patronvideos = 'href="(.+?)" title="(.+?)"' matches1 = re.compile(patronvideos).findall(matches[0]) for i in range(len(matches1)): #xbmctools.addnewvideo( __channel__ , "buscavideos" , category, matches1[i][1] , matches1[i][0] , "thumbnail" , "") xbmctools.addnewvideo( __channel__ , "buscavideos" , category , "redestv", matches1[i][1] , matches1[i][0] , "thumbnail" , "") 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 detail(params,url,category): logger.info("[pintadibujos.py] detail") title = urllib.unquote_plus( params.get("title") ) thumbnail = urllib.unquote_plus( params.get("thumbnail") ) # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) # ------------------------------------------------------------------------------------ # Busca los enlaces a los videos # ------------------------------------------------------------------------------------ listavideos = servertools.findvideos(data) for video in listavideos: xbmctools.addnewvideo( CHANNELNAME , "play" , category , video[2] , title + " - " + video[0] , video[1] , thumbnail , "" ) # ------------------------------------------------------------------------------------ # 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 novedades(params, url, category): logger.info("[redestv.py] parseweb") # ------------------------------------------------------ # Descarga la página # ------------------------------------------------------ data = scrapertools.cachePage(url) #logger.info(data) #<div style="text-align: justify;">Cre?amos que el ser humano era el ?nico animal capaz de sentir empat?a. Sin embargo, el altruismo existe en muchos otros animales. Estar conectado con los dem?s, entenderlos y sentir su dolor no es exclusivo del ser humano. El prim?tologo Frans de Waal, gran estudiador de las emociones animales, habla con Punset sobre empat?a y simpat?a, capacidades clave para el ?xito en la vida social.</div><div class="jcomments-links"> <a href="/index.php?option=com_content&view=article&id=161:501-nuestro-cerebro-altruista&catid=2:cermen&Itemid=10#addcomments" class="comment-link">Escribir un comentario</a></div> patronvideos = '<td class="contentheading" width="100%">.+?<a href="(.+?)" class="contentpagetitle">\s+(\d+.+?)</a>' #patronvideos = '<div style="text-align: justify;">.+?</div>.+?<a href="(.+?)#' #logger.info("web"+data) matches = re.compile(patronvideos, re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) #xbmctools.addnewfolder( __channel__ , "buscavideos" , category, "redestv" , "http://www.redes-tv.com"+matches[0][0] , "" , "") #scrapertools.printMatches(matches) # patronvideos1 = 'src="http://www.megavideo.com/v/(.{8}).+?".+?></embed>.*?<p>(.+?)</p><div' # matches1 = re.compile(patronvideos1,re.DOTALL).findall(data) # if DEBUG: # scrapertools.printMatches(matches1) for i in range(len(matches)): xbmctools.addnewvideo(__channel__, "buscavideos", category, "redestv", matches[i][1], matches[i][0], "thumbnail", "") 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.log("[skai_folders.py] videolist") # -------------------------------------------------------- # DDownload page # -------------------------------------------------------- data = scrapertools.cachePage(url) # Extrae los vídeos patron = '<p><a href=\'(.*?)\' title=.*?<img alt="([^<]+)" src="(.*?)" /></a></p>' matches = re.compile(patron, re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) for match in matches: scrapedtitle = match[1] scrapedurl = urlparse.urljoin(url, unescape(match[0])) scrapedthumbnail = urlparse.urljoin(url, match[2]) # scrapedplot = scrapertools.entityunescape(match[2]) scrapedplot = "XXX XXXX XXXXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX X X XXX X X X X X X X X X" if DEBUG: xbmc.log("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") # Add to the list of XBMC xbmctools.addnewvideo( CHANNELCODE, "play", CHANNELNAME, "", scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot ) # Next Page pattern = 'class="next_page" rel="next" href="(.*?)">Επόμενη</a></p>' matches = re.compile(pattern, re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) if len(matches) > 0: match = matches[0] scrapedtitle = ">>> Next Page >>>" scrapedurl = urlparse.urljoin(url, match) scrapedthumbnail = "" scrapedplot = "" if DEBUG: xbmc.log("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") # Add to the list of XBMC 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 MovieScan(params,url,category): try: data = get_page(url) #Intentamos filtrar y solo parsear el primer post messages =re.compile("<!-- message -->.*?<!-- / message -->", re.S).findall(data) if (len(messages)>0): for message in messages: data = message break title = urllib.unquote_plus( params.get("title") ) imagen = findimage (data) videos = findvideos(data,False) if(len(videos)>0): numvideo=0 for video in videos: numvideo+=1 if(len(videos)>1): vtitle= str(numvideo) + ".- " + title else: vtitle=title xbmctools.addnewvideo( __channel__ , "play" , category , video[2] , vtitle +" ["+video[2]+"]", video[1] , imagen , "" ) except: printText("Error al obtener videos de" + title) # 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 detail(params, url, category): logger.info("[pintadibujos.py] detail") title = urllib.unquote_plus(params.get("title")) thumbnail = urllib.unquote_plus(params.get("thumbnail")) # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) # ------------------------------------------------------------------------------------ # Busca los enlaces a los videos # ------------------------------------------------------------------------------------ listavideos = servertools.findvideos(data) for video in listavideos: xbmctools.addnewvideo(CHANNELNAME, "play", category, video[2], title + " - " + video[0], video[1], thumbnail, "") # ------------------------------------------------------------------------------------ # 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 parsewebcategorias(params, url, category): logger.info("[redestv.py] buscacategorias") data = scrapertools.cachePage( "http://www.redes-tv.com/index.php?option=com_xmap&sitemap=1&Itemid=31" ) #href='http://www.redestv.com/category/arte/' title="ARTE">ARTE</a></li><li><a #href="/index.php?option=com_content&view=category&layout=blog&id=1&Itemid=9" title="Biotecnolog\xc3\xada y Salud" patronvideos = "index.php." + url + '(.*?)</ul>' #patronvideos=patronvideos.replace("&","\&") #patronvideos=patronvideos.replace(";","\;") #patronvideos=patronvideos.replace("=","\=") #patronvideos=patronvideos.replace("_","\_") #logger.info(patronvideos) #logger.info("web"+data) matches = re.compile(patronvideos, re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) if len(matches) > 0: #href="/index.php?option=com_content&view=article&id=65:473-farmacos-para-las-emociones&catid=1:biosalud&Itemid=9" title="473: Fármacos para las emociones" patronvideos = 'href="(.+?)" title="(.+?)"' matches1 = re.compile(patronvideos).findall(matches[0]) for i in range(len(matches1)): #xbmctools.addnewvideo( __channel__ , "buscavideos" , category, matches1[i][1] , matches1[i][0] , "thumbnail" , "") xbmctools.addnewvideo(__channel__, "buscavideos", category, "redestv", matches1[i][1], matches1[i][0], "thumbnail", "") 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("[peliculasyonkis.py] searchresults") buscador.salvar_busquedas(params,Url,category) url = "http://www.peliculasyonkis.com/buscarPelicula.php?s="+Url.replace(" ", "+") # Descarga la pv°gina data = scrapertools.cachePage(url) #logger.info(data) # Extrae las entradas (carpetas) #<li> <a href="http://www.peliculasyonkis.com/pelicula/las-edades-de-lulu-1990/" title="Las edades de Lulv? (1990)"><img width="77" height="110" src="http://images.peliculasyonkis.com/thumbs/las-edades-de-lulu-1990.jpg" alt="Las edades de Lulv? (1990)" align="right" /> patronvideos = '<li> <a href="([^"]+)" title="([^"]+)"><img.*?src="([^"]+)"' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: scrapedtitle = match[1] scrapedurl = match[0] scrapedthumbnail = match[2] scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") xbmctools.addnewvideo( CHANNELNAME , "detail" , category , "Megavideo" , 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 listnovedades(params, url, category): logger.info("[peliculasyonkis.py] listnovedades") # Descarga la pv°gina data = scrapertools.cachePage(url) #logger.info(data) # Extrae las entradas (carpetas) ''' <td align='center'><center><span style='font-size: 0.7em'> <a href="http://www.peliculasyonkis.sx/pelicula/encontraras-dragones-2011/" title="Encontrarás dragones (2011)"> <img width='100' height='144' src='http://p.staticyonkis.com/thumbs/encontraras-dragones-2011.jpg' alt='Encontrarás dragones (2011)'/><br />Encontrarás dragones (2011)</a> </span><br /><img height="30" src="http://s.staticyonkis.com/images/f/spanish.png" alt="Audio Español" style="vertical-align: middle;" /></center></td> ''' patronvideos = '<td align=\'center\'>' patronvideos += '<center><span style=\'font-size: 0.7em\'>' patronvideos += '<a href="([^"]+)" title="([^"]+)">' patronvideos += '<img.*?src=\'([^\']+)\'[^>]+>.*?' patronvideos += '<img.*?src="(http://s.staticyonkis.com[^"]+)"' matches = re.compile(patronvideos, re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Titulo try: scrapedtitle = unicode(match[1], "utf-8").encode("iso-8859-1") except: scrapedtitle = match[1] # URL scrapedurl = match[0] # Thumbnail scrapedthumbnail = match[2] # procesa el resto scrapedplot = "" # Depuracion if (DEBUG): logger.info("scrapedtitle=" + scrapedtitle) logger.info("scrapedurl=" + scrapedurl) logger.info("scrapedthumbnail=" + scrapedthumbnail) # Av±ade al listado de XBMC xbmctools.addnewvideo(CHANNELNAME, "detail", category, "Megavideo", scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot) # Label (top-right)... xbmcplugin.setContent(int(sys.argv[1]), "movies") 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 listnovedades(params, url, category): logger.info("[peliculasyonkis.py] listnovedades") # Descarga la pv°gina data = scrapertools.cachePage(url) # logger.info(data) # Extrae las entradas (carpetas) """ <td align='center'><center><span style='font-size: 0.7em'> <a href="http://www.peliculasyonkis.sx/pelicula/encontraras-dragones-2011/" title="Encontrarás dragones (2011)"> <img width='100' height='144' src='http://p.staticyonkis.com/thumbs/encontraras-dragones-2011.jpg' alt='Encontrarás dragones (2011)'/><br />Encontrarás dragones (2011)</a> </span><br /><img height="30" src="http://s.staticyonkis.com/images/f/spanish.png" alt="Audio Español" style="vertical-align: middle;" /></center></td> """ patronvideos = "<td align='center'>" patronvideos += "<center><span style='font-size: 0.7em'>" patronvideos += '<a href="([^"]+)" title="([^"]+)">' patronvideos += "<img.*?src='([^']+)'[^>]+>.*?" patronvideos += '<img.*?src="(http://s.staticyonkis.com[^"]+)"' matches = re.compile(patronvideos, re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Titulo try: scrapedtitle = unicode(match[1], "utf-8").encode("iso-8859-1") except: scrapedtitle = match[1] # URL scrapedurl = match[0] # Thumbnail scrapedthumbnail = match[2] # procesa el resto scrapedplot = "" # Depuracion if DEBUG: logger.info("scrapedtitle=" + scrapedtitle) logger.info("scrapedurl=" + scrapedurl) logger.info("scrapedthumbnail=" + scrapedthumbnail) # Av±ade al listado de XBMC xbmctools.addnewvideo( CHANNELNAME, "detail", category, "Megavideo", scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot ) # Label (top-right)... xbmcplugin.setContent(int(sys.argv[1]), "movies") 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("[trailertools.py] mainlist") titulo = "" listavideos = GetTrailerbyKeyboard(titulo,category) if len(listavideos)>0: for video in listavideos: titulo = video[1] url = video[0] thumbnail = video[2] xbmctools.addnewvideo( "trailertools" , "youtubeplay" , category , "Directo" , titulo , url , thumbnail , "Ver Video" ) 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 detailfolder(params,url,category): logger.info("[peliculasyonkis.py] detail") title = urllib.unquote_plus( params.get("title") ) thumbnail = urllib.unquote_plus( params.get("thumbnail") ) plot = unicode( xbmc.getInfoLabel( "ListItem.Plot" ), "utf-8" ) xbmctools.addnewvideo( CHANNELNAME , "detail" , category , "Megavideo" , title , url , thumbnail , plot ) # Label (top-right)... xbmcplugin.setContent(int( sys.argv[ 1 ] ),"movies") 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 listmirrors(params, url, category): logger.info("[veocine.py] listmirrors") #50=full list #xbmc.executebuiltin("Container.SetViewMode(50)") 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 de detalle data = scrapertools.cachePage(url) #logger.info(data) # Extrae los enlaces a los vídeos (Megavídeo) #reproductor.php?video=53842&media=tutv&titulo=Obsesion Extraterrestre - Mirror 1&titulop=Obsesion Extraterrestre #reproductor.php?video=KXLMR3C2&media=megavideo&titulo=Ciencia al desnudo: Jupiter - Mirror 1&titulop=Ciencia al desnudo: Jupiter&des=http%3A%2F%2Fwww.veodescargas.com%2Fdocumentales%2F13743-ciencia-al-desnudo-jupiter-dvb-s-national-geographic.html%23post30969 patron = 'reproductor.php\?video=([^\&]+)\&(?:amp\;)?media=([^\&]+)\&(?:amp\;)?titulo=([^"]+)"' matches = re.compile(patron, re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: try: scrapedtitle = unicode( match[2], "utf-8").encode("iso-8859-1") + " (" + match[0] + ")" except: scrapedtitle = match[2] + " (" + match[0] + ")" scrapedurl = match[0] if match[1] == "megavideo": server = "Megavideo" elif match[1] == "tutv": server = "tu.tv" else: server = "Megavideo" # Añade al listado de XBMC xbmctools.addnewvideo(__channel__, "play", category, server, scrapedtitle, scrapedurl, thumbnail, plot) # 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 listmirrors(params,url,category): logger.info("[veocine.py] listmirrors") #50=full list #xbmc.executebuiltin("Container.SetViewMode(50)") 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 de detalle data = scrapertools.cachePage(url) #logger.info(data) # Extrae los enlaces a los vídeos (Megavídeo) #reproductor.php?video=53842&media=tutv&titulo=Obsesion Extraterrestre - Mirror 1&titulop=Obsesion Extraterrestre #reproductor.php?video=KXLMR3C2&media=megavideo&titulo=Ciencia al desnudo: Jupiter - Mirror 1&titulop=Ciencia al desnudo: Jupiter&des=http%3A%2F%2Fwww.veodescargas.com%2Fdocumentales%2F13743-ciencia-al-desnudo-jupiter-dvb-s-national-geographic.html%23post30969 patron = 'reproductor.php\?video=([^\&]+)\&(?:amp\;)?media=([^\&]+)\&(?:amp\;)?titulo=([^"]+)"' matches = re.compile(patron,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: try: scrapedtitle = unicode( match[2], "utf-8" ).encode("iso-8859-1") + " (" + match[0] + ")" except: scrapedtitle = match[2] + " (" + match[0] + ")" scrapedurl = match[0] if match[1]=="megavideo": server="Megavideo" elif match[1]=="tutv": server="tu.tv" else: server="Megavideo" # Añade al listado de XBMC xbmctools.addnewvideo( __channel__ , "play" , category , server , scrapedtitle , scrapedurl , thumbnail , plot ) # 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 detail(params, url, category): logger.info("[seriesonline.py] detail") title = urllib.unquote_plus(params.get("title")) thumbnail = urllib.unquote_plus(params.get("thumbnail")) # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) # ------------------------------------------------------------------------------------ # Busca los enlaces a los mirrors, o a los capítulos de las series... # ------------------------------------------------------------------------------------ logger.info("Busca el enlace de página siguiente...") try: # La siguiente página patronvideos = '<a href="([^"]+)">Sigu' matches = re.compile(patronvideos, re.DOTALL).findall(data) for match in matches: addfolder("#Siguiente", urlparse.urljoin(url, match), "list") except: logger.info("No encuentro la pagina...") # ------------------------------------------------------------------------------------ # Busca los enlaces a los videos # ------------------------------------------------------------------------------------ listavideos = servertools.findvideos(data) for video in listavideos: xbmctools.addnewvideo(CHANNELNAME, "play", category, video[2], title + " - " + video[0], video[1], thumbnail, "") # ------------------------------------------------------------------------------------ # 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 detallecapitulo(params,url,category): logger.info("[watchanimeon.py] detallecapitulo") 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) #logger.info(data) # ------------------------------------------------------------------------------------ # Busca los enlaces a los videos # ------------------------------------------------------------------------------------ listavideos = servertools.findvideos(data) for video in listavideos: videotitle = video[0] url = video[1] server = video[2] xbmctools.addnewvideo( __channel__ , "play" , category , server , title.strip() + " - " + videotitle , url , thumbnail , plot ) # ------------------------------------------------------------------------------------ # Extrae el enlace a la serie completa patron = '<a href="([^"]+)" title="View all posts in' matches = re.compile(patron,re.DOTALL).findall(data) scrapertools.printMatches(matches) # Las añade a XBMC for match in matches: scrapedtitle = "Ver serie completa" scrapedurl = urlparse.urljoin(url,match) scrapedthumbnail = thumbnail scrapedplot = plot if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addnewfolder( __channel__ , "detalleserie" , 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 orden(params,url,category): logger.info("[redestv.py] buscacategorias") data = scrapertools.cachePage(url) #<td style="text-align: left;"><a href="/index.php?option=com_content&view=article&id=41:500-por-que-mas-es-menos&catid=6:tercol&Itemid=14" title="500: Por qué más es menos">500: Por qué más es menos</a></td> #<td style="text-align: center;">13 Ene 10</td> patronvideos = '<td style="text-align: left;"><a href="(.+?)" title="(.+?)".+?<td style="text-align: center;">(.+?)</td>' #logger.info("web"+data) matches = re.compile(patronvideos,re.DOTALL).findall(data) #if DEBUG: scrapertools.printMatches(matches) if len(matches)>0: for i in range(len(matches)): xbmctools.addnewvideo( __channel__ , "buscavideos" , category , "redestv", matches[i][1] + " - " + matches[i][2], matches[i][0] , "thumbnail" , "") #xbmctools.addnewfolder( __channel__ , "parseweb" , category, matches[i][1] , matches[i][0] , "" , "") 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 detail(params,url,category): logger.info("[seriesonline.py] detail") title = urllib.unquote_plus( params.get("title") ) thumbnail = urllib.unquote_plus( params.get("thumbnail") ) # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) # ------------------------------------------------------------------------------------ # Busca los enlaces a los mirrors, o a los capítulos de las series... # ------------------------------------------------------------------------------------ logger.info("Busca el enlace de página siguiente...") try: # La siguiente página patronvideos = '<a href="([^"]+)">Sigu' matches = re.compile(patronvideos,re.DOTALL).findall(data) for match in matches: addfolder("#Siguiente",urlparse.urljoin(url,match),"list") except: logger.info("No encuentro la pagina...") # ------------------------------------------------------------------------------------ # Busca los enlaces a los videos # ------------------------------------------------------------------------------------ listavideos = servertools.findvideos(data) for video in listavideos: xbmctools.addnewvideo( CHANNELNAME , "play" , category , video[2] , title +" - "+video[0], video[1], thumbnail , "" ) # ------------------------------------------------------------------------------------ # 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 ListaEpisodios(params,url,category): """Lists the episodes in a show """ logger.info("[tvshack.py] ListaEpisodios") if params.has_key("Serie"): serie = params.get("Serie") logger.info("[tvshack.py] ListaEpisodios: Serie = "+serie) else: serie = "" # Adds "Add all to Library" option if category != 'Musica': xbmctools.addnewvideo( CHANNELNAME , "addlist2Library" , category , "", getStr (30920) , url , "" , "" , serie) #"A�ADIR TODOS LOS EPISODIOS A LA BIBLIOTECA" listaEp = devuelveListaEpisodios (params,url,category) for ep in listaEp: xbmctools.addnewvideo( CHANNELNAME , "listaVideosEpisodio" , category , "" , ep['title'] , ep['url'] , ep['thumbnail'] , ep['plot'] , Serie=serie) FinalizaPlugin (pluginhandle,category)
def parsebusquedas(params, url, category): logger.info("[redestv.py] parsebusquedas") data = scrapertools.cachePage(url) #<td style="text-align: left;"><a href="/index.php?option=com_content&view=article&id=41:500-por-que-mas-es-menos&catid=6:tercol&Itemid=14" title="500: Por qué más es menos">500: Por qué más es menos</a></td> #<td style="text-align: center;">13 Ene 10</td> patronvideos = '<fieldset>(.+?)</fieldset>' #logger.info("web"+data) matches = re.compile(patronvideos, re.DOTALL).findall(data) scrapertools.printMatches(matches) if len(matches) > 0: for i in range(len(matches)): patronvideos = '<a href="(.+?)">\s+(.+?)\s\s\s+</a>' matches1 = re.compile(patronvideos, re.DOTALL).findall(matches[i]) scrapertools.printMatches(matches1) xbmctools.addnewvideo(__channel__, "buscavideos", category, "redestv", matches1[0][1], matches1[0][0], "thumbnail", "") 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 detail(params,url,category): logger.info("[sonolatino.py] detail") title = urllib.unquote_plus( params.get("title") ) thumbnail = urllib.unquote_plus( params.get("thumbnail") ) # Descarga la p�gina data = scrapertools.cachePage(url) if len(thumbnail)<=0: patron = '<td valign="top">[^<]+<img src="([^"]+)"' matches = re.compile(patron,re.DOTALL).findall(data) if len(matches)>0: thumbnail = matches[0] print thumbnail thumnbail = thumbnail ok = "false" patrondescrip = '<td.+?class="letra">[^<]+<h3>(.*?)</td>' descripcion = "" plot = "" uri = url matches = re.compile(patrondescrip,re.DOTALL).findall(data) if len(matches)>0: descripcion = matches[0] descripcion = descripcion.replace(" ","") descripcion = descripcion.replace("<BR>","\n") #descripcion = descripcion.replace("\r","") #descripcion = descripcion.replace("\n"," ") descripcion = descripcion.replace("\t","") descripcion = re.sub("<[^>]+>"," ",descripcion) # logger.info("descripcion="+descripcion) descripcion = acentos(descripcion) # logger.info("descripcion="+descripcion) try : plot = unicode( descripcion, "utf-8" ).encode("iso-8859-1") except: plot = descripcion # ---------------------------------------------------------------------------- # Busca los enlaces a los videos de : "Megavideo" # ------------------------------------------------------------------------------------ listavideos = servertools.findvideos(data) for video in listavideos: videotitle = video[0] url1 = video[1].replace("&","&") logger.info("url ="+url) if url.endswith(".jpg"):break server = video[2] if server=="Megavideo" or "Veoh": xbmctools.addnewvideo( __channel__ , "play" , category , server , title.strip().replace("(Megavideo)","").replace(" "," ") + " - " + videotitle , url1 , thumbnail , plot ) else: xbmctools.addnewvideo( __channel__ , "play" , category , server , title.strip().replace(server,"").replace(" "," ") + " - " + videotitle , url1 , thumbnail , plot ) # ------------------------------------------------------------------------------------ # ---- Extrae los videos directos ----- # Extrae los enlaces a los v�deos (Directo) patronvideos = "file: '([^']+)'" servidor = "Directo" extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor) # --------------------------------------- # Extrae los enlaces a los v�deos (izlesene) patronvideos = 'http://www.izlesene.com/.+?video=([0-9]{7})' servidor = "izlesene" extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor) # --- Extrae los videos de veoh ---- patronvideos = 'var embed_code[^>]+> <param name="movie" value="http://www.veoh.com/static/swf/webplayer/WebPlayer.swf.*?permalinkId=(.*?)&player=videodetailsembedded&videoAutoPlay=0&id=anonymous"></param>' servidor = "Veoh" extraevideos(patronvideos,data,category,title+" - Video en Veoh",thumbnail,plot,servidor) # --------------------------------------- #var embed_code = '<embed id="VideoPlayback" src="http://video.google.com/googleplayer.swf?docid=1447612366747092264&hl=en&fs=true" style="width:496px;height:401px" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash" wmode="window"> </embed>' ; # --- Extrae los videos de google ---- patronvideos = '<embed id="VideoPlayback" src="http://video.google.com/googleplayer.swf.*?docid=(.*?)&hl=en&' servidor = "Google" extraevideos(patronvideos,data,category,title+" - [Video en google]",thumbnail,plot,servidor) # --------------------------------------- # --- Extrae los videos de http://n59.stagevu.com ---- patronvideos = '"http://.*?.stagevu.com/v/.*?/(.*?).avi"' servidor = "Stagevu" extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor) # --- Extrae los videos de dailymotion.com ---- patronvideos = 'value="http://www.dailymotion.com/([^"]+)"' servidor = "Dailymotion" extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor) # --- Extrae los videos de vimeo.com ---- patronvideos = "http://vimeo.com.*?clip_id=([0-9]{8})" servidor = "Vimeo" extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor) # --- Extrae los videos de yahoo.com ---- patronvideos = "http://.*?video.yahoo.com.*?id=([v0-9]{10})" servidor = "Yahoo" extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor) # --Muestra Una opcion mas para videos documentales relacionados con el tema-- print "esta es la url :%s" %url try: patron = "http://www.sonolatino.com.*?\_(.*?)\.html" matches = re.compile(patron,re.DOTALL).findall(url) url = uri titulo = "Ver Videos Relacionados" xbmctools.addnewfolder( __channel__ , "Relacionados" , category , titulo , url , "" , "L�sta algunos videos relacionados con el mismo video musical" ) url = "http://www.sonolatino.com/ajax.php?p=detail&do=show_more_best&vid="+matches[0] titulo = "Ver Videos mas vistos" xbmctools.addnewfolder( __channel__ , "Relacionados" , category , titulo , url , "" , "L�sta algunos mas vistos relacionados con el video musical" ) titulo = "Ver Videos del mismo Artista" url = "http://www.sonolatino.com/ajax.php?p=detail&do=show_more_artist&vid="+matches[0] xbmctools.addnewfolder( __channel__ , "Relacionados" , category , titulo , url , "" , "L�sta algunos videos relacionados con el mismo Artista" ) except: pass patron = '<h1 class="h2_artistnuevo">([^<]+)</h1>' matches = re.compile(patron,re.DOTALL).findall(data) if len(matches)>0: xbmctools.addnewfolder( "trailertools" , "buscartrailer" , category , "[Buscar la cancion en Youtube:] "+matches[0] , title , os.path.join(IMAGES_PATH, 'youtube_logo.png') , "Busca el video en Youtube" ) try: artista = matches[0].split("-")[0].strip() xbmctools.addnewfolder( "trailertools" , "buscartrailer" , category , "[Buscar artista en Youtube:] "+artista , title , os.path.join(IMAGES_PATH, 'youtube_logo.png') , "Busca el video en Youtube" ) except: pass # 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 searchvideos(params, url, category): logger.info("[programastv.py] parse") # ------------------------------------------------------ # Descarga la página # ------------------------------------------------------ data = scrapertools.cachePage(url) #logger.info(data) # ------------------------------------------------------ # Extrae las entradas # ------------------------------------------------------ #quitamos a partir de los comentarios data=data[0:data.index('class=\'post-footer\'>')] videos=servertools.findvideos(data) #xbmc.output( videos[0][2] + " es 02") #xbmc.output( videos[1][2] + " es 12") #TODO extract plot y thumbnail if len(videos)>0: if (videos[0][2] == "Megavideo") and (videos[1][2] == "Megaupload"): xbmc.output("asumimos que solo hay un video con dos mirrors") patronvideos = 'class=\'post-title entry-title\'>.+?<a href=\'.+?\'>(.+?)</a>' matches = re.compile(patronvideos,re.DOTALL).findall(data) xbmc.output(matches[0]) xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Megavideo" , matches[0] , videos[0][1] , "" , "" ) xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Megaupload" , matches[0] , videos[1][1] , "" , "" ) elif len(videos)==1: if re.search('&xtp=(.+?)_VIDEO',videos[0][1]): patronvideos = '&xtp=(.+?)_VIDEO' matches = re.compile(patronvideos,re.DOTALL).findall(data) videos[0][1]=matches[0] xbmc.output("aqui estamos") patronvideos = 'class=\'post-title entry-title\'>.+?<a href=\'.+?\'>(.+?)</a>' matches = re.compile(patronvideos,re.DOTALL).findall(data) xbmctools.addnewvideo( CHANNELNAME , "play" , category , videos[0][2] , matches[0] , videos[0][1] , "" , "" ) else: xbmc.output("hay mas de 1 video") for video in videos: if video[2].find("youtube")!=-1: continue #xbmc.output(video[2] + video[1] + " 2 + 1") indexvideo=data.index(video[1]) #xbmc.output(str(indexvideo)) #if (video[2]=="Megaupload"): # #xbmc.output(str(indexvideo)) # indexvideo=data.rindex(">-",0,indexvideo) # #xbmc.output(str(indexvideo)) indexvideo1=data.rindex(">-",0,indexvideo) #xbmc.output(str(indexvideo1)) indexvideo2=data.rindex(">-",0,indexvideo1) #xbmc.output(str(indexvideo2)) #xbmc.output(data[indexvideo2+1:indexvideo1]) nombre=re.sub('<.+?>','',data[indexvideo2+3:indexvideo1-5]) while re.search('egaupl', nombre) or re.search('egavid', nombre): indexvideo3=data.rindex(">-",0, indexvideo2) nombre=re.sub('<.+?>','',data[indexvideo3+3:indexvideo2-5]) indexvideo2=indexvideo3 xbmctools.addnewvideo( CHANNELNAME , "play" , category , video[2] , nombre + " " + video[2] , video[1] , "" , "" ) else: xbmc.output("es un listado") #xbmc.output(data) data=data[data.index('class=\'post-header-line-1\'')+33:] #xbmc.output(data) xbmc.output("aqui llego") p = MyParser() p.feed(data) p.close() itemlist = [] for k, v in p.anchors.items(): print k, "=>", v if re.search('programastvonline.blogspot.com',v[0]): itemlist.append( Item(channel=CHANNELNAME, title=k , action="parsear", url=v[0], folder=True) ) xbmctools.renderItems(itemlist, params, url, category) #'egaupl', nombre) #myparser=MyParser(data) #myparser.parse(data) #links = myparser.get_hyperlinks() # get the hyperlinks list #xbmc.output(str(len(links))) # print all the links #descriptions = myparser.get_descriptions() # get the hyperlinks list #xbmc.output("b",descriptions) # print all the links #xbmc.output("aqui llego 1") #post-header-line-1 #format = formatter.NullFormatter() # create default formatter #htmlparser = LinksExtractor(format) # create new parser object # for video in listavideos: # videotitle = video[0] # scrapedurl = video[1] # server = video[2] # xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , title.strip()+" "+match[1]+" "+match[2]+" "+videotitle , scrapedurl , thumbnail , plot ) # ------------------------------------------------------------------------------------ # Busca los enlaces a los videos # ------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------ # 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 listmirrors(params,url,category): logger.info("[programastv.py] listmirrors") title = urllib.unquote_plus( params.get("title") ) thumbnail = urllib.unquote_plus( params.get("thumbnail") ) #plot = unicode( xbmc.getInfoLabel( "ListItem.Plot" ), "utf-8" ) plot = urllib.unquote_plus( params.get("plot") ) # ------------------------------------------------------------------------------------ # Descarga la página # ------------------------------------------------------------------------------------ data = scrapertools.cachePage(url) #logger.info(data) # ------------------------------------------------------------------------------------ # Busca el argumento # ------------------------------------------------------------------------------------ patronvideos = '<div class="ficha_des">(.*?)</div>' matches = re.compile(patronvideos,re.DOTALL).findall(data) if len(matches)>0: plot = scrapertools.htmlclean(matches[0]) logger.info("plot actualizado en detalle"); else: logger.info("plot no actualizado en detalle"); # ------------------------------------------------------------------------------------ # Busca el thumbnail # ------------------------------------------------------------------------------------ patronvideos = '<div class="ficha_img pelicula_img">[^<]+' patronvideos += '<img src="([^"]+)"' matches = re.compile(patronvideos,re.DOTALL).findall(data) if len(matches)>0: thumbnail = matches[0] logger.info("thumb actualizado en detalle"); else: logger.info("thumb no actualizado en detalle"); # ------------------------------------------------------------------------------------ # Busca los enlaces a los mirrors, o a los capítulos de las series... # ------------------------------------------------------------------------------------ # url = "http://www.programastv.es/inc/mostrar_contenido.php?sec=pelis_ficha&zona=online&id=video-4637" #patronvideos = '<div class="ver_des_peli iframe2">[^<]+' #patronvideos += '<ul class="tabs-nav" id="([^"]+)">' #matches = re.compile(patronvideos,re.DOTALL).findall(data) #data = scrapertools.cachePage("http://www.programastv.es/inc/mostrar_contenido.php?sec=pelis_ficha&zona=online&id="+matches[0]) ''' <div id="ficha_ver_peli"> <div class="v_online"> <h2>Ver online <span>El destino de Nunik</span></h2> <div class="opstions_pelicula_list"> <div class="tit_opts" style="cursor:pointer;" onclick="location.href='http://www.programastv.es/peliculas/drama/el-destino-de-nunik_espanol-dvd-rip-megavideo-6026.html'"> <p>Mirror 1: Megavideo</p> <p><span>CALIDAD: DVD-RIP | IDIOMA: ESPAÑOL</span></p> <p class="v_ico"><img src="http://caratulas.programastv.es/img/cont/megavideo.png" alt="Megavideo" /></p> </div> <div class="tit_opts" style="cursor:pointer;" onclick="location.href='http://www.programastv.es/peliculas/drama/el-destino-de-nunik_espanol-dvd-rip-megavideo-6027.html'"> <p>Mirror 2: Megavideo</p> <p><span>CALIDAD: DVD-RIP | IDIOMA: ESPAÑOL</span></p> <p class="v_ico"><img src="http://caratulas.programastv.es/img/cont/megavideo.png" alt="Megavideo" /></p> </div> </div> </div> </div> ''' ''' <div class="v_online"> <h2>Ver online <span>Cantajuego 6</span></h2> <div class="opstions_pelicula_list"><div class="tit_opts"><a href="/peliculas/animacion-e-infantil/cantajuego-6_espanol-dvd-rip-megavideo-73371.html"> <p>Mirror 1: Megavideo</p> <p><span>CALIDAD: DVD-RIP | IDIOMA: ESPAÑOL</span></p> <p class="v_ico"><img src="http://caratulas.programastv.es/img/cont/megavideo.png" alt="Megavideo" /></p> </a></div> </div> </div> </div><br/><div id="ficha_desc_peli"> <div class="v_online"> <h2 class="ico_fuego">Descargar <span>Cantajuego 6</span></h2> <div class="opstions_pelicula_list"><div class="tit_opts"><a href="/peliculas/animacion-e-infantil/descargar-cantajuego-6_espanol-dvd-rip-megaupload-73372.html" target="_blank"> <p>Mirror 1: Megaupload </p> <p><span>CALIDAD: DVD-RIP | IDIOMA: ESPAÑOL </span></p> <p class="v_ico"><img src="http://caratulas.programastv.es/img/cont/megaupload.png" alt="Megaupload" /></p> </a></div> </div> </div> </div> ''' #patronvideos = '<div class="tit_opts"><a href="([^"]+)">[^<]+' patronvideos = '<div class="tit_opts"><a href="([^"]+)".*?>[^<]+' patronvideos += '<p>([^<]+)</p>[^<]+' patronvideos += '<p><span>([^<]+)</span>' matches = re.compile(patronvideos,re.DOTALL).findall(data) for match in matches: logger.info("Encontrado iframe mirrors "+match[0]) # Lee el iframe mirror = urlparse.urljoin(url,match[0].replace(" ","%20")) req = urllib2.Request(mirror) req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') response = urllib2.urlopen(req) data=response.read() response.close() listavideos = servertools.findvideos(data) for video in listavideos: videotitle = video[0] scrapedurl = video[1] server = video[2] xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , title.strip()+" "+match[1]+" "+match[2]+" "+videotitle , scrapedurl , thumbnail , plot ) # ------------------------------------------------------------------------------------ # Busca los enlaces a los videos # ------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------ # 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 listvideos(params,url,category): logger.info("[peliculas21.py] listvideos") if url=="": url = "http://www.peliculas21.com" # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) #title = urllib.unquote_plus(params.get("title")) #thumbnail = urllib.unquote_plus(params.get("thumbnail")) #plot = urllib.unquote_plus(params.get("plot")) # Busca el area donde estan los videos y la descripcion patronvideos = '<div class="peliculadoblaje">(.*?)<!-- FIN #content-->' matches = re.compile(patronvideos,re.DOTALL).findall(data) # busca el titulo y el thumbnail patronvideos = '<img src="([^"]+)"[^>]+>[^<]+<[^>]+>([^<]+)</div>' matches2 = re.compile(patronvideos,re.DOTALL).findall(matches[0]) for match in matches2: title = match[1] thumbnail = urlparse.urljoin(url,match[0]) plot = "" patronvideos = '<b>Duración:</b>(.*?)<br />' duracion = re.compile(patronvideos,re.DOTALL).findall(matches[0]) if len(duracion)>0:plot = "Duracion:"+duracion[0] + "\n" patronvideos = '<b>Género:</b>(.*?)<br />' genero = re.compile(patronvideos,re.DOTALL).findall(matches[0]) if len(genero)>0:plot = plot + "Genero: "+genero[0] +"\n" patronvideos = '<b>Sinopsis:</b>(.*?)</div>' sinopsis = re.compile(patronvideos,re.DOTALL).findall(matches[0]) # Busca los actores matchesactores = buscactores(matches[0]) if len(matchesactores)>0: plot = plot + "Actores: " c = 0 actores = "ACTORES DE ESTA PELICULA :\n\n" for match in matchesactores: c = c + 1 actores = actores + "-"+match[1] + "\n" if c == 3: plot = plot + match[1] + "\n" elif c == 4: plot = plot + "* " + match[1]+" " else: plot = plot + match[1]+ " , " plot = plot + "\nSinopsis: " + sinopsis[0] plot = re.sub("<[^>]+>"," ",plot) # Busca el trailer patronvideos = '<param name="movie" value="([^"]+)"></param>' matchtrailer = re.compile(patronvideos,re.DOTALL).findall(matches[0]) if len(matchtrailer)>0: for match in matchtrailer: # Añade al listado de XBMC xbmctools.addnewvideo( __channel__ , "youtubeplay" , category ,"Directo", "Ver El Trailer de : "+title , match , thumbnail, plot ) else: #import core.trailertools print title s = unicode( title, "latin-1" ) # Añade al listado de XBMC xbmctools.addnewfolder( "trailertools" , "buscartrailer" , category , config.get_localized_string(30110)+" "+title , url , os.path.join(IMAGES_PATH, 'trailertools.png'), plot ) # Buscar trailer para matchesBK = matches[0] # Extrae las entradas (videos) para megavideo con tipo de audio patronvideos = '<span style="font-size:12px;"><strong>(.*?)</strong></span><br/>.*?' patronvideos += '<span.*?>.*?<a href="http\:\/\/www.megavideo.com\/[\?v=|v/]+([A-Z0-9]{8}).*?" target="_blank">1</a>.</span><br />' matches = re.compile(patronvideos,re.DOTALL).findall(matches[0]) scrapertools.printMatches(matches) encontrados = set() for match in matches: if match[1] not in encontrados: encontrados.add(match[1]) # Titulo scrapedtitle = title + " - [" +scrapertools.entityunescape(match[0])+ "]" + " (Megavideo)" # URL scrapedurl = match[1] # 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( __channel__ , "play" , category ,"Megavideo", 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( __channel__ , "play" , category ,servidor, title+ " - %s" % titulo , scrapedurl , thumbnail, plot ) ''' <span class="bloque-uploader">Anónimo</span> <span class="bloque-doblaje"><img src="../images/esp.gif" class="bandera" /></span> <span class="bloque-link">Opción 8: <a href="javascript:goTo('aHR0cDovL3d3dy5tZWdhdmlkZW8uY29tLz92PTVOM0JYOVMx', 'megavideo.com')" rel="nofollow">Ver película</a></span> ''' patronvideos = '<span class="bloque-doblaje">(.+?)</span>[^<]+' patronvideos +='<span class="bloque-link">[^<]+<a href="#" onclick="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("onclick=\"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( __channel__ , "play" , category ,server, scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) if part2: xbmctools.addnewvideo( __channel__ , "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( __channel__ , "play" , category , "Directo" , title +" - ["+match[0]+"]"+ " (Directo)" , match[1] , thumbnail , plot ) # Busca otras peliculas relacionadas con los actores if len(matchesactores)>0: titulo = "Busca otros Films de los actores de esta pelicula" xbmctools.addnewfolder( __channel__ , "listaractores" , category , titulo , matchesBK , thumbnail, actores ) # Lista peliculas relacionadas titulo = "Ver Peliculas Relacionadas" matches = buscarelacionados(matchesBK) plot2 = "PELICULAS RELACIONADAS :\n\n" for match in matches: plot2 = plot2 + "-"+match[1]+"\n" xbmctools.addnewfolder( __channel__ , "listarelacionados" , category , titulo , matchesBK , thumbnail, plot2 , fanart = thumbnail ) # Label (top-right)... xbmcplugin.setContent(int( sys.argv[ 1 ] ),"movies") 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.log("[skai_folders.py] videolist") # -------------------------------------------------------- # DDownload page # -------------------------------------------------------- data = scrapertools.cachePage(url) # Extrae los vídeos patron = '<p><a href=\'(.*?)\' title=.*?<img alt="([^<]+)" src="(.*?)" /></a></p>' matches = re.compile(patron, re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) for match in matches: scrapedtitle = match[1] scrapedurl = urlparse.urljoin(url, unescape(match[0])) scrapedthumbnail = urlparse.urljoin(url, match[2]) # scrapedplot = scrapertools.entityunescape(match[2]) scrapedplot = "XXX XXXX XXXXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX X X XXX X X X X X X X X X" if (DEBUG): xbmc.log("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") # Add to the list of XBMC xbmctools.addnewvideo(CHANNELCODE, "play", CHANNELNAME, "", scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot) # Next Page pattern = 'class="next_page" rel="next" href="(.*?)">Επόμενη</a></p>' matches = re.compile(pattern, re.DOTALL).findall(data) if DEBUG: scrapertools.printMatches(matches) if len(matches) > 0: match = matches[0] scrapedtitle = ">>> Next Page >>>" scrapedurl = urlparse.urljoin(url, match) scrapedthumbnail = "" scrapedplot = "" if (DEBUG): xbmc.log("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") # Add to the list of XBMC 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 detail(params,url,category): logger.info("[pelisflv.py] detail") title = urllib.unquote_plus( params.get("title") ) thumbnail = urllib.unquote_plus( params.get("thumbnail") ) plot = urllib.unquote_plus( params.get("plot") ) accion = params.get("accion") # Descarga la p�gina datafull = scrapertools.cachePage(url) #logger.info(data) patron = "google_ad_section_start(.*?)google_ad_section_end -->" matches = re.compile(patron,re.DOTALL).findall(datafull) data2 = "" if len(matches)>0: data = matches[0] else: data = datafull patron = '<iframe src="(http://pelisflv.net63.net/player/[^"]+)"' matches = re.compile(patron,re.DOTALL).findall(data) if len(matches)>0: data = scrapertools.cachePage(matches[0]) patron = 'href="(http://gamezinepelisflv.webcindario.com/[^"]+)"' matches = re.compile(patron,re.DOTALL).findall(datafull) if len(matches)>0: data2 = scrapertools.cachePage(matches[0]) data = data + data2 ok = False # ------------------------------------------------------------------------------------ # Busca los enlaces a los videos # ------------------------------------------------------------------------------------ listavideos = servertools.findvideos(data) for video in listavideos: videotitle = video[0] url = video[1] server = video[2] xbmctools.addnewvideo( __channel__ , "play" , category , server , title.strip() + " - " + videotitle , url , thumbnail , plot ) # Busca enlaces en el servidor Stagevu - "el modulo servertools.findvideos() no los encuentra" patronvideos = "(http://stagevu.com[^']+)'" matches = re.compile(patronvideos,re.DOTALL).findall(data) if len(matches)>0: logger.info(" Servidor Stagevu") for match in matches: ok = True scrapedurl = match.replace("&","&") xbmctools.addnewvideo( __channel__ ,"play" , category , "Stagevu" , title+" - [Stagevu]", scrapedurl , thumbnail , plot ) # Busca enlaces en el servidor Movshare - "el modulo servertools.findvideos() no los encuentra" patronvideos = "(http://www.movshare.net[^']+)'" matches = re.compile(patronvideos,re.DOTALL).findall(data) if len(matches)>0: logger.info(" Servidor Movshare") for match in matches: ok = True scrapedurl = match.replace("&","&") xbmctools.addnewvideo( __channel__ ,"play" , category , "Movshare" , title+" - [Movshare]", scrapedurl , thumbnail , plot ) # ------------------------------------------------------------------------------------ #--- Busca los videos Directos patronvideos = 'file=(http\:\/\/[^\&]+)\&' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) print "link directos encontrados :%s" %matches #print data if len(matches)>0: for match in matches: subtitle = "[FLV-Directo]" if ("xml" in match): data2 = scrapertools.cachePage(match) logger.info("data2="+data2) patronvideos = '<track>.*?' patronvideos += '<title>([^<]+)</title>[^<]+' patronvideos += '<location>([^<]+)</location>(?:[^<]+' patronvideos += '<meta rel="type">video</meta>[^<]+|[^<]+)' patronvideos += '<meta rel="captions">([^<]+)</meta>[^<]+' patronvideos += '</track>' matches2 = re.compile(patronvideos,re.DOTALL).findall(data2) scrapertools.printMatches(matches) for match2 in matches2: sub = "" playWithSubt = "play" if match2[2].endswith(".xml"): # Subtitulos con formato xml son incompatibles con XBMC sub = "[Subtitulo incompatible con xbmc]" if ".mp4" in match2[1]: subtitle = "[MP4-Directo]" scrapedtitle = '%s - (%s) %s' %(title,match2[0],subtitle) scrapedurl = match2[1].strip() scrapedthumbnail = thumbnail scrapedplot = plot if match2[2].endswith(".srt"): scrapedurl = scrapedurl + "|" + match2[2] playWithSubt = "play2" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # A�ade al listado de XBMC xbmctools.addnewvideo( __channel__ , playWithSubt , category , "Directo" , scrapedtitle, scrapedurl , scrapedthumbnail, scrapedplot ) ok = True else: if match.endswith(".srt"): scrapedurl = scrapedurl + "|" + match xbmctools.addnewvideo( __channel__ ,"play2" , category , "Directo" , title + " (V.O.S) - "+subtitle, scrapedurl , thumbnail , plot ) ok = True if match.endswith(".xml"): sub = "[Subtitulo incompatible con xbmc]" xbmctools.addnewvideo( __channel__ ,"play" , category , "Directo" , title + " (V.O) - %s %s" %(subtitle,sub), scrapedurl , thumbnail , plot ) ok = True scrapedurl = match print scrapedurl #src="http://pelisflv.net63.net/player/videos.php?x=http://pelisflv.net63.net/player/xmls/The-Lord-Of-The-Ring.xml" patronvideos = '(http\:\/\/[^\/]+\/[^\/]+\/[^\/]+\/[^\.]+\.xml)' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) #print data if len(matches)>0: playlistFile = open(FULL_FILENAME_PATH,"w") playlistFile.write("[playlist]\n") playlistFile.write("\n") for match in matches: subtitle = "[FLV-Directo]" data2 = scrapertools.cachePage(match.replace(" ","%20")) logger.info("data2="+data2) patronvideos = '<track>.*?' patronvideos += '<title>([^<]+)</title>.*?' patronvideos += '<location>([^<]+)</location>(?:[^<]+' patronvideos += '<meta rel="captions">([^<]+)</meta>[^<]+' patronvideos += '|([^<]+))</track>' matches2 = re.compile(patronvideos,re.DOTALL).findall(data2) scrapertools.printMatches(matches) c = 0 for match2 in matches2: c +=1 sub = "" playWithSubt = "play" if match2[2].endswith(".xml"): # Subtitulos con formato xml son incompatibles con XBMC sub = "[Subtitulo incompatible con xbmc]" if match2[1].endswith(".mp4"): subtitle = "[MP4-Directo]" scrapedtitle = '%s - (%s) %s' %(title,match2[0],subtitle) scrapedurl = match2[1].strip() scrapedthumbnail = thumbnail scrapedplot = plot if match2[2].endswith(".srt"): scrapedurl = scrapedurl + "|" + match2[2] playWithSubt = "play2" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # A�ade al listado de XBMC xbmctools.addnewvideo( __channel__ , playWithSubt , category , "Directo" , scrapedtitle, scrapedurl , scrapedthumbnail, scrapedplot ) ok =True playlistFile.write("File%d=%s\n" %(c,match2[1])) playlistFile.write("Title%d=%s\n" %(c,match2[0])) playlistFile.write("\n") playlistFile.write("NumberOfEntries=%d\n" %c) playlistFile.write("Version=2\n") playlistFile.flush(); playlistFile.close() if c>0: xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , "Reproducir Todo a la vez...", FULL_FILENAME_PATH , scrapedthumbnail, scrapedplot ) # Busca enlaces en el servidor Videoweed - "el modulo servertools.findvideos() no los encuentra" patronvideos = '(http\:\/\/[^\.]+\.videoweed.com\/[^"]+)"' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) if len(matches)>0: logger.info(" Servidor Videoweed") for match in matches: ok = True scrapedurl = match.replace("&","&") xbmctools.addnewvideo( __channel__ ,"play" , category , "Videoweed" , title+" - [Videoweed]", scrapedurl , thumbnail , plot ) # Busca enlaces en el servidor Gigabyteupload # http://cdn-2.gigabyteupload.com/files/207bb7b658d5068650ebabaca8ffc52d/vFuriadeTitanes_newg.es.avi patronvideos = '(http\:\/\/[^\.]+\.gigabyteupload.com\/[^"]+)"' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) if len(matches)>0: logger.info(" Servidor Gigabyteupload") for match in matches: ok = True xbmctools.addnewvideo( __channel__ ,"play" , category , "Gigabyteupload" , title+" - [Gigabyteupload]",match , thumbnail , plot ) ## --------------------------------------------------------------------------------------## # Busca enlaces de videos para el servidor vk.com # ## --------------------------------------------------------------------------------------## ''' var video_host = '447.gt3.vkadre.ru'; var video_uid = '0'; var video_vtag = '2638f17ddd39-'; var video_no_flv = 0; var video_max_hd = '0'; var video_title = 'newCine.NET+-+neWG.Es+%7C+Chicken+Little'; patronvideos = 'src="(http://[^\/]+\/video_ext.php[^"]+)"' matches = re.compile(patronvideos,re.DOTALL).findall(data) if len(matches)>0: ok = True print " encontro VK.COM :%s" %matches[0] videourl = vk.geturl(matches[0]) xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title + " - "+"[VK]", videourl , thumbnail , plot ) ''' ## --------------------------------------------------------------------------------------## # Busca enlaces a video en el servidor Dailymotion # ## --------------------------------------------------------------------------------------## patronvideos = 'http://www.dailymotion.com/swf/video/([^"]+)"' matches = re.compile(patronvideos,re.DOTALL).findall(data) playWithSubt = "play" subtit = "" if len(matches)>0: daily = 'http://www.dailymotion.com/video/%s'%matches[0] data2 = scrapertools.cachePage(daily) # Busca los subtitulos en espa�ol subtitulo = re.compile('%22es%22%3A%22(.+?)%22').findall(data2) if len(subtitulo)>0: subtit = urllib.unquote(subtitulo[0]) subtit = subtit.replace("\/","/") # Busca el enlace al video con formato FLV Lowres=re.compile('%22sdURL%22%3A%22(.+?)%22').findall(data2) if len(Lowres)>0: videourl = urllib.unquote(Lowres[0]) videourl = videourl.replace("\/","/") if len(subtit)>0: videourl = videourl + "|" + subtit playWithSubt = "play2" subtitle = "[FLV-Directo-Dailymotion]" xbmctools.addnewvideo( __channel__ , playWithSubt , category , "Directo" , title + " - "+subtitle, videourl , thumbnail , plot ) # Busca el enlace al video con formato HQ (H264) Highres=re.compile('%22hqURL%22%3A%22(.+?)%22').findall(data2) if len(Highres)>0: videourl = urllib.unquote(Highres[0]) videourl = videourl.replace("\/","/") if len(subtit)>0: videourl = videourl + "|" + subtit playWithSubt = "play2" subtitle = "[h264-Directo-Dailymotion-este video no es soportado en versiones antiguas o xbox plataforma]" xbmctools.addnewvideo( __channel__ , playWithSubt , category , "Directo" , title + " - "+subtitle, videourl , thumbnail , plot ) if not ok: patron = "SeriesPage" matches = re.compile(patron,re.DOTALL).findall(datafull) if len(matches)>0: ListadoCapitulosSeries(params,url,category) # 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 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(__channel__, "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(__channel__, "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(__channel__, "play", category, server, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot) if part2: xbmctools.addnewvideo(__channel__, "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( __channel__, "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(__channel__, "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(__channel__, "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(__channel__, "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 detail(params, url, category): logger.info("[nolomires.py] detail") title = acentos(urllib.unquote_plus(params.get("title"))) thumbnail = urllib.unquote_plus(params.get("thumbnail")) plot = "" scrapedurl = "" # Descarga la p�gina data = scrapertools.cachePage(url) #logger.info(data) # Extrae el argumento patronarg = '<h[2-3]>(<span style.*?)</p>' matches = re.compile(patronarg, re.DOTALL).findall(data) if len(matches) > 0: plot = re.sub("<[^>]+>", " ", matches[0]) patronthumb = '<div id="textimg"><img src="([^"]+)"' matches = re.compile(patronthumb, re.DOTALL).findall(data) if len(matches) > 0: thumbnail = matches[0] # ------------------------------------------------------------------------------------ # Busca los enlaces a los videos en los servidores habilitados # ------------------------------------------------------------------------------------ listavideos = servertools.findvideos(data) for video in listavideos: videotitle = video[0] url = video[1] server = video[2] xbmctools.addnewvideo(__channel__, "play", category, server, title.strip() + " - " + videotitle, url, thumbnail, plot) ## --------------------------------------------------------------------------------------## # Busca enlaces a videos .flv o (.mp4 dentro de un xml) # ## --------------------------------------------------------------------------------------## patronvideos = 'file=(http\:\/\/[^\&]+)\&' matches = re.compile(patronvideos, re.DOTALL).findall(data) scrapertools.printMatches(matches) playWithSubt = "play" c = 0 if len(matches) > 0: for match in matches: print "link xml :%s" % match subtitle = "[FLV-Directo]" c += 1 sub = "" if ("/xml" in match): data2 = scrapertools.cachePage(match) logger.info("data2=" + data2) patronvideos = '<track>.*?' patronvideos += '<title>([^<]+)</title>[^<]+' patronvideos += '<location>([^<]+)</location>(?:[^<]+' patronvideos += '<meta rel="type">video</meta>[^<]+|[^<]+)' patronvideos += '<meta rel="captions">([^<]+)</meta>[^<]+' patronvideos += '</track>' matches2 = re.compile(patronvideos, re.DOTALL).findall(data2) scrapertools.printMatches(matches) if len(matches2) == 0: newpatron = '<title>([^<]+)</title>[^<]+<location>([^<]+)</location>' matches2 = re.compile(newpatron, re.DOTALL).findall(data2) sub = "None" for match2 in matches2: try: if match2[2].endswith( ".xml" ): # Subtitulos con formato xml son incompatibles con XBMC sub = "[Subtitulo incompatible con xbmc]" playWithSubt = "play" except: pass if ".mp4" in match2[1]: subtitle = "[MP4-Directo]" scrapedtitle = '%s (castellano) - %s %s' % ( title, match2[0], subtitle) scrapedurl = match2[1].strip() scrapedthumbnail = thumbnail scrapedplot = plot if ("cast.xml" or "mirror.xml") not in match and sub == "": scrapedtitle = '%s (V.O.S) - %s %s %s' % ( title, match2[0], subtitle, sub) try: if not match2[2].endswith("cine-adicto2.srt") and ( sub == ""): scrapedurl = scrapedurl + "|" + match2[2] playWithSubt = "play2" except: pass if (DEBUG): logger.info("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") # A�ade al listado de XBMC xbmctools.addnewvideo(__channel__, playWithSubt, category, "Directo", scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot) else: if match.endswith(".srt"): scrapedurl = scrapedurl + "|" + match xbmctools.addnewvideo(__channel__, "play2", category, "Directo", title + " (V.O.S) - " + subtitle, scrapedurl, thumbnail, plot) if match.endswith(".xml"): sub = "[Subtitulo incompatible con xbmc]" xbmctools.addnewvideo( __channel__, "play", category, "Directo", title + " (V.O) - %s %s" % (subtitle, sub), scrapedurl, thumbnail, plot) scrapedurl = match print scrapedurl ## --------------------------------------------------------------------------------------## # Busca enlaces de videos para el servidor vk.com # ## --------------------------------------------------------------------------------------## #http://vkontakte.ru/video_ext.php?oid=93103247&id=149051583&hash=793cde84b05681fa&hd=1 ''' patronvideos = '(http\:\/\/vk.+?\/video_ext\.php[^"]+)"' matches = re.compile(patronvideos,re.DOTALL).findall(data) if len(matches)>0: for match in matches: print " encontro VK.COM :%s" %match videourl = scrapertools.unescape(match) xbmctools.addnewvideo( __channel__ , "play" , category , "vk" , title + " - "+"[VK]", videourl , thumbnail , plot ) ''' # 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 searchresults(params,url,category): xbmc.output("[meristation.py] searchresults") # Descarga la página xbmc.output("[meristation.py] url="+url) data = scrapertools.downloadpagewithcookies(url) #xbmc.output(data) # Extrae las entradas (carpetas) ''' onMouseOut="this.style.background='#ffffff'"> <td class="tabla_borde_down" valign="top" width="250"> <font face="Arial, Helvetica, sans-serif" size="2"> <a href="des_videos.php?pic=WII&idj=cw45ba12c3a8156&COD=cw4b002ff355067" class="mslink9"> <b>MeriStation TV Noticias 3x11</b></a></font> <font face="Arial, Helvetica, sans-serif" size="2"> <a href="WII_portada.php" class="mslink8"> <font color="#3366CC"><b>WII</b></font></a><span class="mstrucos"></span> <br> <a href="empresa.php?pic=GEN&id=cw428d365050c81" class="mslink9"> Nintendo</a></font> <font face="Arial, Helvetica, sans-serif" size="2"></font> <font face="Arial, Helvetica, sans-serif" size="2"> </font> </td> <td class="tabla_borde_down" valign="top" width="100"> <font face="Arial, Helvetica, sans-serif" size="2"> <a href="GEN_.php" class="mslink9"> Simulador</a></font> <font face="Arial, Helvetica, sans-serif" size="2"></font><br> <span class=fecha> 16/11/09 </span> </td> <td class="tabla_borde_down" valign="top" width="200"> <a href="shopping.php?idj=cw45ba12c3a8156" target="_blank"> <img src="imgs/icono_busqueda_carrito1.gif" width="22" height="20" alt="Comprar" border="0"></a> <a href="listado_imagenes.php?pic=WII&idj=cw45ba12c3a8156"> <img src="imgs/icono_busqueda_imagenes.gif" width="22" height="20" alt="Galería de Imágenes" border="0"></a> <a href="des_avances.php?pic=WII&pes=1&idj=cw45ba12c3a8156" > <img src="imgs/icono_busqueda_avances.gif" width="22" height="20" alt="Avance" border="0"></a> <a href="des_videos.php?pic=WII&pes=1&idj=cw45ba12c3a8156" > <img src="imgs/icono_busqueda_videos.gif" width="22" height="20" alt="Vídeos" border="0"></a> </td> <td class="tabla_borde_down" width="50" valign="top" align="center"> <font face="Arial, Helvetica, sans-serif" size="2"> <b>--</b></a></font> </td> ''' patron = '<tr onMouseOver="this.style.background =\'\' "; this.style.cursor = \'hand\'"(.*?)</tr>' matches = re.compile(patron,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: patron2 = '<td class="tabla_borde_down" valign="top" width="250">[^<]+' patron2 += '<font face="Arial, Helvetica, sans-serif" size="2">[^<]+' patron2 += '<a href="([^"]+)" class="mslink9">[^<]+' patron2 += '<b>([^<]+)</b></a></font>[^<]+' patron2 += '<font face="Arial, Helvetica, sans-serif" size="2">[^<]+' patron2 += '<a href="[^"]+" class="mslink8">[^<]+' patron2 += '<font color="[^"]+"><b>([^<]+)</b></font></a><span class="mstrucos"></span>[^<]+' patron2 += '<br>[^<]+' patron2 += '<a href="empresa.php[^"]+" class="mslink9">([^<]+)</a></font>[^<]+' matches2 = re.compile(patron2,re.DOTALL).findall(match) for match2 in matches2: # Atributos del vídeo scrapedtitle = match2[1].strip()+" ["+match2[2].strip()+"] ["+match2[3].strip()+"]" scrapedurl = urlparse.urljoin(url,match2[0]) scrapedthumbnail = "" scrapedplot = "" if (DEBUG): xbmc.output("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC 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 ultimosvideos(params,url,category): xbmc.output("[meristation.py] ultimosvideos") # Descarga la página xbmc.output("[meristation.py] url="+url) data = scrapertools.downloadpagewithcookies(url) #xbmc.output(data) # Ultimos vídeos xbmc.output("[meristation.py] recientes") ''' <td valign="top" align="center"> <a href="des_videos.php?id=cw4b39e7ef51a6f&pic=PC&idj=cw49a26c7a07937" class="mslink9news"><b>Mass Effect 2 </b></a> <span class="mslink8">|</span> <a href="PC_portada.php" class="mslink8"><b><font color="#990066">PC</font></b></a><span class="fecha"></span> <br> <div class=fecha> 29 Dic 2009 | <font face="Arial, Helvetica, sans-serif" size="2" color="#000000"> <span class="fecha"><a href="PC_rol.php" class="mslink8news"> <font color="#666666">Rol</font></a></span></font> </div> </td> ''' patron = '<td valign="top" align="center">[^<]+' patron += '<a href="([^"]+)" class="mslink9news"><b>([^<]+)</b></a> <span class="mslink8">.</span>[^<]+' patron += '<a href="[^"]+" class="mslink8"><b><font color="[^"]+">([^<]+)</font></b></a><span class="fecha"></span>[^<]+' patron += '<br>[^<]+' patron += '<div class=fecha>([^\|]+)\| <font face="Arial, Helvetica, sans-serif" size="2" color="#000000">[^<]+' patron += '<span class="fecha"><a href="[^"]+" class="mslink8news">[^<]+' patron += '<font color="[^"]+">([^<]+)</font>' matches = re.compile(patron,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Atributos del vídeo scrapedtitle = match[1]+" ("+match[2]+")"+" ("+match[3].strip()+")"+" ("+match[4]+")" scrapedurl = urlparse.urljoin(url,match[0]) scrapedthumbnail = "" scrapedplot = "" if (DEBUG): xbmc.output("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addnewvideo( CHANNELCODE , "play" , category , "Directo" , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot ) # Ultimos vídeos xbmc.output("[meristation.py] ultimos") ''' <tr valign="middle" bgcolor="#F2F2F2"> <td width="15" valgin="middle"><font face="Arial, Helvetica, sans-serif" size="2"><img src="imgs/trucos/top10_mantiene.gif" width="11" height="10"></font></td> <td width="55" valign="middle"><span class=fecha>11/12/09</span></td> <td width="230" valign="middle"><a href="des_videos.php?id=cw4b27546152101&pic=360&idj=cw4a1fa3d144f98" class="mslink9news"><b>BRINK, Ciudad Parte 1</b></a></td> <td width="55" valign="middle"> <div align="center"><font face="Arial, Helvetica, sans-serif" size="2" color="#000000"><span class="fecha"><a href="360_portada.php" class="mslink8"><font color="#99CC00"><b>360</b></font></a></span></font> </div> </td> <td width="75" valign="middle"><font face="Arial, Helvetica, sans-serif" size="2" color="#000000"><a href="360_accion.php" class="mslink8news">Acción</a></font></td> </tr> ''' patron = '<tr valign="middle" bgcolor="[^"]+">[^<]+' patron += '<td width="15" valgin="middle"><font face="Arial, Helvetica, sans-serif" size="2"><img[^>]+></font></td>[^<]+' patron += '<td width="55" valign="middle"><span class=fecha>([^<]+)</span></td>[^<]+' patron += '<td width="230" valign="middle"><a href="([^"]+)" class="mslink9news"><b>([^<]+)</b></a></td>[^<]+' patron += '<td width="55" valign="middle"> [^<]+' patron += '<div align="center"><font face="Arial, Helvetica, sans-serif" size="2" color="#000000"><span class="fecha"><a href="[^"]+" class="mslink8"><font color="[^"]+"><b>([^<]+)</b></font></a></span></font> </div>[^<]+' patron += '</td>[^<]+' patron += '<td width="75" valign="middle"><font face="Arial, Helvetica, sans-serif" size="2" color="#000000"><a href="[^"]+" class="mslink8news">([^<]+)</a></font></td>[^<]+' matches = re.compile(patron,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Atributos del vídeo scrapedtitle = match[2]+" ("+match[0]+")"+" ("+match[3]+")"+" ("+match[4]+")" scrapedurl = urlparse.urljoin(url,match[1]) scrapedthumbnail = "" scrapedplot = "" if (DEBUG): xbmc.output("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC 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 letraresults(params,url,category): xbmc.output("[meristation.py] letraresults") # Descarga la página xbmc.output("[meristation.py] url="+url) data = scrapertools.downloadpagewithcookies(url) #xbmc.output(data) # Extrae las entradas (carpetas) ''' <tr> <td valign="top"><font face="Arial, Helvetica, sans-serif" size="2"> <a href="des_videos.php?id=cw4b30babc22255&idj=cw4a697e97d6fe4&pic=GEN" class="mslink9"><b>Army Of Two: 40th Day</b></a></font> <font face="Arial, Helvetica, sans-serif" size="2"> <a href="PS3_portada.php" class="mslink8"> <font color="#999999"><b>PS3</b></font></a><span class="mstrucos"></span> <br> <a href="empresa.php?pic=GEN&id=cw45772dad6567c" class="mslink9"> EA Montreal</a></font> <font face="Arial, Helvetica, sans-serif" size="2"></font> <font face="Arial, Helvetica, sans-serif" size="2"> </font></td> <td valign="top" width="100"> <font face="Arial, Helvetica, sans-serif" size="2"> <a href="GEN_accion.php" class="mslink9"> Acción</a></font><font face="Arial, Helvetica, sans-serif" size="2"></font><br> <span class=fecha>20/12/09</span> </td> <td width="50" valign="top" align="center"> <font face="Arial, Helvetica, sans-serif" size="2"> <span class="mslink9"><b>1232</b></span></font></td> </tr> ''' patron = '<tr>[^<]+' patron += '<td valign="top"><font face="Arial, Helvetica, sans-serif" size="2">[^<]+' patron += '<a href="([^"]+)" class="mslink9"><b>([^<]+)</b></a></font>[^<]+' patron += '<font face="Arial, Helvetica, sans-serif" size="2">[^<]+' patron += '<a href="[^"]+" class="mslink8">[^<]+' patron += '<font color="[^"]+"><b>([^<]+)</b></font></a><span class="mstrucos"></span>[^<]+' patron += '<br>[^<]+' patron += '<a href="[^"]+" class="mslink9">([^<]+)</a></font>[^<]+' patron += '<font face="Arial, Helvetica, sans-serif" size="2"></font>[^<]+' patron += '<font face="Arial, Helvetica, sans-serif" size="2"> [^<]+' patron += '</font></td>[^<]+' patron += '<td valign="top" width="100">[^<]+' patron += '<font face="Arial, Helvetica, sans-serif" size="2">[^<]+' patron += '<a href="[^"]+" class="mslink9">([^<]+)</a></font><font face="Arial, Helvetica, sans-serif" size="2"></font><br>[^<]+' patron += '<span class=fecha>([^<]+)</span>' matches = re.compile(patron,re.DOTALL).findall(data) for match in matches: # Atributos del vídeo scrapedtitle = match[1].strip()+" ["+match[2].strip()+"] ["+match[3].strip()+"] ["+match[4].strip()+"]" scrapedurl = urlparse.urljoin(url,match[0]) scrapedthumbnail = "" scrapedplot = "" if (DEBUG): xbmc.output("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addnewvideo( CHANNELCODE , "play" , category , "Directo" , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot ) patron = '<a href="([^"]+)" class="mslink9">[^<]+<b>Siguiente</b></a></font> <img src="imgs/flecha_derecha.gif" width="4" height="6">' matches = re.compile(patron,re.DOTALL).findall(data) for match in matches: # Atributos del vídeo scrapedtitle = "Página siguiente" scrapedurl = urlparse.urljoin(url,match) scrapedthumbnail = "" scrapedplot = "" if (DEBUG): xbmc.output("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELCODE , "letraresults" , 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 extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor): logger.info("patron="+patronvideos) matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) if len(matches)>0 : # A�ade al listado de XBMC if servidor == "Directo": if "youtube.com" in matches[0]: from youtube import Extract_id url = Extract_id(matches[0]) xbmctools.addnewvideo( __channel__ , "play" , category , "Youtube" , "%s [YOUTUBE]" %title , url , thumbnail , plot ) else: xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , "%s [Directo]" %title, matches[0] , thumbnail , plot ) elif servidor == "Veoh": from servers import veoh veohurl = veoh.get_video_url(matches[0]) logger.info(" veohurl = " +veohurl) if len(veohurl)>0: if veohurl=="http://./default.asp": advertencia = xbmcgui.Dialog() resultado = advertencia.ok('El Video Video' , title , 'no existe en Veoh','visite la pagina www.sonolatino.com para reportarlo' ) return logger.info(" newmatches = "+veohurl) xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title, veohurl , thumbnail , plot ) else: advertencia = xbmcgui.Dialog() resultado = advertencia.ok('El Video Video' , title , 'no existe en Veoh') return elif servidor == "Google": url = "http://www.flashvideodownloader.org/download.php?u=http://video.google.com/videoplay?docid="+matches[0] logger.info(" Url = "+url) data1 = scrapertools.cachePage(url) newpatron = '</script>.*?<a href="(.*?)" title="Click to Download">' newmatches = re.compile(newpatron,re.DOTALL).findall(data1) if len(newmatches)>0: logger.info(" newmatches = "+newmatches[0]) xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title, newmatches[0] , thumbnail , plot ) elif servidor == "Stagevu": url= "http://stagevu.com/video/"+matches[0] from servers import stagevu url = stagevu.get_video_url(url) logger.info(" url = "+url) videotitle = "Video en Stagevu" server = servidor xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title.strip().replace(server,"").replace(" "," ") + " - " + videotitle , url , thumbnail , plot ) elif servidor == "izlesene": url = "http://www.izlesene.com/actions/video/embed.php?video="+matches[0] data1 = scrapertools.cachePage(url) newpatron = "fURL=([^\&]+)\&vduration=([^\&]+)\&" newmatches = re.compile(newpatron,re.DOTALL).findall(data1) if len(newmatches)>0: logger.info(" izlesene furl = "+newmatches[0][0]) url = "http://dcdn.nokta.com/%s%s" %(newmatches[0][0], "_1_5_1.xml") xbmctools.addnewvideo( __channel__ , "play" , category , "izlesene" , "%s (%s) [IZLESENE]" %(title,newmatches[0][1]) , url , thumbnail , plot ) elif servidor == "Dailymotion": if "/" in matches[0]: idd = matches[0].split("/") id = idd[len(idd)-1] else: id = matches[0] daily = 'http://www.dailymotion.com/video/%s'%id data2 = scrapertools.cachePage(daily) Lowres=re.compile('%22sdURL%22%3A%22(.+?)%22').findall(data2) if len(Lowres)>0: videourl = urllib.unquote(Lowres[0]) videourl = videourl.replace("\/","/") subtitle = "[FLV-Directo-Dailymotion]" xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title + " - "+subtitle, videourl , thumbnail , plot ) # Busca el enlace al video con formato HQ (H264) Highres=re.compile('%22hqURL%22%3A%22(.+?)%22').findall(data2) if len(Highres)>0: videourl = urllib.unquote(Highres[0]) videourl = videourl.replace("\/","/") subtitle = "[h264-Directo-Dailymotion-este video no es soportado en versiones antiguas o xbox plataforma]" xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title + " - "+subtitle, videourl , thumbnail , plot ) elif servidor == "Vimeo": subtitle = "[Vimeo]" xbmctools.addnewvideo( __channel__ , "play" , category , "Vimeo" , title + " - "+subtitle, matches[0] , thumbnail , plot ) ## ------------------------- elif servidor == "Yahoo": import yahoo subtitle = "[Yahoo]" video_url = yahoo.geturl(matches[0]) if len(video_url)>0: if "rtmp" in video_url: addnewvideo( __channel__ , "playRtmp" , category , "Directo" , title + " - "+subtitle, video_url , thumbnail , plot ) else: xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title + " - "+subtitle, video_url , thumbnail , plot )
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( __channel__ , "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( __channel__ , "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( __channel__ , "play" , category ,server, scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) if part2: xbmctools.addnewvideo( __channel__ , "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( __channel__ , "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( __channel__ , "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( __channel__ , "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( __channel__ , "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 listvideos(params,url,category): logger.info("[peliculasyonkis.py] listvideos") # Descarga la pv°gina data = scrapertools.cachePage(url) #logger.info(data) # Extrae las entradas (carpetas) patronvideos = "<a href='([^']+)'>Siguiente >></a>" matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Titulo scrapedtitle = "#Siguiente" # URL scrapedurl = match # Thumbnail scrapedthumbnail = "" # procesa el resto scrapedplot = "" # Depuracion if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # Av±ade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot ) # Extrae las entradas (carpetas) patronvideos = '<li>[^<]+<a href="([^"]+)" title="([^"]+)"><img.*?src="([^"]+)"[^>]+>.*?<span[^>]+>(.*?)</span>' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Titulo try: scrapedtitle = unicode( match[1], "utf-8" ).encode("iso-8859-1") except: scrapedtitle = match[1] # URL scrapedurl = match[0] # Thumbnail scrapedthumbnail = match[2] # procesa el resto try: scrapedplot = unicode( match[3], "utf-8" ).encode("iso-8859-1") except: scrapedplot = match[3] scrapedplot = scrapedplot.replace("\r"," ") scrapedplot = scrapedplot.replace("\n"," ") scrapedplot = scrapedplot.replace(""","'") scrapedplot = scrapedplot.replace("<br />","|") patronhtml = re.compile( '<img[^>]+>' ) scrapedplot = patronhtml.sub( "", scrapedplot ) patronhtml = re.compile( 'Uploader:[^\|]+\|' ) scrapedplot = patronhtml.sub( "", scrapedplot ) patronhtml = re.compile( 'Idioma:[^\|]+\|' ) scrapedplot = patronhtml.sub( "", scrapedplot ) patronhtml = re.compile( 'Tiene descarga directa:[^\|]+\|' ) scrapedplot = patronhtml.sub( "", scrapedplot ) patronhtml = re.compile( '\W*\|\W*' ) scrapedplot = patronhtml.sub( "|", scrapedplot ) patronhtml = re.compile( '\|Descripci.n:' ) scrapedplot = patronhtml.sub( "\n\n", scrapedplot ) scrapedplot = scrapedplot.replace("|b>Servidor:</b|","") scrapedplot = re.sub('<[^>]+>',"",scrapedplot) scrapedplot = scrapedplot.replace("b>","\n") # Depuracion if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # Av±ade al listado de XBMC xbmctools.addnewvideo( CHANNELNAME , "detail" , category , "Megavideo" , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot , fanart=scrapedthumbnail) # Cierra el directorio de XBMC xbmcplugin.setContent(int( sys.argv[ 1 ] ),"movies") 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 detail(params,url,category): logger.info("[nolomires.py] detail") title = acentos(urllib.unquote_plus( params.get("title") )) thumbnail = urllib.unquote_plus( params.get("thumbnail") ) plot = "" scrapedurl = "" # Descarga la p�gina data = scrapertools.cachePage(url) #logger.info(data) # Extrae el argumento patronarg = '<h[2-3]>(<span style.*?)</p>' matches = re.compile(patronarg,re.DOTALL).findall(data) if len(matches)>0: plot = re.sub("<[^>]+>"," ",matches[0]) patronthumb = '<div id="textimg"><img src="([^"]+)"' matches = re.compile(patronthumb,re.DOTALL).findall(data) if len(matches)>0: thumbnail = matches[0] # ------------------------------------------------------------------------------------ # Busca los enlaces a los videos en los servidores habilitados # ------------------------------------------------------------------------------------ listavideos = servertools.findvideos(data) for video in listavideos: videotitle = video[0] url = video[1] server = video[2] xbmctools.addnewvideo( __channel__ , "play" , category , server , title.strip() + " - " + videotitle , url , thumbnail , plot ) ## --------------------------------------------------------------------------------------## # Busca enlaces a videos .flv o (.mp4 dentro de un xml) # ## --------------------------------------------------------------------------------------## patronvideos = 'file=(http\:\/\/[^\&]+)\&' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) playWithSubt = "play" c = 0 if len(matches)>0: for match in matches: print "link xml :%s" %match subtitle = "[FLV-Directo]" c += 1 sub = "" if ("/xml" in match): data2 = scrapertools.cachePage(match) logger.info("data2="+data2) patronvideos = '<track>.*?' patronvideos += '<title>([^<]+)</title>[^<]+' patronvideos += '<location>([^<]+)</location>(?:[^<]+' patronvideos += '<meta rel="type">video</meta>[^<]+|[^<]+)' patronvideos += '<meta rel="captions">([^<]+)</meta>[^<]+' patronvideos += '</track>' matches2 = re.compile(patronvideos,re.DOTALL).findall(data2) scrapertools.printMatches(matches) if len(matches2)==0: newpatron = '<title>([^<]+)</title>[^<]+<location>([^<]+)</location>' matches2 = re.compile(newpatron,re.DOTALL).findall(data2) sub = "None" for match2 in matches2: try: if match2[2].endswith(".xml"): # Subtitulos con formato xml son incompatibles con XBMC sub = "[Subtitulo incompatible con xbmc]" playWithSubt = "play" except: pass if ".mp4" in match2[1]: subtitle = "[MP4-Directo]" scrapedtitle = '%s (castellano) - %s %s' %(title,match2[0],subtitle) scrapedurl = match2[1].strip() scrapedthumbnail = thumbnail scrapedplot = plot if ("cast.xml" or "mirror.xml") not in match and sub == "": scrapedtitle = '%s (V.O.S) - %s %s %s' %(title,match2[0],subtitle,sub) try: if not match2[2].endswith("cine-adicto2.srt") and (sub == ""): scrapedurl = scrapedurl + "|" + match2[2] playWithSubt = "play2" except:pass if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") # A�ade al listado de XBMC xbmctools.addnewvideo( __channel__ , playWithSubt , category , "Directo" , scrapedtitle, scrapedurl , scrapedthumbnail, scrapedplot ) else: if match.endswith(".srt"): scrapedurl = scrapedurl + "|" + match xbmctools.addnewvideo( __channel__ ,"play2" , category , "Directo" , title + " (V.O.S) - "+subtitle, scrapedurl , thumbnail , plot ) if match.endswith(".xml"): sub = "[Subtitulo incompatible con xbmc]" xbmctools.addnewvideo( __channel__ ,"play" , category , "Directo" , title + " (V.O) - %s %s" %(subtitle,sub), scrapedurl , thumbnail , plot ) scrapedurl = match print scrapedurl ## --------------------------------------------------------------------------------------## # Busca enlaces de videos para el servidor vk.com # ## --------------------------------------------------------------------------------------## #http://vkontakte.ru/video_ext.php?oid=93103247&id=149051583&hash=793cde84b05681fa&hd=1 ''' patronvideos = '(http\:\/\/vk.+?\/video_ext\.php[^"]+)"' matches = re.compile(patronvideos,re.DOTALL).findall(data) if len(matches)>0: for match in matches: print " encontro VK.COM :%s" %match videourl = scrapertools.unescape(match) xbmctools.addnewvideo( __channel__ , "play" , category , "vk" , title + " - "+"[VK]", videourl , thumbnail , plot ) ''' # 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 searchvideos(params, url, category): logger.info("[programastv.py] parse") # ------------------------------------------------------ # Descarga la página # ------------------------------------------------------ data = scrapertools.cachePage(url) #logger.info(data) # ------------------------------------------------------ # Extrae las entradas # ------------------------------------------------------ #quitamos a partir de los comentarios data = data[0:data.index('class=\'post-footer\'>')] videos = servertools.findvideos(data) #xbmc.output( videos[0][2] + " es 02") #xbmc.output( videos[1][2] + " es 12") #TODO extract plot y thumbnail if len(videos) > 0: if (videos[0][2] == "Megavideo") and (videos[1][2] == "Megaupload"): xbmc.output("asumimos que solo hay un video con dos mirrors") patronvideos = 'class=\'post-title entry-title\'>.+?<a href=\'.+?\'>(.+?)</a>' matches = re.compile(patronvideos, re.DOTALL).findall(data) xbmc.output(matches[0]) xbmctools.addnewvideo(CHANNELNAME, "play", category, "Megavideo", matches[0], videos[0][1], "", "") xbmctools.addnewvideo(CHANNELNAME, "play", category, "Megaupload", matches[0], videos[1][1], "", "") elif len(videos) == 1: if re.search('&xtp=(.+?)_VIDEO', videos[0][1]): patronvideos = '&xtp=(.+?)_VIDEO' matches = re.compile(patronvideos, re.DOTALL).findall(data) videos[0][1] = matches[0] xbmc.output("aqui estamos") patronvideos = 'class=\'post-title entry-title\'>.+?<a href=\'.+?\'>(.+?)</a>' matches = re.compile(patronvideos, re.DOTALL).findall(data) xbmctools.addnewvideo(CHANNELNAME, "play", category, videos[0][2], matches[0], videos[0][1], "", "") else: xbmc.output("hay mas de 1 video") for video in videos: if video[2].find("youtube") != -1: continue #xbmc.output(video[2] + video[1] + " 2 + 1") indexvideo = data.index(video[1]) #xbmc.output(str(indexvideo)) #if (video[2]=="Megaupload"): # #xbmc.output(str(indexvideo)) # indexvideo=data.rindex(">-",0,indexvideo) # #xbmc.output(str(indexvideo)) indexvideo1 = data.rindex(">-", 0, indexvideo) #xbmc.output(str(indexvideo1)) indexvideo2 = data.rindex(">-", 0, indexvideo1) #xbmc.output(str(indexvideo2)) #xbmc.output(data[indexvideo2+1:indexvideo1]) nombre = re.sub('<.+?>', '', data[indexvideo2 + 3:indexvideo1 - 5]) while re.search('egaupl', nombre) or re.search( 'egavid', nombre): indexvideo3 = data.rindex(">-", 0, indexvideo2) nombre = re.sub('<.+?>', '', data[indexvideo3 + 3:indexvideo2 - 5]) indexvideo2 = indexvideo3 xbmctools.addnewvideo(CHANNELNAME, "play", category, video[2], nombre + " " + video[2], video[1], "", "") else: xbmc.output("es un listado") #xbmc.output(data) data = data[data.index('class=\'post-header-line-1\'') + 33:] #xbmc.output(data) xbmc.output("aqui llego") p = MyParser() p.feed(data) p.close() itemlist = [] for k, v in p.anchors.items(): print k, "=>", v if re.search('programastvonline.blogspot.com', v[0]): itemlist.append( Item(channel=CHANNELNAME, title=k, action="parsear", url=v[0], folder=True)) xbmctools.renderItems(itemlist, params, url, category) #'egaupl', nombre) #myparser=MyParser(data) #myparser.parse(data) #links = myparser.get_hyperlinks() # get the hyperlinks list #xbmc.output(str(len(links))) # print all the links #descriptions = myparser.get_descriptions() # get the hyperlinks list #xbmc.output("b",descriptions) # print all the links #xbmc.output("aqui llego 1") #post-header-line-1 #format = formatter.NullFormatter() # create default formatter #htmlparser = LinksExtractor(format) # create new parser object # for video in listavideos: # videotitle = video[0] # scrapedurl = video[1] # server = video[2] # xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , title.strip()+" "+match[1]+" "+match[2]+" "+videotitle , scrapedurl , thumbnail , plot ) # ------------------------------------------------------------------------------------ # Busca los enlaces a los videos # ------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------ # 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 listmirrors(params, url, category): logger.info("[programastv.py] listmirrors") title = urllib.unquote_plus(params.get("title")) thumbnail = urllib.unquote_plus(params.get("thumbnail")) #plot = unicode( xbmc.getInfoLabel( "ListItem.Plot" ), "utf-8" ) plot = urllib.unquote_plus(params.get("plot")) # ------------------------------------------------------------------------------------ # Descarga la página # ------------------------------------------------------------------------------------ data = scrapertools.cachePage(url) #logger.info(data) # ------------------------------------------------------------------------------------ # Busca el argumento # ------------------------------------------------------------------------------------ patronvideos = '<div class="ficha_des">(.*?)</div>' matches = re.compile(patronvideos, re.DOTALL).findall(data) if len(matches) > 0: plot = scrapertools.htmlclean(matches[0]) logger.info("plot actualizado en detalle") else: logger.info("plot no actualizado en detalle") # ------------------------------------------------------------------------------------ # Busca el thumbnail # ------------------------------------------------------------------------------------ patronvideos = '<div class="ficha_img pelicula_img">[^<]+' patronvideos += '<img src="([^"]+)"' matches = re.compile(patronvideos, re.DOTALL).findall(data) if len(matches) > 0: thumbnail = matches[0] logger.info("thumb actualizado en detalle") else: logger.info("thumb no actualizado en detalle") # ------------------------------------------------------------------------------------ # Busca los enlaces a los mirrors, o a los capítulos de las series... # ------------------------------------------------------------------------------------ # url = "http://www.programastv.es/inc/mostrar_contenido.php?sec=pelis_ficha&zona=online&id=video-4637" #patronvideos = '<div class="ver_des_peli iframe2">[^<]+' #patronvideos += '<ul class="tabs-nav" id="([^"]+)">' #matches = re.compile(patronvideos,re.DOTALL).findall(data) #data = scrapertools.cachePage("http://www.programastv.es/inc/mostrar_contenido.php?sec=pelis_ficha&zona=online&id="+matches[0]) ''' <div id="ficha_ver_peli"> <div class="v_online"> <h2>Ver online <span>El destino de Nunik</span></h2> <div class="opstions_pelicula_list"> <div class="tit_opts" style="cursor:pointer;" onclick="location.href='http://www.programastv.es/peliculas/drama/el-destino-de-nunik_espanol-dvd-rip-megavideo-6026.html'"> <p>Mirror 1: Megavideo</p> <p><span>CALIDAD: DVD-RIP | IDIOMA: ESPAÑOL</span></p> <p class="v_ico"><img src="http://caratulas.programastv.es/img/cont/megavideo.png" alt="Megavideo" /></p> </div> <div class="tit_opts" style="cursor:pointer;" onclick="location.href='http://www.programastv.es/peliculas/drama/el-destino-de-nunik_espanol-dvd-rip-megavideo-6027.html'"> <p>Mirror 2: Megavideo</p> <p><span>CALIDAD: DVD-RIP | IDIOMA: ESPAÑOL</span></p> <p class="v_ico"><img src="http://caratulas.programastv.es/img/cont/megavideo.png" alt="Megavideo" /></p> </div> </div> </div> </div> ''' ''' <div class="v_online"> <h2>Ver online <span>Cantajuego 6</span></h2> <div class="opstions_pelicula_list"><div class="tit_opts"><a href="/peliculas/animacion-e-infantil/cantajuego-6_espanol-dvd-rip-megavideo-73371.html"> <p>Mirror 1: Megavideo</p> <p><span>CALIDAD: DVD-RIP | IDIOMA: ESPAÑOL</span></p> <p class="v_ico"><img src="http://caratulas.programastv.es/img/cont/megavideo.png" alt="Megavideo" /></p> </a></div> </div> </div> </div><br/><div id="ficha_desc_peli"> <div class="v_online"> <h2 class="ico_fuego">Descargar <span>Cantajuego 6</span></h2> <div class="opstions_pelicula_list"><div class="tit_opts"><a href="/peliculas/animacion-e-infantil/descargar-cantajuego-6_espanol-dvd-rip-megaupload-73372.html" target="_blank"> <p>Mirror 1: Megaupload </p> <p><span>CALIDAD: DVD-RIP | IDIOMA: ESPAÑOL </span></p> <p class="v_ico"><img src="http://caratulas.programastv.es/img/cont/megaupload.png" alt="Megaupload" /></p> </a></div> </div> </div> </div> ''' #patronvideos = '<div class="tit_opts"><a href="([^"]+)">[^<]+' patronvideos = '<div class="tit_opts"><a href="([^"]+)".*?>[^<]+' patronvideos += '<p>([^<]+)</p>[^<]+' patronvideos += '<p><span>([^<]+)</span>' matches = re.compile(patronvideos, re.DOTALL).findall(data) for match in matches: logger.info("Encontrado iframe mirrors " + match[0]) # Lee el iframe mirror = urlparse.urljoin(url, match[0].replace(" ", "%20")) req = urllib2.Request(mirror) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) response = urllib2.urlopen(req) data = response.read() response.close() listavideos = servertools.findvideos(data) for video in listavideos: videotitle = video[0] scrapedurl = video[1] server = video[2] xbmctools.addnewvideo( CHANNELNAME, "play", category, server, title.strip() + " " + match[1] + " " + match[2] + " " + videotitle, scrapedurl, thumbnail, plot) # ------------------------------------------------------------------------------------ # Busca los enlaces a los videos # ------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------ # 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)