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&amp;view=article&amp;id=161:501-nuestro-cerebro-altruista&amp;catid=2:cermen&amp;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( CHANNELNAME , "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( CHANNELNAME , "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 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 detail(params,url,category):
    logger.info("[terrorygore.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=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 ddpostdetail(params,url,category):
    logger.info("[mcanime.py] ddpostdetail")

    title = urllib.unquote_plus( params.get("title") )
    thumbnail = urllib.unquote_plus( params.get("thumbnail") )
    plot = unicode( xbmc.getInfoLabel( "ListItem.Plot" ), "utf-8" )

    # Descarga la p·gina
    data = scrapertools.cachePage(url)
    #logger.info(data)

    # Foto de la serie de la enciclopedia
    patron = '<img src="([^"]+)" width="300".*?class="title_pic" />'
    matches = re.compile(patron,re.DOTALL).findall(data)
    if len(matches)>0:
        thumbnail = matches[0]
    
    # Argumento - texto del post
    patron = '<div id="download_detail">(.*?)</div>'
    matches = re.compile(patron,re.DOTALL).findall(data)
    if len(matches)>0:
        plot = scrapertools.htmlclean(matches[0])
        plot = plot.replace("\r\n"," ")
        plot = plot.replace("\r"," ")
        plot = plot.replace("\n"," ")
        plot = plot.strip()

    # ------------------------------------------------------------------------------------
    # Busca los enlaces a los videos
    # ------------------------------------------------------------------------------------
    listavideos = servertools.findvideos(data)

    i = 1

    for video in listavideos:
        try:
            fulltitle = unicode( title.strip() + " (%d) " + video[0], "utf-8" ).encode("iso-8859-1")
        except:
            fulltitle = title.strip() + " (%d) " + video[0]
        fulltitle = fulltitle % i
        i = i + 1
        videourl = video[1]
        server = video[2]
        #logger.info("videotitle="+urllib.quote_plus( videotitle ))
        #logger.info("plot="+urllib.quote_plus( plot ))
        #plot = ""
        #logger.info("title="+urllib.quote_plus( title ))

        xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , fulltitle , videourl , thumbnail , plot )
    # ------------------------------------------------------------------------------------

    # ------------------------------------------------------------------------------------
    # AÒade la opciÛn "AÒadir todos los vÌdeos a la lista de descarga"
    # ------------------------------------------------------------------------------------
    xbmctools.addnewvideo( CHANNELNAME , "addalltodownloadlist" , title , "" , "(AÒadir todos los vÌdeos a la lista de descarga)" , url , thumbnail , plot )
    
    # Cierra el directorio
    xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
    xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def detail(params,url,category):
    logger.info("[anifenix.py] detail")

    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( CHANNELNAME , "play" , category , server , title.strip() + " - " + videotitle , url , thumbnail , plot )
    # ------------------------------------------------------------------------------------

    # Cierra el directorio
    xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
    xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def detail(params,url,category):
    logger.info("[veranime.py] detail")

    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)

    patron  = '<div id="listacapdd"><div class="listddserie">[^<]+'
    patron += '<a title="[^"]+" href="([^"]+)"><strong>[^<]+</strong></a>[^<]+'
    patron += '</div>'
    matches = re.compile(patron,re.DOTALL).findall(data)
    if len(matches)>0:
        url = matches[0]
        data = scrapertools.cachePage(url)

    # ------------------------------------------------------------------------------------
    # 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( CHANNELNAME , "play" , category , server , title.strip() + " - " + videotitle , url , thumbnail , plot )
    # ------------------------------------------------------------------------------------

    # Asigna el título, desactiva la ordenación, y cierra el directorio
    xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
    xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def 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&amp;view=category&amp;layout=blog&amp;id=1&amp;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&amp;view=article&amp;id=65:473-farmacos-para-las-emociones&amp;catid=1:biosalud&amp;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( CHANNELNAME , "buscavideos" , category, matches1[i][1] , matches1[i][0] , "thumbnail" , "")
            xbmctools.addnewvideo( CHANNELNAME , "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 list(params,url,category):
    logger.info("[seriesyonkis.py] list")

    title = urllib.unquote_plus( params.get("title") )

    if params.has_key("Serie"):
        Serie = params.get("Serie")
    else:
        Serie = ""

    if params.has_key("thumbnail"):
        thumbnail = params.get("thumbnail")
    else:
        thumbnail = ""

    from core.item import Item

    item = Item(channel=CHANNELNAME, title=title , url=url , thumbnail=thumbnail )
    itemlist = getlist(item)
    
    # Añade "Agregar todos a la librería"
    xbmctools.addnewvideo( CHANNELNAME , "addlist2Library" , category , "Megavideo", "AÑADIR TODOS LOS EPISODIOS A LA BIBLIOTECA" , url , thumbnail , "" , Serie)

    for item in itemlist:
        xbmctools.addnewvideo(item.channel , item.action , category , "Megavideo" , item.title , item.url , item.thumbnail, item.plot , Serie)

    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("[descargapelis.py] detail")

    title = urllib.unquote_plus( params.get("title") )
    thumbnail = urllib.unquote_plus( params.get("thumbnail") )
    plot = ""

    # Descarga la página
    data = scrapertools.cachePage(url)
    #logger.info(data)

    patron = '<table width="100%" cellpadding="0" cellspacing="0">[^<]+?'
    patron +='<tr>[^<]+?<td align="center"><img src="(.+?)".+?'
    patron +='<td align="justify" valign="top" class="texto_peli"><b>Sinopsis de (.+?):</b>(.+?)<br />'
    matches = re.compile(patron,re.DOTALL).findall(data)
    if len(matches)>0:
        if DEBUG:
            scrapertools.printMatches(matches)
            #xbmc.output('test')

    listavideos = servertools.findvideos(data)
    thumbnail=matches[0][0]
    plot=matches[0][2]
    title=matches[0][1]
    for video in listavideos:
        xbmctools.addnewvideo( CHANNELNAME , "play" , CHANNELNAME , video[2] , title + " (" + video[2] + ")" , video[1] , thumbnail, plot )

    # Label (top-right)...
    xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
Пример #10
0
def videolist(params,url,category):
	xbmc.output("[berriatb.py] videolist")

	# Page downloading
	data = scrapertools.cachePage(url)
	#xbmc.output(data)
	
	# Get #Next url
	'''
<span class="gehiago"><a class="hurrengoa" href="http://berria.info/berriatb/esanahala/zerrenda/6/">Hurrengoak &raquo;</a></span>
	'''
	pattern = '<a class="hurrengoa" href="([^"]+)">Hurrengoak' # 0: url
	matches = re.compile(pattern,re.DOTALL).findall(data)
	
	try:
		urlnextpage = matches[0]
	except:
		urlnextpage = url
	
	if (DEBUG):
		xbmc.output("urlnextpage="+urlnextpage)
	
	# Add NEXT (as first item)
	xbmctools.addnewfolder( CHANNELCODE , "videolist" , CHANNELNAME , "#Hurrengoa" , urlnextpage , "" , "" )
	
	# Parse video list
	'''
<div class="garbitzailea"></div>
    <div class="bideotxikiak">
    <p><a href="http://berria.info/berriatb/esanahala/5/" title="" class="thickbox"><img src="http://208.79.203.90/berria/bideoak/bideoa653.jpg" width="158" alt="Aintzane Ezenarro" /></a></p>
    <p class="titularra"><a href="http://berria.info/berriatb/esanahala/5/" title="Aintzane Ezenarro">Aintzane Ezenarro</a></p>

	<div class="garbitzailea"></div>
    <p><span class="sinadura_data">2009-09-20</span></p>
  </div>
	'''
	pattern  = '<div class="bideotxikiak">.*?<p><a href="([^"]+)" title.*?'		# 0: url
	pattern += '<img src="([^"]+)".*?' 											# 1: thumbnail
	pattern += '<p class="titularra">.*?title="([^"]+)".*?'						# 2: title
	#pattern += 'sinadura_data">(.*?)<.*?'										# 3: date
	matches = re.compile(pattern,re.DOTALL).findall(data)
	scrapertools.printMatches(matches)

	for match in matches:
		#scrapedtitle = match[2].strip()+" ("+match[3]+")"
		scrapedtitle = match[2].replace("&#39;","'").strip()
		scrapedurl = match[0].replace("&amp;","&")
		scrapedthumbnail = match[1].replace("&amp;","&")
		scrapedplot = scrapedtitle # Same as title
		if (DEBUG): xbmc.output("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

		# Add item
		xbmctools.addnewvideo( CHANNELCODE , "play" , category , "Directo" , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot )
	
	# Label (top-right)...
	xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
	# Disable sorting...
	xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
	# End of directory...
	xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def lastepisodeslist(params,url,category):
    logger.info("[seriesyonkis.py] lastepisodeslist")

    # Descarga la página
    data = scrapertools.cachePage(url)
    #logger.info(data)

    # Extrae las entradas (carpetas)
    #<div class="ficha" style="background:url(http://images.seriesyonkis.com/images/house.jpg) #000000 center top no-repeat"><a href="http://www.seriesyonkis.com/capitulo/house/capitulo-01/44647/" title="(y 6x2) Broken">House - 6x01 - (y 6x2) Broken</a><br /><br /><img src="http://images.peliculasyonkis.com/images/tmegavideo.png" alt="Megavideo" style="vertical-align: middle;" /><img height="30" src="http://images.seriesyonkis.com/images/f/spanish.png" alt="Audio Español" title="Audio Español" style="vertical-align: middle;" /></div>
    #<div class="ficha" style="background:url(http://images.seriesyonkis.com/images/cinco-hermanos.jpg) #000000 center top no-repeat"><a href="http://www.seriesyonkis.com/capitulo/cinco-hermanos/capitulo-15/29162/" title="Capitulo 15">Cinco Hermanos - 3x15 - Capitulo 15</a><br /><br /><img src="http://images.peliculasyonkis.com/
    
    patronvideos  = '<div class="ficha" style="background:url\(([^\)]+)\)[^>]+><a.*?href="([^"]+)".*?>([^<]+)</a>(.*?)</div>'
    matches = re.compile(patronvideos,re.DOTALL).findall(data)
    scrapertools.printMatches(matches)

    for match in matches:
        # Titulo
        esp=eng=latino=vos= ""
        if "Audio Espa\xc3\xb1ol" in match[3]:
            esp = "(Esp)"
        if "Subt\xc3\xadtulos en Espa\xc3\xb1ol" in match[3]:
            vos = "(V.O.S)"
        if "Audio Latino" in match[3]:
            latino = "(Latino)"
        if "Audio Ingl\xc3\xa9s" in match[2]:
            eng = "(Eng)"            
        scrapedtitle = "%s    %s%s%s%s" %(match[2],esp,vos,eng,latino)
        
        scrapedtitle2 = match[2]

        # URL
        scrapedurl = match[1]
        
        # Thumbnail
        scrapedthumbnail = match[0]
        
        # procesa el resto
        scrapedplot = ""

        #Serie - Trata de extraerla del título (no hay carpeta de serie aquí)
        #Esto son pruebas "muy preliminares" esto puede dar problemas con series añadidas completas
        try:
            Serie = scrapedtitle2[:scrapedtitle2.find("- ")-1]
        except:
            logger.info ("[seriesyonkis.py] ERROR extrayendo y limpiando nombre de serie de:"+scrapedtitle)
            Serie = ""

        # Depuracion
        if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

        # Añade al listado de XBMC
        xbmctools.addnewvideo( CHANNELNAME , "detail" , category , "Megavideo" , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot ,Serie)

    # Label (top-right)...
    xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def list(params,url,category):
    logger.info("[megaupload.py] list")

    xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Megaupload" , "Ver el vídeo [Megaupload]" , url , "" , "" )

    # Asigna el título, desactiva la ordenación, y cierra el directorio
    xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
    xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def videos(params,url,category,itemlist):
	xbmc.output("[earthtv.py] videos")

	for item in itemlist:
		xbmctools.addnewvideo( CHANNELCODE , "play" , category , "Directo" , item.title , item.url , item.thumbnail , item.plot )

	# Cierra el directorio
	xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
	xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
	xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
Пример #14
0
def videos(params, url, category, itemlist):
    xbmc.output("[earthtv.py] videos")

    for item in itemlist:
        xbmctools.addnewvideo(CHANNELCODE, "play", category, "Directo",
                              item.title, item.url, item.thumbnail, item.plot)

    # Cierra el directorio
    xbmcplugin.setPluginCategory(handle=pluginhandle, category=category)
    xbmcplugin.addSortMethod(handle=pluginhandle,
                             sortMethod=xbmcplugin.SORT_METHOD_NONE)
    xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
def 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.com/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 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 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(
            CHANNELNAME, "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(
            CHANNELNAME, "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&amp;view=article&amp;id=41:500-por-que-mas-es-menos&amp;catid=6:tercol&amp;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( CHANNELNAME , "buscavideos" , category , "redestv",  matches[i][1] + " - " + matches[i][2], matches[i][0] , "thumbnail" , "")
            #xbmctools.addnewfolder( CHANNELNAME , "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 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 parseweb(params,url,category):
    logger.info("[gratisdocumentales.py] parseweb")

    # ------------------------------------------------------
    # Descarga la página
    # ------------------------------------------------------
    data = scrapertools.cachePage(url)
    #logger.info(data)

    patronvideos  = '<h2  class="posttitle"><a\s+href="(.+?)" rel="bookmark" title="Permanent Link to .*?">(.+?)</a>'

    #logger.info("web"+data)
    matches = re.compile(patronvideos,re.DOTALL).findall(data)
    if DEBUG:
        scrapertools.printMatches(matches)
    #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( CHANNELNAME , "play" , category , "Megavideo" , matches[i][1] , matches1[i][0] , "thumbnail" , matches1[i][1])

    patronvideos  = 'href=\'(.+?/page/[0-9]+?/.*?)\' class=\'.*?page\'>(\d+?)</a>'

    #logger.info("web"+data)
    matches = re.compile(patronvideos).findall(data)
    if DEBUG:
        scrapertools.printMatches(matches)
    if len(matches)>0:
        for i in range(len(matches)):
            xbmctools.addnewfolder( CHANNELNAME , "parseweb" , category, matches[i][1] , matches[i][0] , "" , "")
    #scrapertools.printMatches(matches)    

    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 listar(title,thumbnail,plot,matches,category):
    
    for match in matches:
        # Titulo
        
        scrapedtitle = title + match[0]
        # 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( CHANNELNAME , "play" , category , match[2], scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot )
def loadvideo(params,data,category,title,thumbnail,plot):
	# ----------------------------------------------------------
	# the loading of series with a lot of seasons is very slow
	# this system prevents freeze everytime in loading screen
	# ----------------------------------------------------------
	logger.info("[italiafilm.py] loadvideo")
	max_len = 3000
	if (len(title) > 50): title = title[:50]+"..."
	while (len(data) > max_len): 
		data_all = data
		data_trunc = data[:max_len].rfind('<a ')
		if(data_trunc <= 0):
			data = data = data_all[max_len:]
		else:
			data = data[:data_trunc]
			listavideos = servertools.findvideos(data)
			for video in listavideos:
				videotitle = video[0]
				url = video[1]
				server = video[2]
				patronvideos  = url+'[^>]+>([^<]+)'
				matches = re.compile(patronvideos,re.DOTALL).findall(data)
				scrapertools.printMatches(matches)
				if (matches): videotitle = matches[0]
				xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , title.strip() + " - " + videotitle + " ["+server+"]" , url , thumbnail , plot )
			data = data_all[data_trunc:]
	#end while
	listavideos = servertools.findvideos(data)
	for video in listavideos:
		videotitle = video[0]
		url = video[1]
		server = video[2]
		patronvideos  = url+'[^>]+>([^<]+)'
		matches = re.compile(patronvideos,re.DOTALL).findall(data)
		scrapertools.printMatches(matches)
		if (matches): videotitle = matches[0]
		xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , title.strip() + " - " + videotitle + " ["+server+"]" , url , thumbnail , plot )
def homedetail(params,url,category):
    logger.info("[mcanime.py] homedetail")

    title = urllib.unquote_plus( params.get("title") )
    thumbnail = urllib.unquote_plus( params.get("thumbnail") )
    plot = urllib.unquote_plus( params.get("plot") )
    extradata = urllib.unquote_plus( params.get("extradata") )

    # ------------------------------------------------------------------------------------
    # Busca los enlaces a los videos
    # ------------------------------------------------------------------------------------
    listavideos = servertools.findvideos(extradata)

    for video in listavideos:
        videotitle = video[0]
        url = video[1]
        server = video[2]
        xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , title.strip() + " - " + videotitle , url , thumbnail , plot )
    # ------------------------------------------------------------------------------------

    # Cierra el directorio
    xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def 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":
            xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title, matches[0] , thumbnail , plot )

        elif servidor == "Veoh":
            veohurl = servertools.findurl(matches[0],"veoh")
            logger.info(" veohurl = " +veohurl)

            if len(veohurl)>0:
                if  veohurl=="http://./default.asp":
                    advertencia = xbmcgui.Dialog()
                    resultado = advertencia.ok('El Video Documental' , title , 'no existe en Veoh','visite la pagina www.documaniatv.com para reportarlo' )
                    return
                logger.info(" newmatches = "+veohurl)
                xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title, veohurl , thumbnail , plot )
            else:
                 advertencia = xbmcgui.Dialog()
                 resultado = advertencia.ok('El Video Documental' , 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)
            data = scrapertools.cachePage(url)
            newpatron = '</script>.*?<a href="(.*?)" title="Click to Download">'
            newmatches = re.compile(newpatron,re.DOTALL).findall(data)
            if len(newmatches)>0:
                logger.info(" newmatches = "+newmatches[0])
                xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title, newmatches[0] , thumbnail , plot )
        
        elif servidor == "Stagevu":
            url= "http://stagevu.com/video/"+matches[0]
            url = servertools.findurl(url,servidor)
            
            logger.info(" url = "+url)
            videotitle = "Video en Stagevu"
            server = servidor
            xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title.strip().replace(server,"").replace("  "," ") + " - " + videotitle , url , thumbnail , plot )
Пример #25
0
def videolist(params, url, category):
    xbmc.output("[berriatb.py] videolist")

    # Page downloading
    data = scrapertools.cachePage(url)
    #xbmc.output(data)

    # Get #Next url
    '''
<span class="gehiago"><a class="hurrengoa" href="http://berria.info/berriatb/esanahala/zerrenda/6/">Hurrengoak &raquo;</a></span>
	'''
    pattern = '<a class="hurrengoa" href="([^"]+)">Hurrengoak'  # 0: url
    matches = re.compile(pattern, re.DOTALL).findall(data)

    try:
        urlnextpage = matches[0]
    except:
        urlnextpage = url

    if (DEBUG):
        xbmc.output("urlnextpage=" + urlnextpage)

    # Add NEXT (as first item)
    xbmctools.addnewfolder(CHANNELCODE, "videolist", CHANNELNAME, "#Hurrengoa",
                           urlnextpage, "", "")

    # Parse video list
    '''
<div class="garbitzailea"></div>
    <div class="bideotxikiak">
    <p><a href="http://berria.info/berriatb/esanahala/5/" title="" class="thickbox"><img src="http://208.79.203.90/berria/bideoak/bideoa653.jpg" width="158" alt="Aintzane Ezenarro" /></a></p>
    <p class="titularra"><a href="http://berria.info/berriatb/esanahala/5/" title="Aintzane Ezenarro">Aintzane Ezenarro</a></p>

	<div class="garbitzailea"></div>
    <p><span class="sinadura_data">2009-09-20</span></p>
  </div>
	'''
    pattern = '<div class="bideotxikiak">.*?<p><a href="([^"]+)" title.*?'  # 0: url
    pattern += '<img src="([^"]+)".*?'  # 1: thumbnail
    pattern += '<p class="titularra">.*?title="([^"]+)".*?'  # 2: title
    #pattern += 'sinadura_data">(.*?)<.*?'										# 3: date
    matches = re.compile(pattern, re.DOTALL).findall(data)
    scrapertools.printMatches(matches)

    for match in matches:
        #scrapedtitle = match[2].strip()+" ("+match[3]+")"
        scrapedtitle = match[2].replace("&#39;", "'").strip()
        scrapedurl = match[0].replace("&amp;", "&")
        scrapedthumbnail = match[1].replace("&amp;", "&")
        scrapedplot = scrapedtitle  # Same as title
        if (DEBUG):
            xbmc.output("title=[" + scrapedtitle + "], url=[" + scrapedurl +
                        "], thumbnail=[" + scrapedthumbnail + "]")

        # Add item
        xbmctools.addnewvideo(CHANNELCODE, "play", category, "Directo",
                              scrapedtitle, scrapedurl, scrapedthumbnail,
                              scrapedplot)

    # Label (top-right)...
    xbmcplugin.setPluginCategory(handle=int(sys.argv[1]), category=category)
    # Disable sorting...
    xbmcplugin.addSortMethod(handle=int(sys.argv[1]),
                             sortMethod=xbmcplugin.SORT_METHOD_NONE)
    # End of directory...
    xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
def capitulos(item):
    logger.info("[seriesdanko.py] capitulos")
    
    if config.get_setting("forceview")=="true":
        xbmc.executebuiltin("Container.SetViewMode(53)")  #53=icons
        #xbmc.executebuiltin("Container.Content(Movies)")
        
    if "|" in item.url:
        url = item.url.split("|")[0]
        sw = True
    else:
        url = item.url
        sw = False
    # Descarga la página
    if item.extra:
        
        contenidos = item.extra
        #print contenidos
    else:
        data = scrapertools.downloadpageWithoutCookies(url)

    # Extrae las entradas
        if sw:
            try:
                datadict = eval( "(" + data + ")" )    
                data = urllib.unquote_plus(datadict["feed"]["entry"][0]["content"]["$t"].replace("\\u00","%"))
                #data = urllib.unquote_plus(data.replace("\u00","%")).replace('\\"','"')
                #patronvideos  = "content(.*?)post-footer"
                matches=[]
                matches.append(data)
            except:
                matches = []
        else:
            patronvideos = "entry-content(.*?)</div>"
            matches = re.compile(patronvideos,re.DOTALL).findall(data)
            
        if len(matches)>0:
            contenidos = matches[0]
        else:
            contenidos = item.url
            if sw:
                url = item.url.split("|")[1]
                # Descarga la página
                data = scrapertools.downloadpageGzip(url)
                patronvideos  = "entry-content(.*?)<div class='post-footer'>"
                matches = re.compile(patronvideos,re.DOTALL).findall(data)
                if len(matches)>0:
                    contenidos = matches[0]
                
    patronvideos  = '<a href="([^"]+)">([^<]+)</a>.*?src="([^"]+)"'
    matches = re.compile(patronvideos,re.DOTALL).findall(contenidos.replace("'",'"'))
    #print contenidos        
    try:
        plot = re.compile(r'(Informac.*?/>)</div>').findall(contenidos)[0]
        if len(plot)==0:
            plot = re.compile(r"(Informac.*?both;'>)</div>").findall(contenidos)[0]
        plot = re.sub('<[^>]+>'," ",plot)
    except:
        plot = ""

    itemlist = []
    for match in matches:
        scrapedtitle = match[1]
        if "es.png" in match[2]:
            subtitle = " (Español)"
        elif "la.png" in match[2]:
            subtitle = " (Latino)"
        elif "vo.png" in match[2]:
            subtitle = " (Version Original)"
        elif "vos.png" in match[2]:
            subtitle = " (Subtitulado)"
        else:
            subtitle = ""
        scrapedplot = plot
        scrapedurl = urlparse.urljoin(item.url,match[0])
        if not item.thumbnail:
            try:
                scrapedthumbnail = re.compile(r'src="(.+?)"').findall(contenidos)[0]
            except:
                scrapedthumbnail = ""
        else:
            scrapedthumbnail = item.thumbnail
        if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

        # Añade al listado de XBMC
        itemlist.append( Item(channel=CHANNELNAME, action="findvideos", title=scrapedtitle+subtitle , url=scrapedurl , thumbnail=scrapedthumbnail , plot=scrapedplot , folder=True) )
    
    #xbmc.executebuiltin("Container.Content(Movies)")
    
    
    if len(itemlist)==0:
        listvideos = servertools.findvideos(contenidos)
        
        for title,url,server in listvideos:
            
            if server == "youtube":
                scrapedthumbnail = "http://i.ytimg.com/vi/" + url + "/0.jpg"
            else:
                scrapedthumbnail = item.thumbnail
            scrapedtitle = title
            scrapedplot = ""
            scrapedurl = url
            
            if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

            # Añade al listado de XBMC
            xbmctools.addnewvideo( CHANNELNAME , "play" , "" , server , item.title +" "+ scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot )
                
    return itemlist
def forumdetail(params,url,category):
    logger.info("[mcanime.py] forumdetail")

    # Descarga la p·gina
    data = scrapertools.cachePage(url)
    #logger.info(data)

    # ------------------------------------------------------------------------------------
    # Busca los enlaces a los mirrors, paginas, o capÌtulos de las series...
    # ------------------------------------------------------------------------------------
    patronvideos  = '([^"]+)" class="next">Siguiente'
    matches = re.compile(patronvideos,re.DOTALL).findall(data)
    for match in matches:
        logger.info("Encontrada pagina siguiente")
        xbmctools.addnewfolder( CHANNELNAME , "list" , category , "Pagina siguiente" ,urlparse.urljoin(url,match).replace("&amp;","&"),"","")

    # ------------------------------------------------------------------------------------
    # Busca los enlaces a los videos
    # ------------------------------------------------------------------------------------
    # Saca el cuerpo del post
    #logFile.info("data="+data)
    #patronvideos  = '<div class="content">.*?<div class="poster">.*?</div>(.*?)</div>'
    patronvideos  = '<div class="content">(.*?)<div class="content">'
    matches = re.compile(patronvideos,re.DOTALL).findall(data)
    datapost=""
    if len(matches)>0:
        datapost=matches[0]
    else:
        datapost = ""
    #logFile.info("dataPost="+dataPost)

    # Saca el thumbnail
    patronvideos  = '<img src="([^"]+)"'
    matches = re.compile(patronvideos,re.DOTALL).findall(datapost)
    thumbnailurl=""
    logger.info("thumbnails")
    for match in matches:
        logger.info(match)
    if len(matches)>0:
        thumbnailurl=matches[0]

    patronvideos  = '<img.*?>(.*?)<a'
    matches = re.compile(patronvideos,re.DOTALL).findall(datapost)
    descripcion = ""
    if len(matches)>0:
        descripcion = matches[0]
        descripcion = descripcion.replace("<br />","")
        descripcion = descripcion.replace("<br/>","")
        descripcion = descripcion.replace("\r","")
        descripcion = descripcion.replace("\n"," ")
        descripcion = re.sub("<[^>]+>"," ",descripcion)
    logger.info("descripcion="+descripcion)
    
    listavideos = servertools.findvideos(datapost)
    
    for video in listavideos:
        titulo = descripcion = re.sub("<[^>]+>","",video[0])
        url = video[1]
        thumbnail = thumbnailurl
        plot = descripcion
        server = video[2]
        xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , titulo , url , thumbnail , plot )

    # ------------------------------------------------------------------------------------

    # Cierra el directorio
    xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
Пример #28
0
def videolist(params, url, category):
    xbmc.output("[plus.py] videolist")

    # --------------------------------------------------------
    # Descarga la página
    # --------------------------------------------------------
    data = scrapertools.cachePage(url)
    #xbmc.output(data)

    # --------------------------------------------------------
    # Extrae los vídeos de la página
    # --------------------------------------------------------
    '''
	<li class="video estirar">
	<div class="imagen">
		<a title="Estrellas de Canal+: Heath Ledger" href="index.html?idlist=PLTVCN&amp;idvid=537147&amp;pos=3">
			<img alt="" src="http://www.plus.es/plustv/images/fotogramas/plustv/PO805296.jpg">
			<span>Play</span>
		</a>
	</div>
	<div class="tooltip" title="Programa que repasa la trayectoria de las caras más conocidas del cine.">
		<div class="textos">

			<p class="titulo"><a href="index.html?idlist=PLTVCN&amp;idvid=537147&amp;pos=3">Estrellas de Canal+: Heath Ledger</a></p>
		</div>
		<a class="addmiplustv show" href="miplustv.html?id=537147&amp;action=add" rel="nofollow">Añadir a Mi PLUSTV</a>
		<span>Añadido a Mi PlusTV</span>
	</div>
	</li>
	'''
    patron = '<li class="video estirar">[^<]+'
    patron += '<div class="imagen">[^<]+'
    patron += '<a title="([^"]+)" href="([^"]+)">[^<]+'
    patron += '<img alt="[^"]*" src="([^"]+)">.*?'
    patron += '<div class="tooltip" title="([^"]+)"'
    matches = re.compile(patron, re.DOTALL).findall(data)
    if DEBUG: scrapertools.printMatches(matches)

    for match in matches:
        # Datos
        scrapedtitle = match[0]
        scrapedurl = urlparse.urljoin(url, match[1])
        scrapedthumbnail = urlparse.urljoin(url, match[2])
        scrapedplot = match[3]
        if (DEBUG):
            xbmc.output("title=[" + scrapedtitle + "], url=[" + scrapedurl +
                        "], thumbnail=[" + scrapedthumbnail + "]")

        # Añade al listado de XBMC
        #addvideo( scrapedtitle , scrapedurl , category )
        xbmctools.addnewvideo(CHANNELCODE, "play", CHANNELNAME, "",
                              scrapedtitle, scrapedurl, scrapedthumbnail,
                              scrapedplot)

    # --------------------------------------------------------
    # Extrae el enlace a la siguiente página
    # --------------------------------------------------------
    patron = '<li class="siguiente"><a href="([^"]+)">siguiente \&gt\;</a></li>'
    matches = re.compile(patron, re.DOTALL).findall(data)
    if DEBUG: scrapertools.printMatches(matches)

    for match in matches:
        # Datos
        scrapedtitle = "Página siguiente"
        scrapedurl = "http://www.plus.es/plustv/emisiones.html" + match
        scrapedthumbnail = ""
        scrapedplot = ""
        if (DEBUG):
            xbmc.output("title=[" + scrapedtitle + "], url=[" + scrapedurl +
                        "], thumbnail=[" + scrapedthumbnail + "]")

        # Añade al listado de XBMC
        #addvideo( scrapedtitle , scrapedurl , category )
        xbmctools.addnewfolder(CHANNELCODE, "videolist", CHANNELNAME,
                               scrapedtitle, scrapedurl, scrapedthumbnail,
                               scrapedplot)

    # Label (top-right)...
    xbmcplugin.setPluginCategory(handle=pluginhandle, category=category)

    # Disable sorting...
    xbmcplugin.addSortMethod(handle=pluginhandle,
                             sortMethod=xbmcplugin.SORT_METHOD_NONE)

    # End of directory...
    xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
def ListarVideos(params,url,category):
    url1 = "http://www.series21.com"
    url1 = urlparse.urljoin(url1,url)
    title = urllib.unquote_plus(params.get("title"))
    thumbnail = urllib.unquote_plus(params.get("thumbnail"))
    plot = urllib.unquote_plus(params.get("plot"))            
    data = scrapertools.cachePage(url1)
    # Busca el area donde estan los videos y la descripcion
    patronvideos = '<div id="content">(.*?)<!-- FIN #content-->'
    matches      = re.compile(patronvideos,re.DOTALL).findall(data)
    matchesBK = matches[0]


    # Extrae las entradas (videos) para megavideo
    patronvideos  = '<span  style="font-size:12px;"><strong>(.*?)</strong></span><br/>.*?'
    patronvideos += '<span.*?>.*?<a href="http\:\/\/www.megavideo.com\/([\?v=|v/|\?d=]+)([A-Z0-9]{8}).*?" target'
    
    matches = re.compile(patronvideos,re.DOTALL).findall(matches[0])
    scrapertools.printMatches(matches)
    encontrados = set()
    for match in matches:
        if match[2] not in encontrados:
            encontrados.add(match[2])
            if 'v' in match[1]:
                server = "Megavideo"
            else:
                server = "Megaupload"
            doblaje = scrapertools.entityunescape(match[0])
            # Titulo
            scrapedtitle = title + " -   [" +doblaje+ "]" + " ("+server+")"
            # URL
            scrapedurl = match[2]
            # Thumbnail
            scrapedthumbnail = thumbnail
            # Argumento
            #print 'este es el plot %s ' %plot
            #print ' doblaje %s ' %doblaje
            scrapedplot = plot
            if ("Español" in plot) and not (doblaje in plot):
                scrapedplot = scrapedplot.replace("Español",doblaje)
            elif "subtitulado" in plot and not (doblaje in plot):
                scrapedplot = scrapedplot.replace("Versión original (subtitulado)",doblaje)
            elif not doblaje in plot:
                scrapedplot += "\n" + "Doblaje : " + doblaje
            
            # Depuracion
            if (DEBUG):
                logger.info("scrapedtitle="+scrapedtitle)
                logger.info("scrapedurl="+scrapedurl)
                logger.info("scrapedthumbnail="+scrapedthumbnail)

            # Añade al listado de XBMC
            xbmctools.addnewvideo( CHANNELNAME , "play" , category ,server, scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot )
    if len(matches)==0:
        listavideos = servertools.findvideos(data)
        encontrados = set()
        for titulo,scrapedurl,servidor in listavideos:
            if scrapedurl.strip() not in encontrados:
                encontrados.add(scrapedurl.strip())
                xbmctools.addnewvideo( CHANNELNAME , "play" , category ,servidor, title+ " - %s" %titulo , scrapedurl , thumbnail, plot )
    patronvideos = '<span class="bloque-doblaje">(.+?)</span>[^<]+'
    patronvideos +='<span class="bloque-link">[^<]+<a href="javascript\:goTo\(\'([^\']+)\'\, \'([^\']+)\'\)"(.+?)</span>'
    #patronvideos +='(?:\| <a href="javascript\:goTo\(\'([^\']+)\'\, \'([^\']+)\'\)".*?)</span>'
    matches = re.compile(patronvideos,re.DOTALL).findall(data)
    scrapertools.printMatches(matches)
    for match in matches:
    
        # URL
        if "megavideo" in match[2]:
            server = "Megavideo"
        elif "megaupload" in match[2]:
            server = "Megaupload"
        if "esp.gif" in match[0]:
            doblaje = "Español"
            
        else:
            doblaje = match[0].strip()            
        base64 = decrypt21.Base64()
        try:
            url2 = re.compile("javascript\:goTo\(\'([^\']+)\'\, \'([^\']+)\'\)").findall(match[3])[0]
            scrapedurl2 = base64._extract_code(base64.decode(url2[0]))
            scrapedurl = base64._extract_code(base64.decode(match[1]))
            part1 = " Parte 1 "
            part2 = " Parte 2 "
            scrapedtitle2 = title + part2+ " -   [" +doblaje+ "]" + " ("+server+")"
            #print match[3]
        except:
            scrapedurl = base64._extract_code(base64.decode(match[1]))
            part1 = ""
            part2 = ""            
            
        

        scrapedtitle = title + part1+ " -   [" +doblaje+ "]" + " ("+server+")"


        # Thumbnail
        scrapedthumbnail = thumbnail
        # Argumento
        scrapedplot = plot

        # Depuracion
        if (DEBUG):
            logger.info("scrapedtitle="+scrapedtitle)
            logger.info("scrapedurl="+scrapedurl)
            logger.info("scrapedthumbnail="+scrapedthumbnail)

        # Añade al listado de XBMC
        xbmctools.addnewvideo( CHANNELNAME , "play" , category ,server, scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot )
        if part2:
            xbmctools.addnewvideo( CHANNELNAME , "play" , category ,server, scrapedtitle2 , scrapedurl2 , scrapedthumbnail, scrapedplot )
    
    
    # Extrae las entradas (videos) directos
    patronvideos = 'flashvars="file=([^\&]+)\&amp;controlbar=over'
    matches = re.compile(patronvideos,re.DOTALL).findall(data)
    scrapertools.printMatches(matches)
    if len(matches)>0:
        
        data1 = scrapertools.cachePage(matches[0])
        #logger.info(data)
        patron = 'author">(.*?)</media:credit>.*?<media\:content url="([^"]+)"'
        matches = re.compile(patron,re.DOTALL).findall(data1)
        scrapertools.printMatches(matches)
        
        for match in matches:
            # Añade al listado de XBMC
            xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title +" -  ["+match[0]+"]"+ " (Directo)" , match[1] , thumbnail , plot )
    # Busca el Spoiler 
    patronvideos = '(http://www.youtube.com[^"]+)"'
    matchSpoiler = re.compile(patronvideos,re.DOTALL).findall(data)
    if len(matchSpoiler)>0:
        encontrados = set()
        for match in matchSpoiler:
            if match not in encontrados:
                encontrados.add(match)
                # Añade al listado de XBMC
                xbmctools.addnewvideo( CHANNELNAME , "youtubeplay" , category ,"Directo", "Ver El Spoiler de : "+title , match , thumbnail, "Ver Video Spoiler" )
            

        
    # Lista series relacionadas
    titulo = "Ver otros capitulos de esta temporada" 
    matches = buscarelacionados(matchesBK)
    plot2 = "CAPITULOS DE ESTA TEMPORADA :\n\n"
    for match in matches:
        plot2 = plot2 + "-"+match[2]+"\n"
    xbmctools.addnewfolderextra( CHANNELNAME , "listarelacionados" , category , titulo , url , thumbnail, plot2,matchesBK )
    #<div class="film"><a href="/house/#t_57"><img src="/thumbs/temporadas/95/120/57.jpg"
    # Cambiar de Temporada
    patron = 'div class="film"><a href="([^"]+)"><img src="([^"]+)" style'
    matchSerie= re.compile(patron,re.DOTALL).findall(matchesBK)
    if len(matchSerie)>1:
        for temp in matchSerie:
            url2      = urlparse.urljoin(url1,temp[0])
            thumbnail = urlparse.urljoin(url1,temp[1])
            titulo = "Cambiar a otras temporadas"
            titulo_serie = temp[0].split("/")
            titulo2 = titulo_serie[1].replace("-"," ")
            #print ' titulo%s ' %titulo2
            xbmctools.addnewfolderextra( CHANNELNAME , "listarTemporada" , category , titulo , url2 , thumbnail, plot,titulo2 )
            break    
        
    # Label (top-right)...
    xbmcplugin.setContent(int( sys.argv[ 1 ] ),"movies")
    xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
    xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def 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 &gt;&gt;</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("&quot;","'")
        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("[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( CHANNELNAME , "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("&amp;","&")
            xbmctools.addnewvideo( CHANNELNAME ,"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("&amp;","&")
            xbmctools.addnewvideo( CHANNELNAME ,"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( CHANNELNAME , playWithSubt , category , "Directo" , scrapedtitle, scrapedurl , scrapedthumbnail, scrapedplot )
                    ok = True
            else:
                if match.endswith(".srt"):
                    scrapedurl = scrapedurl + "|" + match 
                    xbmctools.addnewvideo( CHANNELNAME ,"play2"  , category , "Directo" , title + " (V.O.S) - "+subtitle, scrapedurl , thumbnail , plot )
                    ok = True
                if     match.endswith(".xml"):
                    sub = "[Subtitulo incompatible con xbmc]"
                    xbmctools.addnewvideo( CHANNELNAME ,"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( CHANNELNAME , 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()
            xbmctools.addnewvideo( CHANNELNAME , "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("&amp;","&")
            xbmctools.addnewvideo( CHANNELNAME ,"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( CHANNELNAME ,"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( CHANNELNAME , "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( CHANNELNAME , 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( CHANNELNAME , 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 listmirrors(params,url,category):
    logger.info("[redestv.py] detail")
 
    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])
 
    # ------------------------------------------------------------------------------------
    # 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]
 
    # ------------------------------------------------------------------------------------
    # Busca los enlaces a los mirrors, o a los capítulos de las series...
    # ------------------------------------------------------------------------------------
    #    url = "http://www.redestv.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)
 
    '''
    <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.redestv.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&Ntilde;OL</span></p>
    <p class="v_ico"><img src="http://caratulas.redestv.es/img/cont/megavideo.png" alt="Megavideo" /></p>
    </div>
    <div class="tit_opts" style="cursor:pointer;" onclick="location.href='http://www.redestv.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&Ntilde;OL</span></p>
    <p class="v_ico"><img src="http://caratulas.redestv.es/img/cont/megavideo.png" alt="Megavideo" /></p>
    </div>
    </div>
    </div>
    </div> 
    '''
    data = scrapertools.cachePage("http://www.redestv.es/inc/mostrar_contenido.php?sec=pelis_ficha&zona=online&id="+matches[0])
    patronvideos  = '<div class="tit_opts" style="cursor:pointer;" onclick="location.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 )
Пример #33
0
def videolist(params,url,category):
	xbmc.output("[plus.py] videolist")

	# --------------------------------------------------------
	# Descarga la página
	# --------------------------------------------------------
	data = scrapertools.cachePage(url)
	#xbmc.output(data)

	# --------------------------------------------------------
	# Extrae los vídeos de la página
	# --------------------------------------------------------
	'''
	<li class="video estirar">
	<div class="imagen">
		<a title="Estrellas de Canal+: Heath Ledger" href="index.html?idlist=PLTVCN&amp;idvid=537147&amp;pos=3">
			<img alt="" src="http://www.plus.es/plustv/images/fotogramas/plustv/PO805296.jpg">
			<span>Play</span>
		</a>
	</div>
	<div class="tooltip" title="Programa que repasa la trayectoria de las caras más conocidas del cine.">
		<div class="textos">

			<p class="titulo"><a href="index.html?idlist=PLTVCN&amp;idvid=537147&amp;pos=3">Estrellas de Canal+: Heath Ledger</a></p>
		</div>
		<a class="addmiplustv show" href="miplustv.html?id=537147&amp;action=add" rel="nofollow">Añadir a Mi PLUSTV</a>
		<span>Añadido a Mi PlusTV</span>
	</div>
	</li>
	'''
	patron  = '<li class="video estirar">[^<]+'
	patron += '<div class="imagen">[^<]+'
	patron += '<a title="([^"]+)" href="([^"]+)">[^<]+'
	patron += '<img alt="[^"]*" src="([^"]+)">.*?'
	patron += '<div class="tooltip" title="([^"]+)"'
	matches = re.compile(patron,re.DOTALL).findall(data)
	if DEBUG: scrapertools.printMatches(matches)

	for match in matches:
		# Datos
		scrapedtitle = match[0]
		scrapedurl = urlparse.urljoin( url , match[1] )
		scrapedthumbnail = urlparse.urljoin( url , match[2] )
		scrapedplot = match[3]
		if (DEBUG): xbmc.output("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

		# Añade al listado de XBMC
		#addvideo( scrapedtitle , scrapedurl , category )
		xbmctools.addnewvideo( CHANNELCODE , "play" , CHANNELNAME , "" , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot )

	# --------------------------------------------------------
	# Extrae el enlace a la siguiente página
	# --------------------------------------------------------
	patron = '<li class="siguiente"><a href="([^"]+)">siguiente \&gt\;</a></li>'
	matches = re.compile(patron,re.DOTALL).findall(data)
	if DEBUG: scrapertools.printMatches(matches)

	for match in matches:
		# Datos
		scrapedtitle = "Página siguiente"
		scrapedurl = "http://www.plus.es/plustv/emisiones.html"+match
		scrapedthumbnail = ""
		scrapedplot = ""
		if (DEBUG): xbmc.output("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

		# Añade al listado de XBMC
		#addvideo( scrapedtitle , scrapedurl , category )
		xbmctools.addnewfolder( CHANNELCODE , "videolist" , CHANNELNAME , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot )

	# Label (top-right)...
	xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )

	# Disable sorting...
	xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )

	# End of directory...
	xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )