コード例 #1
0
ファイル: livetv.py プロジェクト: Jmlaguna89/miNuevoRepo
def scraper(item):
    logger.info("pelisalacarta.livetv scraper")
    
    itemlist = []
    
    # Descarga la página
    
    data = dhe( scrapertools.cachePage(item.url) )
    
    
    patron_bloque = '<table align="center" width="90%"></tr><tr><td colspan=4 height=48>(.*?)Archivo de transmisiones'
    matchesenlaces = re.compile(patron_bloque,re.DOTALL).findall(data)
    for pepe in matchesenlaces:
        patron = '<td width=34 align="center" valign="top">.*?src="([^"]+)".*?<a class.*?href="([^"]+)">(.*?)</a>.*?<span class="evdesc">(.*?)<br>(.*?)</span>'
        matches = re.compile(patron,re.DOTALL).findall(pepe)

        for thumbnail , ficha, title, fecha, info in matches:
            fecha = fecha.strip()
            info = info.strip()
            title = title.replace("&ndash;","___")
            fecha = deporte ="[COLOR gold][B]"+fecha+"[/B][/COLOR]"
            info = deporte ="[COLOR orange][B]"+info+"[/B][/COLOR]"
            if  item.extra =="http://s6.postimg.org/a2qtepkep/fotbal.jpg" :
               title ="[COLOR palegreen][B]"+title+"[/B][/COLOR]"
               extra = "futbol"
            else:
               title ="[COLOR skyblue][B]"+title+"[/B][/COLOR]"
               extra = "live"
            encuentro = fecha+ "--"+title +"--"+ info
            
            

            itemlist.append( Item(channel=__channel__, title=encuentro,action="enlaces",url = urlparse.urljoin(host,ficha),thumbnail= thumbnail,fanart=item.extra,extra=extra,fulltitile = title,folder=True) )
    return itemlist
コード例 #2
0
ファイル: livetv.py プロジェクト: Jmlaguna89/miNuevoRepo
def mainlist(item):
    logger.info("pelisalacarta.livetv mainlist")
    itemlist = []
    
    
    xbmc.executebuiltin('xbmc.PlayMedia('+song+')')
    
    
    #Live
    item.url = "http://livetv.sx/es/allupcomingsports"
    itemlist.append( Item(channel=__channel__, title="[COLOR red][B]LIVE!![/B][/COLOR]" , action="scraper_live", url=host, thumbnail="http://s6.postimg.org/brzwms041/LIVE.png", fanart="http://s6.postimg.org/lqkv999jl/321238_1024x768_www_The_Wallpapers_org.jpg"))
    
    # Main options
    item.url = "http://livetv.sx/es/allupcomingsports"
    data = dhe( scrapertools.cachePage(item.url) )
    patronmain ='<table width="100%" cellpadding=12 cellspacing=0>(.*?)<span class="sltitle">'
    matchesmain = re.compile(patronmain,re.DOTALL).findall(data)
    
    for main in matchesmain:
    
        patron = '<td background.*?href="([^"]+)".*?src="([^"]+)".*?<a class="main".*?><b>(.*?)</b></a>'
        matches = re.compile(patron,re.DOTALL).findall(main)
        for url,thumbnail,deporte in matches:
            if deporte== "Fútbol":
                extra = "http://s6.postimg.org/a2qtepkep/fotbal.jpg"
                deporte ="[COLOR palegreen][B]"+deporte+"[/B][/COLOR]"
            else:
                extra= "http://s6.postimg.org/fs71z0qkx/B9317206944_Z_1_20150503001849_000_GNEAM3_I82_1_0.jpg"
                deporte ="[COLOR skyblue][B]"+deporte+"[/B][/COLOR]"
            itemlist.append( Item(channel=__channel__, title=deporte,action="scraper",url = urlparse.urljoin(host,url),thumbnail= thumbnail,fanart="http://s6.postimg.org/lqkv999jl/321238_1024x768_www_The_Wallpapers_org.jpg",extra=extra,folder=True) )
        

    
    
    return itemlist
コード例 #3
0
ファイル: livetv.py プロジェクト: Jmlaguna89/miNuevoRepo
def scraper_live(item):
    logger.info("pelisalacarta.livetv scraper")
    
    itemlist = []
    
    # Descarga la página
    
    data = dhe( scrapertools.cachePage(item.url) )
    
    
    patron_bloque = '<span class="date">Hoy.*?</span>(.*?)ensenar todo'
    matchesenlaces = re.compile(patron_bloque,re.DOTALL).findall(data)
    for pepe in matchesenlaces:
        patron = 'alt.*?src="([^"]+)".*?href="([^"]+)">([^"]+)</a>.*?<span class="evdesc">(\d+:\d+) \(([^"]+)\)'
        matches = re.compile(patron,re.DOTALL).findall(pepe)
        
        for thumbnail, url,title, hora, info in matches:
            info = info.strip()
            hora = hora.strip()
            info = "("+info+")"
            title = title.replace("&ndash;","___")
            hora = "[COLOR yellow][B]"+hora+"[/B][/COLOR]"
            info = "[COLOR orange][B]"+info+"[/B][/COLOR]"
            title ="[COLOR red][B]"+title+"[/B][/COLOR]"
            encuentro = hora +"--"+title +" "+ info
            
            
            
            itemlist.append( Item(channel=__channel__, title=encuentro,action="enlaces",url = urlparse.urljoin(host,url),thumbnail= thumbnail,extra="live",fulltitle= title,fanart= "http://s6.postimg.org/fs71z0qkx/B9317206944_Z_1_20150503001849_000_GNEAM3_I82_1_0.jpg",folder=True) )
    return itemlist
コード例 #4
0
ファイル: livetv.py プロジェクト: Jmlaguna89/miNuevoRepo
def enlaces(item):
    logger.info("pelisalacarta.livetv enlaces")
    xbmc.executebuiltin( "Container.Update" )
    if not xbmc.Player().isPlaying():
        xbmc.sleep(20)
        xbmc.executebuiltin('xbmc.PlayMedia('+song+')')
    
    itemlist = []
    data = dhe( scrapertools.cachePage(item.url) )
    data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
    if "<i id=\"whelint\" style=\"line-height: 150%;\">" in data:
        
        if item.extra =="futbol":
           fanart = "http://s6.postimg.org/56n6n0k9d/Wembley.jpg"
        else:
           fanart ="http://s6.postimg.org/naq77nhxt/Sport_Wallpaper_HD_3000x2250.jpg"
        itemlist.append( Item(channel=__channel__, title="[COLOR orangered][B]Las referencias de la transmisión van a ser publicadas no más tarde de media hora de su principio[/B][/COLOR]",thumbnail="http://s6.postimg.org/p3t3vz34h/Panasonic_AJ_HDX900.png",fanart= fanart,folder=False) )
    else:
        if '<span class="lnkt">AceStream Links</span>' in data:
            patronacestream = '<span class="lnkt">AceStream Links</span>(.*?)<a name="comments"></a>'
            matchesacestream = re.compile(patronacestream,re.DOTALL).findall(data)
         
            for bloque_acestream in matchesacestream:
                patron ='<td width=16><img title.*?src="([^"]+)"></a></td>.*?<a href="(acestream:.*?)"'
                matches= re.compile(patron,re.DOTALL).findall(bloque_acestream)
                for idioma, url in matches:
                    #if velocidad == "":
                    #  velocidad = "S/N"
                    
                    itemlist.append( Item(channel=__channel__, title="[COLOR yellow][B]Enlaces Acestream[/B][/COLOR]",action="play",url = url,thumbnail = idioma,fanart ="http://s6.postimg.org/e5hudsej5/Nou_Camp_Stadium_Barcelona_Football_Wallpapers_H.jpg",fulltitle= item.fulltitle,folder=False) )
        else:
             itemlist.append( Item(channel=__channel__, title="[COLOR yellow][B]No hay elaces Acetream[/B][/COLOR]",thumbnail = "http://s6.postimg.org/c2c0jv441/torrent_stream_logo_300x262.png",fanart="http://s6.postimg.org/ttnmybjip/5499731408_42e3876093_b.jpg",folder=False) )
        #Enlaces Sopcast
        if "<span class=\"lnkt\">SopCast Links" in data:
            
            patronsopcast = '<span class="lnkt">SopCast Links</span>(.*?)<a name="comments"></a>'
            matchessopcast = re.compile(patronsopcast,re.DOTALL).findall(data)

            for bloque_sopcast in matchessopcast:
                patron ='<td width=16><img title.*?src="([^"]+)".*?title=.*?>([^<]+)</td>.*?<a href="(sop:.*?)"'
                matches= re.compile(patron,re.DOTALL).findall(bloque_sopcast)
                for idioma,bibrate,url in matches:
                    
                    title = "[COLOR aquamarine][B]Enlace Sopcast[/B][/COLOR]"+" ("+"[COLOR green][B]"+bibrate+"[/B][/COLOR]"+")"
                    itemlist.append( Item(channel=__channel__, title=title,action="play",url = url,thumbnail =idioma,fanart="http://s6.postimg.org/e5hudsej5/Nou_Camp_Stadium_Barcelona_Football_Wallpapers_H.jpg",fulltitle=item.fulltitle,folder=False) )
                        
        else:
    
            itemlist.append( Item(channel=__channel__, title="[COLOR aquamarine][B]No hay elaces Sopcast[/B][/COLOR]",thumbnail ="http://s6.postimg.org/v9z5ggmfl/sopcast.jpg",fanart= "http://s6.postimg.org/ttnmybjip/5499731408_42e3876093_b.jpg",folder=False) )
                        
                        

    return itemlist
コード例 #5
0
def entradas(item):
    logger.info("deportesalacarta.channels.streamsports entradas")
    itemlist = []
    sports = {'Football':'Fútbol','Baseball':'Béisbol', 'Tennis':'Tenis', 'Boxing':'Boxeo', 'American Football':'Fútbol Americano',
              'Basketball':'Baloncesto','Cycling':'Ciclismo', 'Motorsports':'Motor', 'Athletics':'Atletismo'}

    data = scrapertools.cachePage(item.url)
    data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
    data = dhe(data)

    bloque = scrapertools.find_single_match(data, '<tbody>(.*?)</tbody>')
    patron = '<tr>.*?<span>([A-z]+)(\d+)</span>.*?<span class=\'(timepast|time)\'>' \
             '<span class="hours">(.*?)</span>(.*?)</span>' \
             '.*?</br>(.*?)</td>.*?</span>.*?alt="([^"]+)"' \
             '.*?<strong>(.*?)</strong>.*?<strong>(.*?)</strong>' \
             '.*?href="([^"]+)"'
    matches = scrapertools.find_multiple_matches(bloque, patron)

    for mes, dia, live, hora, minutos, deporte, torneo, equipo1, equipo2, scrapedurl  in matches:
        import datetime
        from time import strptime
        mes = str(strptime(mes,'%b').tm_mon)
        minutos = minutos.replace(":", "")
        fecha_partido = datetime.datetime(datetime.datetime.today().year, int(mes), int(dia), int(hora), int(minutos))
        fecha_partido = fecha_partido + datetime.timedelta(hours=1)
        fecha_actual = datetime.datetime.today()
        time = fecha_partido.strftime("%H:%M")
        date = fecha_partido.strftime("%d/%m")

        hora = time
        fecha = "["+date+"] "

        if fecha_partido <= fecha_actual: scrapedtitle = "[COLOR red][B]"+fecha+time+"[/B][/COLOR]"
        else: scrapedtitle = "[COLOR green][B]"+fecha+time+"[/B][/COLOR]"
        if (equipo1 or equipo2) != "N/A":
            evento_item = equipo1+" vs "+equipo2
            partido = " [COLOR darkorange][B]"+equipo1+" vs "+equipo2+"[/B][/COLOR]"
            scrapedtitle += partido
        else: partido = ""

        if deporte in sports: deporte = deporte.replace(deporte, sports[deporte])
        if item.url == host:
            scrapedtitle += " [COLOR blue]("+deporte+"-"+torneo+")[/COLOR]"
        else:
            scrapedtitle += " [COLOR blue]("+torneo+")[/COLOR]"
        
        itemlist.append( Item(channel=__channel__, title=scrapedtitle, action="findvideos", url=host+scrapedurl, thumbnail=item.thumbnail, fanart= item.fanart,fulltitle=scrapedtitle,
                              match=partido, competicion=deporte+"-"+torneo, folder=True, context="info_partido", date=date, time=time, evento=evento_item, deporte=deporte))

    return itemlist
コード例 #6
0
def mainlist(item):
    logger.info("pelisalacarta.livetv mainlist")
    itemlist = []

    xbmc.executebuiltin('xbmc.PlayMedia(' + song + ')')

    #Live
    item.url = "http://livetv.sx/es/allupcomingsports"
    itemlist.append(
        Item(
            channel=__channel__,
            title="[COLOR red][B]LIVE!![/B][/COLOR]",
            action="scraper_live",
            url=host,
            thumbnail="http://s6.postimg.org/brzwms041/LIVE.png",
            fanart=
            "http://s6.postimg.org/lqkv999jl/321238_1024x768_www_The_Wallpapers_org.jpg"
        ))

    # Main options
    item.url = "http://livetv.sx/es/allupcomingsports"
    data = dhe(scrapertools.cachePage(item.url))
    patronmain = '<table width="100%" cellpadding=12 cellspacing=0>(.*?)<span class="sltitle">'
    matchesmain = re.compile(patronmain, re.DOTALL).findall(data)

    for main in matchesmain:

        patron = '<td background.*?href="([^"]+)".*?src="([^"]+)".*?<a class="main".*?><b>(.*?)</b></a>'
        matches = re.compile(patron, re.DOTALL).findall(main)
        for url, thumbnail, deporte in matches:
            if deporte == "Fútbol":
                extra = "http://s6.postimg.org/a2qtepkep/fotbal.jpg"
                deporte = "[COLOR palegreen][B]" + deporte + "[/B][/COLOR]"
            else:
                extra = "http://s6.postimg.org/fs71z0qkx/B9317206944_Z_1_20150503001849_000_GNEAM3_I82_1_0.jpg"
                deporte = "[COLOR skyblue][B]" + deporte + "[/B][/COLOR]"
            itemlist.append(
                Item(
                    channel=__channel__,
                    title=deporte,
                    action="scraper",
                    url=urlparse.urljoin(host, url),
                    thumbnail=thumbnail,
                    fanart=
                    "http://s6.postimg.org/lqkv999jl/321238_1024x768_www_The_Wallpapers_org.jpg",
                    extra=extra,
                    folder=True))

    return itemlist
コード例 #7
0
def temporadas(item):
    logger.info("pelisalacarta.verseriesonlinetv temporadas")
    
    itemlist = []
    

    data = dhe( httptools.downloadpage(item.url).data )
    data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
    
    
    if "Temporada 0" in data:
         bloque_temporadas = 'Temporada 0.*?(<h3 class="three fourths col-xs-12 pad0">.*?<div class="col-md-4 padl0">)'
         matchestemporadas = re.compile(bloque_temporadas,re.DOTALL).findall(data)
         
         for bloque_temporadas in matchestemporadas:
             patron = '<h3 class="three fourths col-xs-12 pad0">.*?href="([^"]+)" title="([^<]+)"'
             matches = re.compile(patron,re.DOTALL).findall(bloque_temporadas)

    else:
        patron = '<h3 class="three fourths col-xs-12 pad0">.*?href="([^"]+)" title="([^<]+)"'
        matches = re.compile(patron,re.DOTALL).findall(data)
    if len(matches)==0 :
       itemlist.append( Item(channel=item.channel, title="[COLOR gold][B]No hay resultados...[/B][/COLOR]", thumbnail ="http://s6.postimg.org/fay99h9ox/briconoisethumb.png", fanart ="http://pic.raise5.com/user_pictures/user-1423992581-237429.jpg",folder=False) )
    for scrapedurl, scrapedtitle in matches:
        ###Busqueda poster temporada tmdb
        scrapedtitle = scrapedtitle.replace(scrapedtitle,"[COLOR springgreen]"+scrapedtitle+"[/COLOR]")
        temporada = scrapertools.get_match(scrapedtitle,'Temporada (\d+)')
        scrapedtitle = scrapedtitle.replace("Temporada","[COLOR darkorange]Temporada[/COLOR]")
        
        
        

        ###Busca poster de temporada Tmdb
        urltmdb_temp= "http://api.themoviedb.org/3/tv/"+item.show.split("|")[5]+"/season/"+temporada+"/images?api_key="+api_key
        data = httptools.downloadpage(urltmdb_temp).data
        data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
        patron = '{"id".*?"file_path":"(.*?)","height"'
        matches = re.compile(patron,re.DOTALL).findall(data)
        if len(matches) == 0:
            thumbnail= item.thumbnail
        for temp in matches:
            thumbnail= "https://image.tmdb.org/t/p/original"+ temp
        extra= item.extra+"|"+temporada

        itemlist.append( Item(channel=item.channel, title=scrapedtitle, action="capitulos", url=scrapedurl, thumbnail =thumbnail, fanart =item.show.split("|")[0],show = item.show, extra= extra,category = item.category, folder=True) )

    return itemlist
コード例 #8
0
def temporadas(item):
    logger.info("pelisalacarta.verseriesonlinetv temporadas")
    
    itemlist = []
    

    data = dhe( scrapertools.cachePage(item.url) )
    data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
    
    
    if "Temporada 0" in data:
         bloque_temporadas = 'Temporada 0.*?(<h3 class="three fourths col-xs-12 pad0">.*?<div class="col-md-4 padl0">)'
         matchestemporadas = re.compile(bloque_temporadas,re.DOTALL).findall(data)
         
         for bloque_temporadas in matchestemporadas:
             patron = '<h3 class="three fourths col-xs-12 pad0">.*?href="([^"]+)" title="([^<]+)"'
             matches = re.compile(patron,re.DOTALL).findall(bloque_temporadas)

    else:
        patron = '<h3 class="three fourths col-xs-12 pad0">.*?href="([^"]+)" title="([^<]+)"'
        matches = re.compile(patron,re.DOTALL).findall(data)
    if len(matches)==0 :
       itemlist.append( Item(channel=item.channel, title="[COLOR gold][B]No hay resultados...[/B][/COLOR]", thumbnail ="http://s6.postimg.org/fay99h9ox/briconoisethumb.png", fanart ="http://pic.raise5.com/user_pictures/user-1423992581-237429.jpg",folder=False) )
    for scrapedurl, scrapedtitle in matches:
        ###Busqueda poster temporada tmdb
        scrapedtitle = scrapedtitle.replace(scrapedtitle,"[COLOR springgreen]"+scrapedtitle+"[/COLOR]")
        temporada = scrapertools.get_match(scrapedtitle,'Temporada (\d+)')
        scrapedtitle = scrapedtitle.replace("Temporada","[COLOR darkorange]Temporada[/COLOR]")
        
        
        

        ###Busca poster de temporada Tmdb
        urltmdb_temp= "http://api.themoviedb.org/3/tv/"+item.show.split("|")[5]+"/season/"+temporada+"/images?api_key="+api_key
        data = scrapertools.cachePage( urltmdb_temp )
        data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
        patron = '{"id".*?"file_path":"(.*?)","height"'
        matches = re.compile(patron,re.DOTALL).findall(data)
        if len(matches) == 0:
            thumbnail= item.thumbnail
        for temp in matches:
            thumbnail= "https://image.tmdb.org/t/p/original"+ temp
        extra= item.extra+"|"+temporada

        itemlist.append( Item(channel=item.channel, title=scrapedtitle, action="capitulos", url=scrapedurl, thumbnail =thumbnail, fanart =item.show.split("|")[0],show = item.show, extra= extra,category = item.category, folder=True) )

    return itemlist
コード例 #9
0
def agendaglobal(item):
    itemlist = []
    if item.deporte != "futbol":
        url = "http://livetv.sx/ajax/getaul.php"
        if "hoy" in item.title:
            post = "chk0=true&chk1=false&chk2=false&chk3=false&chk4=false&lng=es"
        elif "mañana" in item.title:
            post = "chk0=false&chk1=true&chk2=false&chk3=false&chk4=false&lng=es"
        elif "directo" in item.title:
            post = "chk0=false&chk1=false&chk2=false&chk3=false&chk4=false&lng=es"
        else:
            post = "chk0=true&chk1=true&chk2=true&chk3=true&chk4=true&lng=es"
        data = dhe( scrapertools.cachePage(url, post=post) )
        patron ='<a class="main".*?><b>(.*?)</b>(.*?)</td></tr></table>'
        bloques = scrapertools.find_multiple_matches(data, patron)
        for deporte, bloque in bloques:
            if deporte != "Fútbol":
                patron = '<td width=34 align="center" valign="top">.*?alt="([^"]+)" src="([^"]+)".*?<a class.*?href="([^"]+)">(.*?)</a>.*?<span class="evdesc">(.*?) a (\d+:\d+)'
                matches = scrapertools.find_multiple_matches(bloque, patron)
                for info, thumbnail, scrapedurl, title, fecha, hora in matches:
                    if deporte == "Diverso":
                        deporte = info
                    fecha = fecha.strip()
                    dia = scrapertools.get_match(fecha, '(\d+)')
                    mes = scrapertools.get_match(fecha, 'de ([A-z]+)')
                    mes = month_convert(mes.title())
                    mes = str(mes).zfill(2)
                    date = dia+"/"+mes
                    title = title.replace("&ndash;"," vs ")
                    evento = title
                    url = urlparse.urljoin(host, scrapedurl)
                    extra= "http://s6.postimg.org/fs71z0qkx/B9317206944_Z_1_20150503001849_000_GNEAM3_I82_1_0.jpg"
                    itemlist.append(Item(channel=__channel__, title=title, action="enlaces", url=url, extra=extra, fanart=extra, thumbnail=thumbnail, deporte=deporte, evento=evento, date=date, time=hora))

    else:
        item.extra = "http://s6.postimg.org/a2qtepkep/fotbal.jpg"
        item.url = "http://livetv.sx/es/allupcomingsports/1/"
        try:
            itemlist = scraper(item)
        except:
            import sys
            for line in sys.exc_info():
                logger.error("{0}".format(line))
            return []

    return itemlist
コード例 #10
0
def scraper(item):
    logger.info("pelisalacarta.verseriesonlinetv scraper")
    itemlist = []
    ###Borra customkeys
    

    # Descarga la página
    data = dhe( httptools.downloadpage(item.url).data)

    patron = '<li class="item">.*?<a class="poster" href="([^"]+)".*?<img src="([^"]+)" alt="([^<]+)"'
    matches = re.compile(patron,re.DOTALL).findall(data)
    scrapertools.printMatches(matches)

    for scrapedurl, scrapedthumbnail, scrapedtitle in matches:
        title_fan = scrapedtitle.strip()
        
        #Busqueda del año y puntuacion
        urlyear =scrapedurl
        data2 =  httptools.downloadpage(scrapedurl).data
        year= scrapertools.get_match(data2,'<h1>.*?<span>\((.*?)\)</span></h1>')
        points= scrapertools.get_match(data2,'<div class="number">.*?<b>(.*?)</b>')
        if points=="":
           points = "No puntuada"
    
        scrapedtitle = scrapedtitle + " ("+"[COLOR orange][B]"+points+"[/B][/COLOR]"+ ")"
        show = title_fan+"|"+year
                                       
        scrapedtitle = scrapedtitle.replace(scrapedtitle,"[COLOR springgreen]"+scrapedtitle+"[/COLOR]")
        itemlist.append( Item(channel=item.channel, title=scrapedtitle, url=scrapedurl, action= "fanart" , thumbnail=scrapedthumbnail, fanart="http://s6.postimg.org/8pyvdfh75/verseriesfan.jpg", show= show, plot= title_fan, folder=True) )

    
    ## Paginación
    #<span class='current'>1</span><a href='http://www.bricocine.com/c/hd-microhd/page/2/'
    
    # Si falla no muestra ">> Página siguiente"
    try:

        next_page = scrapertools.get_match(data,"<span class='current'>\d+</span><a class=\"page larger\" href=\"([^\"]+)\"")
        
        title= "[COLOR floralwhite]Pagina siguiente>>[/COLOR]"
        itemlist.append( Item(channel=item.channel, title=title, url=next_page, action="scraper", fanart="http://s6.postimg.org/8pyvdfh75/verseriesfan.jpg", thumbnail="http://virtualmarketingpro.com/app/webroot/img/vmp/arrows/Green%20Arrow%20(26).png", folder=True) )
    except: pass


    return itemlist
コード例 #11
0
def scraper(item):
    logger.info("pelisalacarta.verseriesonlinetv scraper")
    itemlist = []
    ###Borra customkeys
    

    # Descarga la página
    data = dhe( scrapertools.cachePage(item.url) )

    patron = '<li class="item">.*?<a class="poster" href="([^"]+)".*?<img src="([^"]+)" alt="([^<]+)"'
    matches = re.compile(patron,re.DOTALL).findall(data)
    scrapertools.printMatches(matches)

    for scrapedurl, scrapedthumbnail, scrapedtitle in matches:
        title_fan = scrapedtitle.strip()
        
        #Busqueda del año y puntuacion
        urlyear =scrapedurl
        data2 =  scrapertools.cachePage( scrapedurl )
        year= scrapertools.get_match(data2,'<h1>.*?<span>\((.*?)\)</span></h1>')
        points= scrapertools.get_match(data2,'<div class="number">.*?<b>(.*?)</b>')
        if points=="":
           points = "No puntuada"
    
        scrapedtitle = scrapedtitle + " ("+"[COLOR orange][B]"+points+"[/B][/COLOR]"+ ")"
        show = title_fan+"|"+year
                                       
        scrapedtitle = scrapedtitle.replace(scrapedtitle,"[COLOR springgreen]"+scrapedtitle+"[/COLOR]")
        itemlist.append( Item(channel=item.channel, title=scrapedtitle, url=scrapedurl, action= "fanart" , thumbnail=scrapedthumbnail, fanart="http://s6.postimg.org/8pyvdfh75/verseriesfan.jpg", show= show, plot= title_fan, folder=True) )

    
    ## Paginación
    #<span class='current'>1</span><a href='http://www.bricocine.com/c/hd-microhd/page/2/'
    
    # Si falla no muestra ">> Página siguiente"
    try:

        next_page = scrapertools.get_match(data,"<span class='current'>\d+</span><a class=\"page larger\" href=\"([^\"]+)\"")
        
        title= "[COLOR floralwhite]Pagina siguiente>>[/COLOR]"
        itemlist.append( Item(channel=item.channel, title=title, url=next_page, action="scraper", fanart="http://s6.postimg.org/8pyvdfh75/verseriesfan.jpg", thumbnail="http://virtualmarketingpro.com/app/webroot/img/vmp/arrows/Green%20Arrow%20(26).png", folder=True) )
    except: pass


    return itemlist
コード例 #12
0
def scraper(item):
    logger.info("pelisalacarta.livetv scraper")

    itemlist = []

    # Descarga la página

    data = dhe(scrapertools.cachePage(item.url))

    patron_bloque = '<table align="center" width="90%"></tr><tr><td colspan=4 height=48>(.*?)Archivo de transmisiones'
    matchesenlaces = re.compile(patron_bloque, re.DOTALL).findall(data)
    for pepe in matchesenlaces:
        patron = '<td width=34 align="center" valign="top">.*?src="([^"]+)".*?<a class.*?href="([^"]+)">(.*?)</a>.*?<span class="evdesc">(.*?)<br>(.*?)</span>'
        matches = re.compile(patron, re.DOTALL).findall(pepe)

        for thumbnail, ficha, title, fecha, info in matches:
            fecha = fecha.strip()
            info = info.strip()
            title = title.replace("&ndash;", "___")
            fecha = deporte = "[COLOR gold][B]" + fecha + "[/B][/COLOR]"
            info = deporte = "[COLOR orange][B]" + info + "[/B][/COLOR]"
            if item.extra == "http://s6.postimg.org/a2qtepkep/fotbal.jpg":
                title = "[COLOR palegreen][B]" + title + "[/B][/COLOR]"
                extra = "futbol"
            else:
                title = "[COLOR skyblue][B]" + title + "[/B][/COLOR]"
                extra = "live"
            encuentro = fecha + "--" + title + "--" + info

            itemlist.append(
                Item(channel=__channel__,
                     title=encuentro,
                     action="enlaces",
                     url=urlparse.urljoin(host, ficha),
                     thumbnail=thumbnail,
                     fanart=item.extra,
                     extra=extra,
                     fulltitile=title,
                     folder=True))
    return itemlist
コード例 #13
0
def entradas(item):
    logger.info("pelisalacarta.channels.streamsports entradas")
    itemlist = []
    sports = {'Football':'Fútbol','Baseball':'Béisbol', 'Tennis':'Tenis', 'Boxing':'Boxeo', 'American Football':'Fútbol Americano',
              'Basketball':'Baloncesto','Cycling':'Ciclismo', 'Motorsports':'Motor', 'Athletics':'Atletismo'}

    data = scrapertools.cachePage(item.url)
    data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
    data = dhe(data)

    bloque = scrapertools.find_single_match(data, '<tbody>(.*?)</tbody>')
    patron = '<tr>.*?<span>([A-z]+)(\d+)</span>.*?<span class=\'(timepast|time)\'>' \
             '<span class="hours">(.*?)</span>(.*?)</span>' \
             '.*?</br>(.*?)</td>.*?</span>.*?alt="([^"]+)"' \
             '.*?<strong>(.*?)</strong>.*?<strong>(.*?)</strong>' \
             '.*?href="([^"]+)"'
    matches = scrapertools.find_multiple_matches(bloque, patron)

    for mes, dia, live, hora, minutos, deporte, torneo, equipo1, equipo2, scrapedurl  in matches:
        from time import strptime
        mes = str(strptime(mes,'%b').tm_mon)
        hora = str(int(hora)+1) if int(hora) < 23 else "0"
        fecha = "["+dia+"/"+mes+"] "

        if live == "timepast": scrapedtitle = "[COLOR red][B]"+fecha+hora+minutos+"[/B][/COLOR]"
        else: scrapedtitle = "[COLOR green][B]"+fecha+hora+minutos+"[/B][/COLOR]"
        if (equipo1 or equipo2) != "N/A":
            partido = " [COLOR darkorange][B]"+equipo1+" vs "+equipo2+"[/B][/COLOR]"
            scrapedtitle += partido
        else: partido = ""

        if deporte in sports: deporte = deporte.replace(deporte, sports[deporte])
        if item.url == host:
            scrapedtitle += " [COLOR blue]("+deporte+"-"+torneo+")[/COLOR]"
        else:
            scrapedtitle += " [COLOR blue]("+torneo+")[/COLOR]"
        
        itemlist.append( Item(channel=__channel__, title=scrapedtitle, action="findvideos", url=host+scrapedurl, thumbnail=item.thumbnail, fanart= item.fanart,fulltitle=scrapedtitle, match=partido, competicion=deporte+"-"+torneo, folder=True) )

    return itemlist
コード例 #14
0
def scraper_live(item):
    logger.info("pelisalacarta.livetv scraper")

    itemlist = []

    # Descarga la página

    data = dhe(scrapertools.cachePage(item.url))

    patron_bloque = '<span class="date">Hoy.*?</span>(.*?)ensenar todo'
    matchesenlaces = re.compile(patron_bloque, re.DOTALL).findall(data)
    for pepe in matchesenlaces:
        patron = 'alt.*?src="([^"]+)".*?href="([^"]+)">([^"]+)</a>.*?<span class="evdesc">(\d+:\d+) \(([^"]+)\)'
        matches = re.compile(patron, re.DOTALL).findall(pepe)

        for thumbnail, url, title, hora, info in matches:
            info = info.strip()
            hora = hora.strip()
            info = "(" + info + ")"
            title = title.replace("&ndash;", "___")
            hora = "[COLOR yellow][B]" + hora + "[/B][/COLOR]"
            info = "[COLOR orange][B]" + info + "[/B][/COLOR]"
            title = "[COLOR red][B]" + title + "[/B][/COLOR]"
            encuentro = hora + "--" + title + " " + info

            itemlist.append(
                Item(
                    channel=__channel__,
                    title=encuentro,
                    action="enlaces",
                    url=urlparse.urljoin(host, url),
                    thumbnail=thumbnail,
                    extra="live",
                    fulltitle=title,
                    fanart=
                    "http://s6.postimg.org/fs71z0qkx/B9317206944_Z_1_20150503001849_000_GNEAM3_I82_1_0.jpg",
                    folder=True))
    return itemlist
コード例 #15
0
ファイル: lfootballws.py プロジェクト: Jmlaguna89/miNuevoRepo
def enlaces(item):
    logger.info("pelisalacarta.livetv enlaces")
    itemlist = []

    import xbmc
    if not xbmc.Player().isPlaying():
       xbmc.executebuiltin('xbmc.PlayMedia('+song+')')
   
    data = dhe( scrapertools.cachePage(item.url) ).decode('cp1251').encode('utf8')
    

    patronenlaces =' <table class="live-table">(.*?)<h1 class="sectionName">'
    matchesenlaces = re.compile(patronenlaces,re.DOTALL).findall(data)
    if len(matchesenlaces)==0:
        try:
            check= scrapertools.get_match(data,'<div class="CD_text">Событие завершено</div>')
            title = "Partido finalizado".title()
            itemlist.append( Item(channel=__channel__, title="[COLOR bisque][B]"+title+"[/B][/COLOR]",thumbnail =item.thumbnail, fanart= item.fanart, folder=False) )
        except:
            title = "Los enlaces aparecerán media hora antes del encuentro".title()
            itemlist.append( Item(channel=__channel__, title="[COLOR orange][B]"+title+"[/B][/COLOR]",thumbnail =item.thumbnail, fanart="http://s6.postimg.org/nmba7vde9/wallpaper_football_warsaw_stadium_national_hobbi.jpg", folder=False) )


    for bloque_enlaces in matchesenlaces:
        patron = '<a href=.*?<a href=".*?".*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<a href="(.*?)"'
        matches = re.compile(patron,re.DOTALL).findall(bloque_enlaces)
        
        for velocidad,canal,url in matches:
            print "lobo"
            print url
            if "sop" in url:
                player= "[COLOR deepskyblue][B]Sopcast[/B][/COLOR]"
            else :
                player = "[COLOR palegreen][B]Acestream[/B][/COLOR]"
            title = "[COLOR mediumorchid][B]"+canal+"[/B][/COLOR]" +" "+"("+player+")"+" "+"("+"[COLOR moccasin][B]"+velocidad+"[/B][/COLOR]"+")"
            itemlist.append( Item(channel=__channel__, title=title,action="play",url = url,thumbnail =item.thumbnail, fanart= "http://s6.postimg.org/3sid4gz9t/Snchez_Pizjun_Borussia_opt.jpg", extra ="saliendo",fulltitle = item.fulltitle,folder=False) )

    return itemlist
コード例 #16
0
def enlaces(item):
    logger.info("pelisalacarta.livetv enlaces")
    itemlist = []

    import xbmc
    if not xbmc.Player().isPlaying():
       xbmc.executebuiltin('xbmc.PlayMedia('+song+')')
   
    data = dhe( scrapertools.cachePage(item.url) ).decode('cp1251').encode('utf8')
    

    patronenlaces =' <table class="live-table">(.*?)<h1 class="sectionName">'
    matchesenlaces = re.compile(patronenlaces,re.DOTALL).findall(data)
    if len(matchesenlaces)==0:
        try:
            check= scrapertools.get_match(data,'<div class="CD_text">Событие завершено</div>')
            title = "Partido finalizado".title()
            itemlist.append( Item(channel=__channel__, title="[COLOR bisque][B]"+title+"[/B][/COLOR]",thumbnail =item.thumbnail, fanart= item.fanart, folder=False) )
        except:
            title = "Los enlaces aparecerán media hora antes del encuentro".title()
            itemlist.append( Item(channel=__channel__, title="[COLOR orange][B]"+title+"[/B][/COLOR]",thumbnail =item.thumbnail, fanart="http://s6.postimg.org/nmba7vde9/wallpaper_football_warsaw_stadium_national_hobbi.jpg", folder=False) )


    for bloque_enlaces in matchesenlaces:
        patron = '<a href=.*?<a href=".*?".*?<td>(.*?)</td>.*?<td>(.*?)</td>.*?<a href="(.*?)"'
        matches = re.compile(patron,re.DOTALL).findall(bloque_enlaces)
        
        for velocidad,canal,url in matches:
            print "lobo"
            print url
            if "sop" in url:
                player= "[COLOR deepskyblue][B]Sopcast[/B][/COLOR]"
            else :
                player = "[COLOR palegreen][B]Acestream[/B][/COLOR]"
            title = "[COLOR mediumorchid][B]"+canal+"[/B][/COLOR]" +" "+"("+player+")"+" "+"("+"[COLOR moccasin][B]"+velocidad+"[/B][/COLOR]"+")"
            itemlist.append( Item(channel=__channel__, title=title,action="play",url = url,thumbnail =item.thumbnail, fanart= "http://s6.postimg.org/plrvza7pr/Snchez_Pizjun_Borussia_opt.jpg", extra ="saliendo",fulltitle = item.fulltitle,folder=False) )

    return itemlist
コード例 #17
0
def capitulos(item):
    logger.info("pelisalacarta.verseriesonlinetv capitulos")
    
    itemlist = []
    
    data = dhe( scrapertools.cachePage(item.url) )
    patron = '<div class="item_episodio col-xs-3 ">.*?href="([^"]+)" title="([^<]+)".*?<img src="([^"]+)"'
    matches = re.compile(patron,re.DOTALL).findall(data)
    if len(matches)==0 :
        itemlist.append( Item(channel=item.channel, title="[COLOR coral][B]"+"no hay capítulos...".upper()+"[/B][/COLOR]", thumbnail ="http://s6.postimg.org/wa269heq9/verseriesnohaythumb.png", fanart ="http://s6.postimg.org/4nzeosvdd/verseriesnothingfan.jpg",folder=False) )
    for scrapedurl, scrapedtitle, scrapedthumbnail in matches:
        scrapedtitle = re.sub(r"(.*?Temporada \d+)","",scrapedtitle).strip()
        capitulo = re.sub(r"Capitulo","",scrapedtitle).strip()
        scrapedtitle = scrapedtitle.replace(scrapedtitle,"[COLOR limegreen]"+scrapedtitle+"[/COLOR]")
        extra =item.extra+"|"+capitulo
        
        itemlist.append( Item(channel=item.channel, title = scrapedtitle , action="findvideos", url=scrapedurl,  thumbnail=item.show.split("|")[4], fanart=item.show.split("|")[1], show = item.show, extra= extra,category= item.category,folder=True) )
        title ="Info"
        title = title.replace(title,"[COLOR darkseagreen]"+title+"[/COLOR]")
        itemlist.append( Item(channel=item.channel, action="info_capitulos" , title=title , url=item.url, thumbnail=scrapedthumbnail, fanart=item.show.split("|")[1], extra = extra, show = item.show, category = item.category, folder=False ))
        


    return itemlist
コード例 #18
0
def capitulos(item):
    logger.info("pelisalacarta.verseriesonlinetv capitulos")
    
    itemlist = []
    
    data = dhe( httptools.downloadpage(item.url).data )
    patron = '<div class="item_episodio col-xs-3 ">.*?href="([^"]+)" title="([^<]+)".*?<img src="([^"]+)"'
    matches = re.compile(patron,re.DOTALL).findall(data)
    if len(matches)==0 :
        itemlist.append( Item(channel=item.channel, title="[COLOR coral][B]"+"no hay capítulos...".upper()+"[/B][/COLOR]", thumbnail ="http://s6.postimg.org/wa269heq9/verseriesnohaythumb.png", fanart ="http://s6.postimg.org/4nzeosvdd/verseriesnothingfan.jpg",folder=False) )
    for scrapedurl, scrapedtitle, scrapedthumbnail in matches:
        scrapedtitle = re.sub(r"(.*?Temporada \d+)","",scrapedtitle).strip()
        capitulo = re.sub(r"Capitulo","",scrapedtitle).strip()
        scrapedtitle = scrapedtitle.replace(scrapedtitle,"[COLOR limegreen]"+scrapedtitle+"[/COLOR]")
        extra =item.extra+"|"+capitulo
        
        itemlist.append( Item(channel=item.channel, title = scrapedtitle , action="findvideos", url=scrapedurl,  thumbnail=item.show.split("|")[4], fanart=item.show.split("|")[1], show = item.show, extra= extra,category= item.category,folder=True) )
        title ="Info"
        title = title.replace(title,"[COLOR darkseagreen]"+title+"[/COLOR]")
        itemlist.append( Item(channel=item.channel, action="info_capitulos" , title=title , url=item.url, thumbnail=scrapedthumbnail, fanart=item.show.split("|")[1], extra = extra, show = item.show, category = item.category, folder=False ))
        


    return itemlist
コード例 #19
0
ファイル: topbongda.py プロジェクト: gacj22/WizardGacj22
def mainlist(item):
    logger.info("deportesalacarta.topbongda mainlist")
    itemlist = []
    
    if item.extra != "next_page":
        item.url = "http://topbongda.com/?t=sap-dien-ra"#/wendy/ajax/home_matches/?page=1"
        if item.channel == __channel__:
            if not xbmc.Player().isPlaying():
                xbmc.executebuiltin('xbmc.PlayMedia('+song+')')
        else:
            item.channel = __channel__
    data = httptools.downloadpage(item.url).data
    data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;|&amp;","",data)
    
    #data = jsontools.load_json(data)

    patrondaygames = scrapertools.find_multiple_matches(data,'<div class="match-block mdl-shadow--2dp">.*?date_range</i>(.*?)<small>(.*?)</div></li></ul></div>')
    
    for fecha_partidos, bloque_partidos in patrondaygames:
        #LIVE
        patronlive ='<span class="time">(.*?)</span><span class="minute">(.*?)<i class="playing">.*?<strong>(.*?)</strong>.*?class="score">(.*?)</a>.*?</a><strong>(.*?)</strong>.*?<a href="([^"]+)".*?class="mdl-tooltip">(.*?)</div>'
        matcheslive=re.compile(patronlive,re.DOTALL).findall(bloque_partidos)
        for hora,minuto,team1,score,team2,url,league in matcheslive:
            # Eliminamos la coincidencia en bloque_partidos para evitar errores en el patron NO LIVE
            bloque_partidos = re.sub('<span class="time">'+hora, '', bloque_partidos)
            minuto=dhe(minuto.strip())
            minute = dhe(minuto.strip())
            if "HT" in minuto:
                minuto = "Descanso"
                minute = "60"
            elif "FT" in minuto:
                minuto = "Finalizado"
                minute = "90"
            elif "started" in minuto:
                minuto = "Por comenzar"
                minute = "0"
            minute = filter(lambda x: x.isdigit(), minute)

            # Calcula hora y fecha de comienzo del evento para la agenda global
            h, m = scrapertools.get_match(hora,'(\d+):(\d+)')
            tiempo = datetime.datetime(2000, 1, 1, int(h), int(m)) - datetime.timedelta(hours=4)
            tiempo = tiempo.time().strftime("%H:%M")

            fecha_actual = datetime.datetime.today() + datetime.timedelta(hours=5)
            fecha = fecha_actual - datetime.timedelta(hours=5, minutes=int(minute))
            fecha = fecha.strftime("%d/%m")
            
            if "HT" in minuto:
                minuto = "Descanso"
            if "FT" in minuto:
                minuto = "Finalizado"
            title =  "[COLOR chartreuse][B]"+team1+"[/B][/COLOR]"+"[COLOR yellowgreen]__[/COLOR]"+"[COLOR yellow][B]"+score+"[/B][/COLOR]"+"[COLOR yellowgreen]__[/COLOR]"+"[COLOR chartreuse][B]"+team2+"[/B][/COLOR]"
            title = "[COLOR olivedrab]([/COLOR]"+"[COLOR yellowgreen][B]"+minuto+"[B][/COLOR]"+"[COLOR olivedrab])[/COLOR]"+" "+title+" [COLOR crimson][B]LIVE!![/B][/COLOR] [COLOR yellowgreen]("+league+")[/COLOR]"
            url = re.sub(r"https/","http://",url)+"sopcast"
            url = re.sub(r"/ti-le","",url)
            evento = team1 + " vs " + team2
            
            itemlist.append( Item(channel=__channel__, title=title,action="enlaces",url = url,thumbnail="http://imgur.com/CS2Iy56.png",fanart="http://s6.postimg.org/bwlfc3fdd/topbongdafan.jpg", fulltitle= "[COLOR chartreuse][B]"+team1+" Vs "+team2+"[/B][/COLOR]",extra="LIVE",
                                  date=fecha, time=tiempo, evento=evento, deporte="futbol", folder=True, context="info_partido") )
        #NO LIVE
        patronnolive ='<div class="info"><span class="time">(\d+:\d+)</span><a href=".*?class="league">(.*?)</a>.*?<strong>(.*?)</strong>.*?<strong>(.*?)</strong>.*?<a href="([^"]+)"'
        matchesnolive=re.compile(patronnolive,re.DOTALL).findall(bloque_partidos)
        logger.info("maruhenda")
        logger.info (str(patrondaygames))
        for hora,league,team1,team2,url in matchesnolive:

            format_date = "%d/%m"
            format_time = "%H:%M"
            # Extraemos hora, minutos, dia, mes y año
            h, m = scrapertools.get_match(hora,'(\d+):(\d+)')
            fecha_actual = datetime.datetime.today() + datetime.timedelta(hours=6)
            if "Hôm Nay" in fecha_partidos:
                fecha_partidos = fecha_actual.strftime("%d/%m/%Y")
            elif "Ngày Mai" in fecha_partidos:
                fecha_partidos = fecha_actual + datetime.timedelta(days=1)
                fecha_partidos = fecha_partidos.strftime("%d/%m/%Y")

            day, month, year = scrapertools.get_match(fecha_partidos,'(\d+)/(\d+)/(\d+)')
            # Creamos el objeto con la fecha extraída
            date_change = datetime.datetime(int(year), int(month), int(day), int(h), int(m))
            # Le restamos 5 horas
            date_change = date_change - datetime.timedelta(hours=5)
            fecha = date_change.strftime("%d/%m/%Y")
            date = date_change.strftime(format_date)
            ok_time = date_change.strftime(format_time)

            if "Ngoại Hạng Anh" in league:
                league = "Premier League"
            if "Hạng Nhất Anh" in league:
                league = "Premier League"

            extra =ok_time+"|"+fecha
            evento = team1+" vs "+team2

            # Calculamos la diferencia horaria entre el evento y la hora actual para buscar enlaces
            # solo cuando falte menos de media hora para empezar el partido
            diferencia_hora = (date_change - datetime.datetime.today())
            if diferencia_hora.days == 0:
                hours, remainder = divmod(diferencia_hora.seconds, 3600)
                minutes, seconds = divmod(remainder, 60)
                if hours == 0 and minutes <= 30:
                    url = re.sub(r"https/","http://",url)+"sopcast"
                    url = re.sub(r"/ti-le","",url)
            title = team1+" Vs "+team2
            title ="[COLOR chartreuse]"+ok_time+"[/COLOR]" +"[COLOR olivedrab]--[/COLOR]"+"[COLOR gold]"+date+"[/COLOR]"+" "+"[COLOR seagreen][B]"+title+"[/B][/COLOR]" + " "+"[COLOR olivedrab]([/COLOR]"+"[COLOR yellowgreen]"+league+"[/COLOR]"+"[COLOR olivedrab])[/COLOR]"
            title = dhe(title)
            
            itemlist.append( Item(channel=__channel__, title=title,action="enlaces",url = url ,thumbnail="http://www.apkrepo.com/wp-content/uploads/2016/03/com.adnkm_.soccerclockwidget.icon_.png",fanart="http://s6.postimg.org/bwlfc3fdd/topbongdafan.jpg", fulltitle= "[COLOR seagreen][B]"+team1+" Vs "+team2+"[/B][/COLOR]",extra=extra,
                                  date=date, time=ok_time, evento=evento, deporte="futbol", context="info_partido", folder=True) )
    
    return itemlist
コード例 #20
0
def scraper(item, paginacion=True):
    logger.info("pelisalacarta.sinluces peliculas")
    itemlist = []

    # Descarga la página
    data = dhe(scrapertools.cachePage(item.url))
    data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;", "", data)

    patron = '<divclass="movie tooltip".*?title="(.*?)".*?<div class="imagen"> <img src="([^"]+)" '
    patron += 'alt="(.*?)\((.*?)\)".*?'
    patron += '<a href="([^"]+)".*?'
    patron += '<span class="icon-grade"></span>([^<]+)</div>'

    matches = re.compile(patron, re.DOTALL).findall(data)
    scrapertools.printMatches(matches)
    if len(matches) == 0 and not "Error 404" in data:
        itemlist.append(
            Item(channel=__channel__,
                 title="[COLOR gold][B]No hay resultados...[/B][/COLOR]",
                 thumbnail="http://s6.postimg.org/55zljwr4h/sinnoisethumb.png",
                 fanart="http://s6.postimg.org/avfu47xap/sinnoisefan.jpg",
                 folder=False))

    for scrapedidioma, scrapedthumbnail, scrapedtitle, scrapedyear, scrapedurl, scrapedrate in matches:
        title_fan = scrapedtitle.strip()
        title_fan = re.sub(r'/.*', '', title_fan)
        scrapedrate = scrapedrate.strip()
        if "N/A" in scrapedrate:
            scrapedrate = "Sin puntuación"
        if "castellano" in scrapedidioma:
            scrapedidioma = "[COLOR deepskyblue][B](Castellano) [/B][/COLOR]"
        elif "Subtitulada" in scrapedidioma:
            scrapedidioma = "[COLOR deepskyblue][B](Subtitulada) [/B][/COLOR]"
        else:
            scrapedidioma = "[COLOR deepskyblue][B](Latino) [/B][/COLOR]"
        scrapedrate = scrapedrate.replace(
            scrapedrate, "[COLOR blue][B](" + scrapedrate + ")[/B][/COLOR]")
        scrapedtitle = scrapedtitle + scrapedidioma + scrapedrate
        scrapedtitle = scrapedtitle.replace(
            scrapedtitle, "[COLOR white]" + scrapedtitle + "[/COLOR]")
        trailer = title_fan + " " + scrapedyear + " trailer"
        trailer = urllib.quote(trailer)

        extra = title_fan + "|" + scrapedyear + "|" + trailer
        itemlist.append(
            Item(channel=__channel__,
                 action="fanart",
                 title=scrapedtitle,
                 url=scrapedurl,
                 thumbnail=scrapedthumbnail,
                 extra=extra,
                 viewmode="movie",
                 fanart="http://s6.postimg.org/mxrtns8lt/sinlucesfan2.jpg"))

    # Extrae el paginador
    ## Paginación
    try:
        if "Error 404" in data:
            itemlist.append(
                Item(channel=__channel__,
                     title="[COLOR gold][B]No hay mas paginas...[/B][/COLOR]",
                     thumbnail=
                     "http://s6.postimg.org/55zljwr4h/sinnoisethumb.png",
                     fanart="http://s6.postimg.org/avfu47xap/sinnoisefan.jpg",
                     folder=False))
        else:
            current_page_number = int(
                scrapertools.get_match(item.url, 'page/(\d+)'))
            item.url = re.sub(r"page/\d+", "page/{0}", item.url)

            next_page_number = current_page_number + 1
            next_page = item.url.format(next_page_number)

            title = "[COLOR skyblue]Pagina siguiente>>[/COLOR]"
            if not "Error 404" in data:
                itemlist.append(
                    Item(channel=__channel__,
                         title=title,
                         url=next_page,
                         fanart=
                         "http://s30.postimg.org/4gugdsygx/sinlucesfan.jpg",
                         thumbnail=
                         "http://s16.postimg.org/lvzzttkol/pelisvkflecha.png",
                         action="scraper",
                         folder=True))
    except:
        pass

    return itemlist
コード例 #21
0
def mainlist(item):
    logger.info("deportesalacarta.lfootballws lista")
    itemlist = []
    import xbmc
    check = xbmc.getInfoLabel('ListItem.Title')

    if item.channel != __channel__:
        item.channel = __channel__
    else:
        xbmc.executebuiltin(
            'Notification([COLOR crimson][B]BIENVENIDOS A...[/B][/COLOR], [COLOR yellow][B]'
            + 'livefootballws'.upper() +
            '[/B][/COLOR],4000,"http://4.bp.blogspot.com/-Jtkwjc049c0/T7CKiNujy-I/AAAAAAAARPc/llNdvg_8TWk/s1600/football_128x128.png")'
        )
        xbmc.executebuiltin("Container.Update")

        if not xbmc.Player().isPlaying():
            xbmc.executebuiltin('xbmc.PlayMedia(' + song + ')')
        """
        Lo que ocurre con
        url = http://translate.googleusercontent.com/translate_c?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&usg=ALkJrhgzJfI1TDn3BxGgPbjgAHHS7J0i9g
        Redirecciones:
        1. http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/
        2. http://translate.googleusercontent.com/translate_p?nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&depth=2&usg=ALkJrhgAAAAAVupk4tLINTbmU7JrcQdl0G4V3LtnRM1n
        3. http://translate.googleusercontent.com/translate_c?depth=2&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&usg=ALkJrhhhRDwHSDRDN4t27cX5CYZLFFQtmA
        Lo que significa que necesitamos una key nueva cada vez en el argumento "usg" y para llegar a la url 3 debemos hacer la petición 1 y 2 con 'follow_redirects=False' o con la convinación de 'follow_redirects=False' y 'header_to_get="location"'
        """

    #### Opción 1: 'follow_redirects=False'
    ## Petición 1
    url = "http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/"
    data = dhe(scrapertools.downloadpage(
        url, follow_redirects=False))  #.decode('cp1251').encode('utf8')
    ## Petición 2
    url = scrapertools.get_match(data, ' src="([^"]+)" name=c ')
    data = dhe(scrapertools.downloadpage(
        url, follow_redirects=False))  #.decode('cp1251').encode('utf8')
    ## Petición 3
    url = scrapertools.get_match(data, 'URL=([^"]+)"')
    data = dhe(scrapertools.cachePage(url))  #.decode('cp1251').encode('utf8')
    """
        #### Opción 2: 'follow_redirects=False' y 'header_to_get="location"'
        ## Petición 1
        url = "http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/"
        data = dhe( scrapertools.downloadpage(url,follow_redirects=False) )#.decode('cp1251').encode('utf8')
        ## Petición 2
        url = scrapertools.get_match(data, ' src="([^"]+)" name=c ')
        url = scrapertools.get_header_from_response(url, header_to_get="location")
        ## Petición 3
        data = dhe( scrapertools.cachePage(url ) )#.decode('cp1251').encode('utf8')
        """

    #a:

    patronmain = 'transmisión en vivo(.*?)traducción en línea'
    matchesmain = re.compile(patronmain, re.DOTALL).findall(data)
    for main in matchesmain:
        print "liveeee"
        print main
        patron = '<img class=img src=(.*?) alt.*?<img class=img src=(.*?) alt.*?<a class=link href=.*?&u=.*?href.*?&u=(.*?)&usg.*?title="(.*?)".*?<span class="nameCon clear">(.*?)</li>'
        matches = re.compile(patron, re.DOTALL).findall(main)
        for thumbnail, fanart, url, title, partido in matches:
            #liga = re.sub(r'<span.*?">|</span>|class=.*?>|<span>.*?<span|<span.*?|>|<a.*?','',liga)
            #if "и" in liga:
            #   liga = "La liga"

            #info = "("+liga+")"
            evento = re.compile(
                '<span class="name fl"><span>(.*?)</span>').findall(partido)
            xbmc.log("cojoneee")
            xbmc.log(str(evento))
            evento = " vs ".join(evento)
            title = "[COLOR chocolate][B]" + title + "[/B][/COLOR]" + " " + "[COLOR crimson][B]EN VIVO!![/B][/COLOR]"
            print "lolo"
            print title
            print url
            fecha = datetime.datetime.today()
            fecha = fecha.strftime("%d/%m")
            time = "live"
            live = "true"
            itemlist.append(
                Item(channel=__channel__,
                     title=title,
                     action="enlaces",
                     url=url,
                     thumbnail=urlparse.urljoin(host, thumbnail),
                     fanart=urlparse.urljoin(host, fanart),
                     fulltitle=title,
                     date=fecha,
                     time=time,
                     evento=evento,
                     context="info_partido",
                     deporte="futbol",
                     folder=True))

    #b
    xbmc.log("menudocoñzo")
    xbmc.log(data)
    patronmain = 'traducción en línea(.*?)traducción'
    matchesmain = re.compile(patronmain, re.DOTALL).findall(data)
    xbmc.log("pacopepe")
    xbmc.log(str(matchesmain))
    if len(matchesmain) == 0 and live == "false":
        itemlist.append(
            Item(
                channel=__channel__,
                title=
                "[COLOR orange][B]No hay encuentros previstos en estos momentos[/B][/COLOR]",
                thumbnail="http://s6.postimg.org/619q91s41/comingsoon.png",
                fanart=
                "http://s6.postimg.org/7ucmxddap/soccer_field_desktop_20150703154119_5596ad1fde3e.jpg"
            ))
    itemlist2 = []
    for main in matchesmain:

        patron = '<img class=img src=([^"]+) alt.*?src=([^"]+) '
        patron += '.*?<a class=link href=.*?&u=.*?href.*?&u=([^"]+)&usg.*?'
        patron += 'title="([^<]+)".*?'
        patron += '<span class="nameCon clear">(.*?)</li><li class=fl>'

        matches = re.compile(patron, re.DOTALL).findall(main)

        if len(matches) == 0 and not live:
            itemlist.append(
                Item(
                    channel=__channel__,
                    title=
                    "[COLOR orange][B]No hay encuentros previstos en estos momentos[/B][/COLOR]",
                    thumbnail="http://s6.postimg.org/619q91s41/comingsoon.png",
                    fanart=
                    "http://s6.postimg.org/7ucmxddap/soccer_field_desktop_20150703154119_5596ad1fde3e.jpg"
                ))
        for thumbnail, fanart, url, title, liga_fecha in matches:
            xbmc.log("zorro")
            xbmc.log(title)
            print liga_fecha
            #liga = re.sub(r'<span.*?">|</span>|class=.*?>|<span>.*?<span|<span.*?|>|<a.*?','',liga)
            try:
                liga = scrapertools.get_match(
                    liga_fecha, '<span class=liga><span>([^<]+)')
                liga = re.sub(r'de', '', liga)
                fecha = re.sub(
                    r'<span class=liga><span>.*?</span></span>|<span class="name fl"><span>.*?</span></span></span>|<span class=dopCon>.*?<span class=date><span>|<span class=date><span>|</span>|</a>|de|,|',
                    '', liga_fecha)
                xbmc.log("manoloooo")
                xbmc.log(fecha)
            except:
                liga = ""

                fecha = scrapertools.get_match(
                    liga_fecha,
                    '<span class=dopCon><span class=date><span>([^<]+)</span>')
            if "taza" in liga:
                liga = "Cup"

            print "perraco"
            if "00:" in fecha:
                fecha = fecha.replace("00:", "24:")
                print fecha
            info = "(" + liga + ")"
            time = re.compile('(\d+):(\d+)', re.DOTALL).findall(fecha)
            for horas, minutos in time:

                print "horas"
                print horas
                wrong_time = int(horas)
                value = 1
                correct_time = wrong_time - value
                correct_time = str(correct_time)
                ok_time = correct_time.zfill(2) + ":" + minutos
                fecha = re.sub(
                    r'(\d+):(\d+)|el|de|,|<span class="nameCon clear">', '',
                    fecha).strip()

                print "joder"
                print fecha
                d_m = re.compile('([^<]+) (\d+)', re.DOTALL).findall(fecha)

                print "opcion a"
                print d_m
                if len(d_m) == 0:
                    d_m = re.compile('(\d+) ([^<]+)', re.DOTALL).findall(fecha)
                    print "pasa a opcion b"
                for x, y in d_m:
                    if x.isdigit():
                        xbmc.log("opcion x=numero")
                        dia = x.strip()
                        mes = y.strip()
                        mes = translate(mes, "es")
                        mes = mes.title()
                        mes = re.sub(r'(?i)un |de |a |las ', '', mes)
                        mes = month_convert(mes)
                        mes = str(mes).zfill(2)
                        dia = str(dia).zfill(2)
                        xbmc.log(dia)
                        #xbmc.log(mes)
                        xbmc.log("pacoooo")
                    else:
                        xbmc.log("opcion x = letras")
                        xbmc.log(str(d_m))
                        mes = x.strip()
                        mes = translate(mes, "es")
                        mes = mes.title()
                        mes = re.sub(r'(?i)un |de |a |las ', '', mes)
                        mes = month_convert(mes)
                        mes = str(mes).zfill(2)
                        dia = y.strip()
                        dia = str(dia).zfill(2)
                        xbmc.log(dia)
                        xbmc.log(mes)
                        xbmc.log("pepeee")
                    dia_mes = (dia + "/" + mes)
                    date = dia_mes
                    time = ok_time
                    evento = re.compile(
                        '<span class="name fl"><span>(.*?)</span>').findall(
                            liga_fecha)
                    evento = " vs ".join(evento)
                    partido = "[COLOR khaki][B]" + dia_mes + "[/B][/COLOR]" + "[COLOR yellow][B]" + " - " + ok_time + "[/B][/COLOR]" + "--" + "[COLOR chocolate][B]" + title + "[/B][/COLOR]" + " " + "[COLOR lightslategray]" + info + "[/COLOR]"

                    itemlist2.append(
                        Item(channel=__channel__,
                             title=partido,
                             action="enlaces",
                             url=url,
                             thumbnail=urlparse.urljoin(host, thumbnail),
                             fanart=urlparse.urljoin(host, fanart),
                             fulltitle="[COLOR chocolate][B]" + title +
                             "[/B][/COLOR]",
                             date=date,
                             time=time,
                             evento=evento,
                             deporte="futbol",
                             context="info_partido",
                             folder=True))
    itemlist2.reverse()
    itemlist.extend(itemlist2)

    return itemlist
コード例 #22
0
ファイル: topbongda.py プロジェクト: Jmlaguna89/miNuevoRepo
def mainlist(item):
    logger.info("pelisalacarta.topbongda mainlist")
    itemlist = []
    
   
    if item.extra != "next_page":
       item.url = "http://topbongda.com"#/wendy/ajax/home_matches/?page=1"
       if not xbmc.Player().isPlaying():
          xbmc.executebuiltin('xbmc.PlayMedia('+song+')')
    data = dhe(get_page(item.url))
    data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;|&amp;","",data)
    #data = jsontools.load_json(data)

    patrongames= '<nav class="display-list">(.*?)<div class="match-block mdl-shadow--2dp ng-cloak" ng-repeat="match_block in match_data" ng-if="match_data.length > 0">'
    matchesgames= re.compile(patrongames,re.DOTALL).findall(data)
    for bloque_games in matchesgames:
        patrondaygames = '<i class="material-icons md-18">date_range</i>(.*?)<small>(.*?)</div></li></ul></div>'
        matchesdaygames =re.compile(patrondaygames,re.DOTALL).findall(bloque_games)
        for fecha, bloque_partidos in matchesdaygames:
            fecha = fecha.strip()
            #LIVE
            patronlive ='<span class="time">(.*?)</span>.*?<span class="minute">(.*?)<i class="playing">.*?<strong>(.*?)</strong>.*?<img src="/myaddrproxy.php/(.*?)".*?class="score">(.*?)</a>.*?<img src="/myaddrproxy.php/(.*?)" alt=""></a><strong>(.*?)</strong>.*?<a href="/myaddrproxy.php/(.*?)"'
            matcheslive=re.compile(patronlive,re.DOTALL).findall(bloque_partidos)
            for hora,minuto,team1,thumbnail,score,fanart,team2,url in matcheslive:
                thumbnail= re.sub(r"https","https:/",thumbnail)
                thumbnail= re.sub(r"_.*?\.",".",thumbnail)
                fanart= re.sub(r"https","https:/",fanart)
                fanart= re.sub(r"_.*?\.",".",fanart)
                minuto=minuto.strip()
                if "HT" in minuto:
                    minuto = "Descanso"
                title =  "[COLOR chartreuse][B]"+team1+"[/B][/COLOR]"+"[COLOR yellowgreen]__[/COLOR]"+"[COLOR yellow][B]"+score+"[/B][/COLOR]"+"[COLOR yellowgreen]__[/COLOR]"+"[COLOR chartreuse][B]"+team2+"[/B][/COLOR]"
                title = "[COLOR olivedrab]([/COLOR]"+"[COLOR yellowgreen][B]"+minuto+"[B][/COLOR]"+"[COLOR olivedrab])[/COLOR]"+" "+title+" "+"[COLOR crimson][B]LIVE!![/B][/COLOR]"
                url = re.sub(r"https/","http://",url)+"sopcast"
                url = re.sub(r"/ti-le","",url)
                if "default" in thumbnail :
                    thumbnail = "http://s6.postimg.org/bwlfc3fdd/topbongdafan.jpg"
                if "default" in fanart :
                    fanart = "http://s6.postimg.org/bwlfc3fdd/topbongdafan.jpg"
                itemlist.append( Item(channel=__channel__, title=title,action="enlaces",url = url,thumbnail=thumbnail,fanart="http://s6.postimg.org/bwlfc3fdd/topbongdafan.jpg", fulltitle= "[COLOR chartreuse][B]"+team1+" Vs "+team2+"[/B][/COLOR]",extra="LIVE",folder=True) )
            #NO LIVE
            patronnolive ='<div class="info"><span class="time">(\d+:\d+)</span><a href.*?class="league">(.*?)</a>.*?<strong>(.*?)</strong>.*?<img.*?"/myaddrproxy.php/(.*?)" alt="">.*?<img.*?"/myaddrproxy.php/(.*?)" alt=""></a><strong>(.*?)</strong>.*?<a href="/myaddrproxy.php/(.*?)" '
            matchesnolive=re.compile(patronnolive,re.DOTALL).findall(bloque_partidos)
            for hora,league,team1,thumbnail,fanart,team2,url in matchesnolive:
                
                thumbnail= re.sub(r"https","https:/",thumbnail)
                thumbnail= re.sub(r"_.*?\.",".",thumbnail)
                fanart= re.sub(r"https","https:/",fanart)
                fanart= re.sub(r"_.*?\.",".",fanart)
                
                from time import gmtime, strftime
                import time
                get_date=strftime("%Y-%m-%d %H:%M:%S", time.localtime())
                
                ok_date =re.compile('(\d+)-(\d+)-(\d+) (\d+:\d+:\d+)',re.DOTALL).findall(get_date)
                for year, mes, dia, current_hour in ok_date:
                   date =dia+"/"+mes+"/"+year
                   current_date = date
                
                if fecha == "Hôm Nay":
                   check_hour = scrapertools.get_match(current_hour,'(\d+):\d+')
                   if check_hour >= "19":
                      dates =re.compile('(\d+)(/\d+/\d+)',re.DOTALL).findall(date)
                      for d, m_y in dates:
                          days = int(d) +1
                          date = str(days) + m_y
                          extra ="nuevodia"
                   else:
                      date =date
                      
                elif fecha == "Ngày Mai":
                     check_hour = scrapertools.get_match(current_hour,'(\d+):\d+')
                     dates = re.compile('(\d+)(/\d+/\d+)',re.DOTALL).findall(date)
                     for d, m_y in dates:
                         # check_hour ="00"
                         if check_hour >= "19":
                            
                            days = int(d) +2
                            date = str(days) + m_y
                         else:
                            days = int(d) +1
                            date = str(days) + m_y
                     
                else:
                    check_hour = scrapertools.get_match(current_hour,'(\d+):\d+')
                    dates = re.compile('(\d+)(/\d+/\d+)',re.DOTALL).findall(fecha)
                    for d, m_y in dates:
                        if check_hour >= "19":
                            days = int(d) -1
                            date = str(days) + m_y
                        else:
                            date = fecha
                time= re.compile('(\d+):(\d+)',re.DOTALL).findall(hora)
                #Corregimos las 5h de diferencia horaria con Vietnam
                for horas, minutos in time:
                    if  horas== "00":
                        horas = horas.replace("00","24")
                        #if minutos != "00":
                        dates = re.compile('(\d+)(/\d+/\d+)',re.DOTALL).findall(date)
                        for d, m_y in dates:
                            days = int(d) - 1
                            date = str(days) + m_y
                    
                
                    check =re.compile('(\d)\d',re.DOTALL).findall(horas)
                    if "0"in check:
                        horas = horas.replace("0","")
                        horas = 24 + int(horas)
                        dates = re.compile('(\d+)(/\d+/\d+)',re.DOTALL).findall(date)
                        for d, m_y in dates:
                            days = int(d) - 1
                            date = str(days) + m_y

                    wrong_time =int(horas)
                    value = 5
                    correct_time = wrong_time - value

                    if correct_time > 24:
                       correct_time = int(correct_time) - 24
                       
                       dates = re.compile('(\d+)(/\d+/\d+)',re.DOTALL).findall(date)
                       for d, m_y in dates:
                           days = int(d) + 1
                           date = str(days) + m_y
                    correct_time = '%02d' % int(correct_time)

                    ok_time = correct_time +":"+ minutos
                if "24:" in ok_time:
                    ok_time =ok_time.replace("24:","00:")
                    dates = re.compile('(\d+)(/\d+/\d+)',re.DOTALL).findall(date)
                    for d, m_y in dates:
                        days = int(d) + 1
                        date = str(days) + m_y

                check_date =scrapertools.get_match(date,'(\d+)/\d+/\d+')
                check_date = check_date.strip()

                if int(check_date) < 10:
                   if "0" in (check_date):
                       continue

                   date = "0" + date
                if "Ngoại Hạng Anh" in league:
                    league = "Premier League"
                if "Hạng Nhất Anh" in league:
                    league = "Premier League"

                extra =ok_time+"|"+date
                title = team1+" Vs "+team2
                title ="[COLOR chartreuse]"+ok_time+"[/COLOR]" +"[COLOR olivedrab]--[/COLOR]"+"[COLOR gold]"+date+"[/COLOR]"+" "+"[COLOR seagreen][B]"+title+"[/B][/COLOR]" + " "+"[COLOR olivedrab]([/COLOR]"+"[COLOR yellowgreen]"+league+"[/COLOR]"+"[COLOR olivedrab])[/COLOR]"
                if "default" in thumbnail :
                    thumbnail = "http://s6.postimg.org/bwlfc3fdd/topbongdafan.jpg"
                if "default" in fanart :
                    fanart = "http://s6.postimg.org/bwlfc3fdd/topbongdafan.jpg"
                itemlist.append( Item(channel=__channel__, title=title,action="enlaces",url = url ,thumbnail=thumbnail,fanart=fanart, fulltitle= "[COLOR seagreen][B]"+team1+" Vs "+team2+"[/B][/COLOR]",extra =extra,folder=True) )
    
    
    return itemlist
コード例 #23
0
ファイル: divxtotal.py プロジェクト: CYBERxNUKE/xbmc-addon
def filmaffinity(item,infoLabels):
    title = infoLabels["title"].replace(" ", "+")
    try:
     year =  infoLabels["year"]
    except:
     year=""
    sinopsis = infoLabels["sinopsis"]
    
    if year== "":
       if  item.contentType!="movie":
          tipo = "serie"
          url_bing="http://www.bing.com/search?q=%s+Serie+de+tv+site:filmaffinity.com" % title
       else:
          tipo= "película"
          url_bing="http://www.bing.com/search?q=%s+site:filmaffinity.com" % title
       try:
        data = browser (url_bing)
        data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
        if "myaddrproxy.php" in data:
            subdata_bing = scrapertools.get_match(data,'li class="b_algo"><div class="b_title"><h2>(<a href="/myaddrproxy.php/http/www.filmaffinity.com/es/film.*?)"')
            subdata_bing = re.sub(r'\/myaddrproxy.php\/http\/','',subdata_bing)
        else:
            subdata_bing = scrapertools.get_match(data,'li class="b_algo"><h2>(<a href="http://www.filmaffinity.com/.*?/film.*?)"')
       
        url_filma = scrapertools.get_match(subdata_bing,'<a href="([^"]+)')
        if not "http" in url_filma:
            try:
             data=httptools.downloadpage("http://"+url_filma,cookies=False,timeout=1).data
            except:
             data=httptools.downloadpage("http://"+url_filma,cookies=False,timeout=1).data
        else:
            try:
             data=httptools.downloadpage(url_filma,cookies=False,timeout=1).data
            except:
             data=httptools.downloadpage(url_filma,cookies=False,timeout=1).data
        data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
       except:
           pass
    else:
      tipo = "Pelicula"
      url = "http://www.filmaffinity.com/es/advsearch.php?stext={0}&stype%5B%5D=title&country=&genre=&fromyear={1}&toyear={1}".format(title, year)
      data = httptools.downloadpage(url,cookies=False).data
      url_filmaf = scrapertools.find_single_match(data, '<div class="mc-poster">\s*<a title="[^"]*" href="([^"]+)"')
      if url_filmaf:
           url_filmaf = "http://www.filmaffinity.com%s" % url_filmaf
           data=httptools.downloadpage(url_filmaf,cookies=False).data
      else :
        if  item.contentType!="movie":
          tipo = "serie"
          url_bing="http://www.bing.com/search?q=%s+Serie+de+tv+site:filmaffinity.com" % title
        else:
          tipo= "película"
          url_bing="http://www.bing.com/search?q=%s+site:filmaffinity.com" % title
        try:
         data = browser (url_bing)
         data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
         if "myaddrproxy.php" in data:
            subdata_bing = scrapertools.get_match(data,'li class="b_algo"><div class="b_title"><h2>(<a href="/myaddrproxy.php/http/www.filmaffinity.com/es/film.*?)"')
            subdata_bing = re.sub(r'\/myaddrproxy.php\/http\/','',subdata_bing)
         else:
            subdata_bing = scrapertools.get_match(data,'li class="b_algo"><h2>(<a href="http://www.filmaffinity.com/.*?/film.*?)"')
       
         url_filma = scrapertools.get_match(subdata_bing,'<a href="([^"]+)')
         if not "http" in url_filma:
           data=httptools.downloadpage("http://"+url_filma,cookies=False).data
         else:
            data=httptools.downloadpage(url_filma,cookies=False).data
         data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
        except:
           pass
    sinopsis_f = scrapertools.find_single_match(data, '<dd itemprop="description">(.*?)</dd>')
    sinopsis_f = sinopsis_f.replace("<br><br />", "\n")
    sinopsis_f =re.sub(r"\(FILMAFFINITY\)<br />","",sinopsis_f)
    try:
        year_f = scrapertools.get_match(data,'<dt>Año</dt>.*?>(\d+)</dd>')
    except:
        year_f= ""
    try:
     rating_filma=scrapertools.get_match(data,'itemprop="ratingValue" content="(.*?)">')
    except:
     rating_filma = "Sin puntuacion"
    critica=""
    patron = '<div itemprop="reviewBody">(.*?)</div>.*?itemprop="author">(.*?)\s*<i alt="([^"]+)"'
    matches_reviews = scrapertools.find_multiple_matches(data, patron)

    if matches_reviews:
        for review, autor, valoracion in matches_reviews:
            review = dhe(scrapertools.htmlclean(review))
            review += "\n" + autor +"[CR]"
            review = re.sub(r'Puntuac.*?\)','',review)
            if "positiva" in valoracion:
                critica += "[COLOR green][B]%s[/B][/COLOR]\n" % review
            elif "neutral" in valoracion:
                critica += "[COLOR yellow][B]%s[/B][/COLOR]\n" % review
            else:
                critica += "[COLOR red][B]%s[/B][/COLOR]\n" % review
    else:
        critica = "[COLOR floralwhite][B]Esta %s no tiene críticas todavía...[/B][/COLOR]" % tipo

    return critica,rating_filma, year_f,sinopsis_f
コード例 #24
0
def scraper(item,paginacion=True):
    logger.info("pelisalacarta.sinluces peliculas")
    itemlist = []
   
    # Descarga la página
    data = dhe( scrapertools.cachePage(item.url) )
    data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
    
    patron = '<divclass="movie tooltip".*?title="(.*?)".*?<div class="imagen"> <img src="([^"]+)" '
    patron += 'alt="(.*?)\((.*?)\)".*?'
    patron += '<a href="([^"]+)".*?'
    patron += '<span class="icon-grade"></span>([^<]+)</div>'
    
    
    matches = re.compile(patron,re.DOTALL).findall(data)
    scrapertools.printMatches(matches)
    if len(matches)==0 and  not "Error 404" in data:
        itemlist.append( Item(channel=__channel__, title="[COLOR gold][B]No hay resultados...[/B][/COLOR]", thumbnail ="http://s6.postimg.org/55zljwr4h/sinnoisethumb.png", fanart ="http://s6.postimg.org/avfu47xap/sinnoisefan.jpg",folder=False) )
    
    
    for scrapedidioma, scrapedthumbnail, scrapedtitle, scrapedyear, scrapedurl, scrapedrate in matches:
        title_fan = scrapedtitle.strip()
        title_fan = re.sub(r'/.*','',title_fan)
        scrapedrate=scrapedrate.strip()
        if "N/A" in scrapedrate:
           scrapedrate = "Sin puntuación"
        if "castellano" in scrapedidioma:
            scrapedidioma= "[COLOR deepskyblue][B](Castellano) [/B][/COLOR]"
        elif "Subtitulada" in scrapedidioma:
            scrapedidioma = "[COLOR deepskyblue][B](Subtitulada) [/B][/COLOR]"
        else:
            scrapedidioma = "[COLOR deepskyblue][B](Latino) [/B][/COLOR]"
        scrapedrate = scrapedrate.replace(scrapedrate,"[COLOR blue][B]("+scrapedrate+")[/B][/COLOR]")
        scrapedtitle = scrapedtitle + scrapedidioma + scrapedrate
        scrapedtitle = scrapedtitle.replace(scrapedtitle,"[COLOR white]"+scrapedtitle+"[/COLOR]")
        trailer = title_fan + " " + scrapedyear + " trailer"
        trailer = urllib.quote(trailer)

        extra = title_fan+"|"+scrapedyear+"|"+trailer
        itemlist.append( Item(channel=__channel__, action="fanart", title=scrapedtitle , url=scrapedurl , thumbnail=scrapedthumbnail , extra= extra, viewmode="movie",  fanart="http://s6.postimg.org/mxrtns8lt/sinlucesfan2.jpg") )
        
        
    

    # Extrae el paginador
    ## Paginación
    try:
       if  "Error 404" in data:
            itemlist.append( Item(channel=__channel__, title="[COLOR gold][B]No hay mas paginas...[/B][/COLOR]", thumbnail ="http://s6.postimg.org/55zljwr4h/sinnoisethumb.png", fanart ="http://s6.postimg.org/avfu47xap/sinnoisefan.jpg",folder=False) )
       else:
           current_page_number = int(scrapertools.get_match(item.url,'page/(\d+)'))
           item.url = re.sub(r"page/\d+","page/{0}",item.url)
            
           next_page_number = current_page_number +1
           next_page = item.url.format(next_page_number)
                    
           title= "[COLOR skyblue]Pagina siguiente>>[/COLOR]"
           if  not "Error 404" in data:
              itemlist.append( Item(channel=__channel__, title=title, url=next_page, fanart="http://s30.postimg.org/4gugdsygx/sinlucesfan.jpg", thumbnail="http://s16.postimg.org/lvzzttkol/pelisvkflecha.png", action="scraper", folder=True) )
    except:
         pass

    return itemlist
コード例 #25
0
def mainlist(item):
    logger.info("deportesalacarta.livesportsws lista")
    itemlist = []
    import xbmc
    check=xbmc.getInfoLabel('ListItem.Title')
    
    if item.channel != __channel__:
        item.channel = __channel__
    else:
       if not xbmc.Player().isPlaying():
          xbmc.executebuiltin('xbmc.PlayMedia('+song+')')
    
    
    
    """
        Lo que ocurre con
        url = http://translate.googleusercontent.com/translate_c?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&usg=ALkJrhgzJfI1TDn3BxGgPbjgAHHS7J0i9g
        Redirecciones:
        1. http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/
        2. http://translate.googleusercontent.com/translate_p?nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&depth=2&usg=ALkJrhgAAAAAVupk4tLINTbmU7JrcQdl0G4V3LtnRM1n
        3. http://translate.googleusercontent.com/translate_c?depth=2&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&usg=ALkJrhhhRDwHSDRDN4t27cX5CYZLFFQtmA
        Lo que significa que necesitamos una key nueva cada vez en el argumento "usg" y para llegar a la url 3 debemos hacer la petición 1 y 2 con 'follow_redirects=False' o con la convinación de 'follow_redirects=False' y 'header_to_get="location"'
        """
    
    #### Opción 1: 'follow_redirects=False'
    ## Petición 1
    url = "http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://livesport.ws/football"
    data = dhe( scrapertools.downloadpage(url,follow_redirects=False) )#.decode('cp1251').encode('utf8')
    ## Petición 2
    url = scrapertools.get_match(data, ' src="([^"]+)" name=c ')
    data = dhe( scrapertools.downloadpage(url,follow_redirects=False) )#.decode('cp1251').encode('utf8')
    ## Petición 3
    url = scrapertools.get_match(data, 'URL=([^"]+)"')
    data = dhe( scrapertools.cachePage(url) )#.decode('cp1251').encode('utf8')
    """
        #### Opción 2: 'follow_redirects=False' y 'header_to_get="location"'
        ## Petición 1
        url = "http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/"
        data = dhe( scrapertools.downloadpage(url,follow_redirects=False) )#.decode('cp1251').encode('utf8')
        ## Petición 2
        url = scrapertools.get_match(data, ' src="([^"]+)" name=c ')
        url = scrapertools.get_header_from_response(url, header_to_get="location")
        ## Petición 3
        data = dhe( scrapertools.cachePage(url ) )#.decode('cp1251').encode('utf8')
        """
    
    
    
    patrondata = '</h1></div>(.*?)</h2>'
    matchesdata = re.compile(patrondata,re.DOTALL).findall(data)
    for bloque_data in matchesdata:
        
        for bloque_data in matchesdata:
            patrondaygame = '<span class=text>.*?<span class=text>(.*?)</span></a>(.*?)</span> --></li></ul></div>'
            matchesdaygame = re.compile(patrondaygame,re.DOTALL).findall(bloque_data)

            for day , bloque_games in matchesdaygame:
                day = re.sub(r"</span>|<i class=ico><span>de</span></i>|<span class=text>|de","",day)
                day = day.replace("actuales","Hoy")
                day = scrapertools.htmlclean(day)
                dia = scrapertools.get_match(day, '(\d+)')
                mes = re.sub(r"(?i)de |hoy |ayer |mañana |el |día ", "", day)
                mes = scrapertools.find_single_match(mes, '\d+\s*([A-z]+)')
                mes = mes.title()
                mes = month_convert(mes)
                mes = str(mes).zfill(2)
                
                if "hoy" in day or "Hoy" in day:
                    day = day.replace(day,"[COLOR yellow][B]"+day+"[/B][/COLOR]")
                elif "Ayer" in day or "ayer" in day:
                      day = day.replace(day,"[COLOR darkgoldenrod][B]"+day+"[/B][/COLOR]")
                else:
                     day = day.replace(day,"[COLOR greenyellow][B]"+day+"[/B][/COLOR]")
                itemlist.append( Item(channel=__channel__, title=day,action="mainlist",url="",fanart="http://www.easywallprints.com/upload/designs/background-with-soccer-balls-zoom-1.jpg",thumbnail="http://s6.postimg.org/3yl2y4adt/livesportagenda.png",folder=False) )
                
                patron = 'es&u=(.*?)&usg.*?id=event-(.*?)>(.*?)</i>.*?<span class=competition>.*?<span class=competition>(.*?)</span></a>.*?<i class="separator">.*?</span>(.*?)</span>.*?src=(.*?)>.*?src=(.*?)>.*?text-align: left">.*?</span>(.*?)</span>.*?<i class="live-broadcasting-status-(\d)"'#'<a class="link" href="([^"]+)" title="(.*?)".*?<span class="liga"><span>(.*?)</span></span>.*?<span class="date"><span>(.*?)</span></span>'
                matches = re.compile(patron,re.DOTALL).findall(bloque_games)
                for url_info,id_event, hora,competition,team1,thumbnail,fanart,team2 , status in matches:
                    team1 = re.sub(r"-"," ",team1)
                    team2=  re.sub(r"-"," ",team2)
                    competition = re.sub(r"\.","",competition)
                    
                    
                    if status == "4":
                        continue
                    
                    if "00:" in hora:
                        hora = hora.replace("00:","24:")
                    
                    if not "LIVE" in hora:
                       time= re.compile('(\d+):(\d+)',re.DOTALL).findall(hora)
                       for horas, minutos in time:
                           wrong_time =int(horas)
                           value = 2
                           correct_time = wrong_time - value
                           correct_time = str(correct_time)
                           hora = correct_time +":"+ minutos
                           
                           
                    
                
                    if "OFFLINE" in hora:
                        extra = hora
                        title = team1+"-"+team2+"____"
                        title = title.title()
                        fulltitle =title.replace(title,"[COLOR burlywood][B]"+title+"[/B][/COLOR]")
                        title= title.replace(title,"[COLOR burlywood]"+title+"[/COLOR]")
                        action = "mainlist"
                        folder = False
                        evento = ""
                        time = ""
                        fecha = ""
                    else:
                        if "hoy" in day or "Hoy" in day:
                            title = team1+" - "+team2
                            title = title.title()
                            fulltitle =title.replace(title,"[COLOR deepskyblue][B]"+title+"[/B][/COLOR]")
                            if "LIVE" in hora:
                               import time
                               
                               time = "live"
                               fecha = dia+"/"+str(mes)
                               fecha = fecha.strip()
                               evento = team1+" vs "+team2
                               extra= hora
                               hora = u'\u006C\u0456\u0475\u04BC!!'.encode('utf-8')
                               hora = hora.replace(hora,"[COLOR crimson][B]"+hora+"[/B][/COLOR]")
                               
                            else:
                                evento = team1+" vs "+team2
                                time = hora.strip()
                                fecha = dia+"/"+str(mes)
                                fecha = fecha.strip()
                                extra = hora
                                hora = hora.replace(hora,"[COLOR aquamarine][B]"+hora+"[/B][/COLOR]")
                          
                            title = hora+ "  " + title.replace(title,"[COLOR deepskyblue]"+title+"[/COLOR]")+ "[COLOR floralwhite]"+" "+"("+competition+")"+"[/COLOR]"
                            action = "enlaces"
                            folder = True
                        else:
                            title = team1+" - "+team2
                            evento = team1+" vs "+team2
                            time = hora
                            fecha = dia+"/"+mes
                            title = title.title()
                            fulltitle =title.replace(title,"[COLOR mediumaquamarine][B]"+title+"[/B][/COLOR]")
                            title = "[COLOR aquamarine][B]"+hora+"[/B][/COLOR]"+ "  " + title.replace(title,"[COLOR mediumaquamarine]"+title+"[/COLOR]")+ "[COLOR paleturquoise]"+" "+"("+competition+")"+"[/COLOR]"
                            action = "enlaces"
                            folder = True
                            
                    post_id = scrapertools.get_match(url_info,'http.*?livesport.ws\/(.*?)-')
                    url = "http://livesport.ws/engine/modules/sports/sport_refresh.php?from=event&event_id="+id_event+"&tab_id=0&post_id="+post_id
                    
                    itemlist.append( Item(channel=__channel__, title="     "+title,action=action,url=url,thumbnail =urlparse.urljoin(host,thumbnail),fanart =urlparse.urljoin(host,fanart),fulltitle = fulltitle,extra =extra,date=fecha, time=time, evento=evento, context="info_partido",deporte="futbol",folder=folder) )


        

    
    
    return itemlist
コード例 #26
0
ファイル: lfootballws.py プロジェクト: Jmlaguna89/miNuevoRepo
def mainlist(item):
    logger.info("pelisalacarta.lfootballws lista")
    itemlist = []
    import xbmc, time
    
    xbmc.executebuiltin('Notification([COLOR crimson][B]BIENVENIDOS A...[/B][/COLOR], [COLOR yellow][B]'+'livefootballws'.upper()+'[/B][/COLOR],4000,"http://4.bp.blogspot.com/-Jtkwjc049c0/T7CKiNujy-I/AAAAAAAARPc/llNdvg_8TWk/s1600/football_128x128.png")')
    xbmc.executebuiltin("Container.Update")
    
    if not xbmc.Player().isPlaying():
       xbmc.executebuiltin('xbmc.PlayMedia('+song+')')

    
    """
        Lo que ocurre con
        url = http://translate.googleusercontent.com/translate_c?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&usg=ALkJrhgzJfI1TDn3BxGgPbjgAHHS7J0i9g
        Redirecciones:
        1. http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/
        2. http://translate.googleusercontent.com/translate_p?nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&depth=2&usg=ALkJrhgAAAAAVupk4tLINTbmU7JrcQdl0G4V3LtnRM1n
        3. http://translate.googleusercontent.com/translate_c?depth=2&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&usg=ALkJrhhhRDwHSDRDN4t27cX5CYZLFFQtmA
        Lo que significa que necesitamos una key nueva cada vez en el argumento "usg" y para llegar a la url 3 debemos hacer la petición 1 y 2 con 'follow_redirects=False' o con la convinación de 'follow_redirects=False' y 'header_to_get="location"'
        """
    
    #### Opción 1: 'follow_redirects=False'
    ## Petición 1
    url = "http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/"
    data = dhe( scrapertools.downloadpage(url,follow_redirects=False) )#.decode('cp1251').encode('utf8')
    ## Petición 2
    url = scrapertools.get_match(data, ' src="([^"]+)" name=c ')
    data = dhe( scrapertools.downloadpage(url,follow_redirects=False) )#.decode('cp1251').encode('utf8')
    ## Petición 3
    url = scrapertools.get_match(data, 'URL=([^"]+)"')
    data = dhe( scrapertools.cachePage(url) )#.decode('cp1251').encode('utf8')
    
    """
        #### Opción 2: 'follow_redirects=False' y 'header_to_get="location"'
        ## Petición 1
        url = "http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/"
        data = dhe( scrapertools.downloadpage(url,follow_redirects=False) )#.decode('cp1251').encode('utf8')
        ## Petición 2
        url = scrapertools.get_match(data, ' src="([^"]+)" name=c ')
        url = scrapertools.get_header_from_response(url, header_to_get="location")
        ## Petición 3
        data = dhe( scrapertools.cachePage(url ) )#.decode('cp1251').encode('utf8')
        """
    
    
    
    #a:
    
    patronmain ='transmisión en vivo(.*?)<h3 class=sectionName> '
    matchesmain = re.compile(patronmain,re.DOTALL).findall(data)
    for main in matchesmain:
        print "liveeee"
        print main
        patron = '<img class=img src=(.*?) alt.*?<img class=img src=(.*?) alt.*?<a class=link href=.*?&u=.*?href.*?&u=(.*?)&usg.*?title="(.*?)"'#'<a class="link" href="([^"]+)" title="(.*?)".*?<span class="liga"><span>(.*?)</span></span>.*?<span class="date"><span>(.*?)</span></span>'
        matches = re.compile(patron,re.DOTALL).findall(main)
        for thumbnail, fanart,url,title in matches:
            #liga = re.sub(r'<span.*?">|</span>|class=.*?>|<span>.*?<span|<span.*?|>|<a.*?','',liga)
            #if "и" in liga:
            #   liga = "La liga"
    
            
            
            
            #info = "("+liga+")"
            title = "[COLOR chocolate][B]"+title +"[/B][/COLOR]" +" "+ "[COLOR crimson][B]EN VIVO!![/B][/COLOR]"
            print "lolo"
            print title
            print url
            itemlist.append( Item(channel=__channel__, title=title,action="enlaces",url=url,thumbnail =urlparse.urljoin(host,thumbnail),fanart =urlparse.urljoin(host,fanart),fulltitle = title,folder=True) )

    #b
    patronmain ='nuestra(.*?)partido'
    matchesmain = re.compile(patronmain,re.DOTALL).findall(data)
    print "ojuuu"
    print matchesmain
    
    
    for main in matchesmain:
    
        patron = '<img class=img src=([^"]+) alt.*?src=([^"]+) '
        patron +='.*?<a class=link href=.*?&u=.*?href.*?&u=([^"]+)&usg.*?'
        patron +='title="([^<]+)".*?'
        patron +='<span class="nameCon clear">(.*?)</li><li class=fl>'
        
        matches = re.compile(patron,re.DOTALL).findall(main)
        if len(matches)==0 :
           itemlist.append( Item(channel=__channel__, title="[COLOR orange][B]No hay encuentros previstos en estos momentos[/B][/COLOR]",thumbnail ="http://s6.postimg.org/619q91s41/comingsoon.png",fanart ="http://s6.postimg.org/7ucmxddap/soccer_field_desktop_20150703154119_5596ad1fde3e.jpg") )
        for thumbnail, fanart, url,title,liga_fecha in matches:
            print "zorro"
            print liga_fecha
            #liga = re.sub(r'<span.*?">|</span>|class=.*?>|<span>.*?<span|<span.*?|>|<a.*?','',liga)
            try:
                liga = scrapertools.get_match(liga_fecha,'<span class=liga><span>([^<]+)')
                liga = re.sub(r'de','',liga)
                fecha = re.sub(r'<span class=liga><span>.*?</span></span>|<span class="name fl"><span>.*?</span></span></span>|<span class=dopCon>.*?<span class=date><span>|<span class=date><span>|</span>|</a>|de|,|','',liga_fecha)
            except:
                liga=""
                
                fecha = scrapertools.get_match(liga_fecha,'<span class=dopCon><span class=date><span>([^<]+)</span>')
            if "taza" in liga:
                liga="Cup"

            print "perraco"
            if "00:" in fecha:
               fecha = fecha.replace("00:","24:")
               print fecha
            info = "("+liga+")"
            time= re.compile('(\d+):(\d+)',re.DOTALL).findall(fecha)
            for horas, minutos in time:
                
                print "horas"
                print horas
                wrong_time =int(horas)
                value = 1
                correct_time = wrong_time - value
                correct_time = str(correct_time)
                ok_time = correct_time +":"+ minutos
                fecha = re.sub(r'(\d+):(\d+)|el|de|,|<span class="nameCon clear">','',fecha).strip()
                
                print "joder"
                print fecha
                d_m = re.compile('([^<]+) (\d+)',re.DOTALL).findall(fecha)
                print "opcion a"
                print d_m
                if len(d_m)==0 :
                    d_m = re.compile('(\d+) ([^<]+)',re.DOTALL).findall(fecha)
                    print "pasa a opcion b"
                for x, y in d_m:
                    if x.isdigit():
                       print "opcion x=numero"
                       dia = x.strip()
                       mes = y.strip()
                    else:
                       print "opcion x = letras"
                       print d_m
                       mes = x.strip()
                       dia = y.strip()
    
                    dia_mes = (dia+" "+mes).title()
                    partido = "[COLOR khaki][B]"+dia_mes+"[/B][/COLOR]" +"[COLOR yellow][B]"+" "+ok_time+"[/B][/COLOR]"+"--"+"[COLOR chocolate][B]"+title +"[/B][/COLOR]"+" "+"[COLOR lightslategray]"+ info +"[/COLOR]"
                    
                    itemlist.append( Item(channel=__channel__, title=partido,action="enlaces",url=url,thumbnail =urlparse.urljoin(host,thumbnail),fanart =urlparse.urljoin(host,fanart), fulltitle= "[COLOR chocolate][B]"+title +"[/B][/COLOR]", folder=True) )
        

    
    
    return itemlist
コード例 #27
0
def filmaffinity(item,infoLabels):
    title = infoLabels["title"].replace(" ", "+")
    try:
     year =  infoLabels["year"]
    except:
     year=""
    sinopsis = infoLabels["sinopsis"]
    
    if year== "":
       if  item.contentType!="movie":
          tipo = "serie"
          url_bing="http://www.bing.com/search?q=%s+Serie+de+tv+site:filmaffinity.com" % title
       else:
          tipo= "película"
          url_bing="http://www.bing.com/search?q=%s+site:filmaffinity.com" % title
       try:
        data = browser (url_bing)
        data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
        if "myaddrproxy.php" in data:
            subdata_bing = scrapertools.get_match(data,'li class="b_algo"><div class="b_title"><h2>(<a href="/myaddrproxy.php/http/www.filmaffinity.com/es/film.*?)"')
            subdata_bing = re.sub(r'\/myaddrproxy.php\/http\/','',subdata_bing)
        else:
            subdata_bing = scrapertools.get_match(data,'li class="b_algo"><h2>(<a href="http://www.filmaffinity.com/.*?/film.*?)"')
       
        url_filma = scrapertools.get_match(subdata_bing,'<a href="([^"]+)')
        if not "http" in url_filma:
            try:
             data=httptools.downloadpage("http://"+url_filma,cookies=False,timeout=1).data
            except:
             data=httptools.downloadpage("http://"+url_filma,cookies=False,timeout=1).data
        else:
            try:
             data=httptools.downloadpage(url_filma,cookies=False,timeout=1).data
            except:
             data=httptools.downloadpage(url_filma,cookies=False,timeout=1).data
        data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
       except:
           pass
    else:
      tipo = "Pelicula"
      url = "http://www.filmaffinity.com/es/advsearch.php?stext={0}&stype%5B%5D=title&country=&genre=&fromyear={1}&toyear={1}".format(title, year)
      data = httptools.downloadpage(url,cookies=False).data
      url_filmaf = scrapertools.find_single_match(data, '<div class="mc-poster">\s*<a title="[^"]*" href="([^"]+)"')
      if url_filmaf:
           url_filmaf = "http://www.filmaffinity.com%s" % url_filmaf
           data=httptools.downloadpage(url_filmaf,cookies=False).data
      else :
        if  item.contentType!="movie":
          tipo = "serie"
          url_bing="http://www.bing.com/search?q=%s+Serie+de+tv+site:filmaffinity.com" % title
        else:
          tipo= "película"
          url_bing="http://www.bing.com/search?q=%s+site:filmaffinity.com" % title
        try:
         data = browser (url_bing)
         data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
         if "myaddrproxy.php" in data:
            subdata_bing = scrapertools.get_match(data,'li class="b_algo"><div class="b_title"><h2>(<a href="/myaddrproxy.php/http/www.filmaffinity.com/es/film.*?)"')
            subdata_bing = re.sub(r'\/myaddrproxy.php\/http\/','',subdata_bing)
         else:
            subdata_bing = scrapertools.get_match(data,'li class="b_algo"><h2>(<a href="http://www.filmaffinity.com/.*?/film.*?)"')
       
         url_filma = scrapertools.get_match(subdata_bing,'<a href="([^"]+)')
         if not "http" in url_filma:
           data=httptools.downloadpage("http://"+url_filma,cookies=False).data
         else:
            data=httptools.downloadpage(url_filma,cookies=False).data
         data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
        except:
           pass
    sinopsis_f = scrapertools.find_single_match(data, '<dd itemprop="description">(.*?)</dd>')
    sinopsis_f = sinopsis_f.replace("<br><br />", "\n")
    sinopsis_f =re.sub(r"\(FILMAFFINITY\)<br />","",sinopsis_f)
    try:
        year_f = scrapertools.get_match(data,'<dt>Año</dt>.*?>(\d+)</dd>')
    except:
        year_f= ""
    try:
     rating_filma=scrapertools.get_match(data,'itemprop="ratingValue" content="(.*?)">')
    except:
     rating_filma = "Sin puntuacion"
    critica=""
    patron = '<div itemprop="reviewBody">(.*?)</div>.*?itemprop="author">(.*?)\s*<i alt="([^"]+)"'
    matches_reviews = scrapertools.find_multiple_matches(data, patron)

    if matches_reviews:
        for review, autor, valoracion in matches_reviews:
            review = dhe(scrapertools.htmlclean(review))
            review += "\n" + autor +"[CR]"
            review = re.sub(r'Puntuac.*?\)','',review)
            if "positiva" in valoracion:
                critica += "[COLOR green][B]%s[/B][/COLOR]\n" % review
            elif "neutral" in valoracion:
                critica += "[COLOR yellow][B]%s[/B][/COLOR]\n" % review
            else:
                critica += "[COLOR red][B]%s[/B][/COLOR]\n" % review
    else:
        critica = "[COLOR floralwhite][B]Esta %s no tiene críticas todavía...[/B][/COLOR]" % tipo

    return critica,rating_filma, year_f,sinopsis_f
コード例 #28
0
def findvideos(item):
    logger.info()
    itemlist = []
    data = get_source(item.url)

    if not "serie" in item.url:
        thumbnail = item.category
    else:
        thumbnail = ''

    patronbloque_enlaces = '<div class="detail_content_subtitle">(.*?)<\/div>(.*?)<div class="torrent_sep">'
    matchesenlaces = re.compile(patronbloque_enlaces, re.DOTALL).findall(data)
    if len(matchesenlaces) == 0:
        thumb = ""
        check = ""
        itemlist.append(
            Item(channel=item.channel, title="[COLOR crimson][B]No hay Torrent[/B][/COLOR]", action="mainlist", url="",
                 fanart=item.show.split("|")[0], thumbnail=thumbnail, folder=False))
    for calidad_bloque, bloque_enlaces in matchesenlaces:
        calidad_bloque = dhe(calidad_bloque)
        calidad_bloque = ''.join((c for c in unicodedata.normalize('NFD', unicode(calidad_bloque.decode('utf-8'))) if
                                  unicodedata.category(c) != 'Mn'))
        if "Alta" in calidad_bloque:
            title = 'Alta Definicion'
            title = "                                           [COLOR yellow][B]" + title + "[/B][/COLOR]"
        elif "estandar" in calidad_bloque:
            title = 'Definicion Estandar'
            title = "                                       [COLOR mediumaquamarine][B]" + title + "[/B][/COLOR]"
        else:
            title = 'Screener'
            title = "                                                  [COLOR slategray][B]" + title + "[/B][/COLOR]"
        itemlist.append(
            Item(channel=item.channel, title=title, action="mainlist", url="", fanart=item.show.split("|")[0],
                 thumbnail=thumbnail, folder=False))
        if "serie" in item.url:
            thumb = scrapertools.get_match(data, '<div class="detail_background2".*?url\(([^"]+)\)')
            patron = '\:showDownload.*?(http.*?)\''
            matches = re.compile(patron, re.DOTALL).findall(bloque_enlaces)
            for url in matches:
                calidad = ""
                try:
                    if not url.endswith(".torrent") and not "elitetorrent" in url:
                        if url.endswith("fx"):
                            url = httptools.downloadpage(url, follow_redirects=False)
                            url = url.headers.get("location")
                            if url.endswith(".fx"):
                                url = httptools.downloadpage(url, follow_redirects=False)
                                url = url.headers.get("location")

                            url = " http://estrenosli.org" + url

                        else:
                            if not url.endswith(".mkv"):
                                url = httptools.downloadpage(url, follow_redirects=False)
                                url = url.headers.get("location")

                    torrents_path = config.get_videolibrary_path() + '/torrents'

                    if not os.path.exists(torrents_path):
                        os.mkdir(torrents_path)
                    try:
                        urllib.URLopener.version = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36 SE 2.X MetaSr 1.0'
                        urllib.urlretrieve(url, torrents_path + "/temp.torrent")
                        pepe = open(torrents_path + "/temp.torrent", "rb").read()
                    except:
                        pepe = ""
                    if "used CloudFlare" in pepe:
                        try:
                            urllib.urlretrieve("http://anonymouse.org/cgi-bin/anon-www.cgi/" + url.strip(),
                                               torrents_path + "/temp.torrent")
                            pepe = open(torrents_path + "/temp.torrent", "rb").read()
                        except:
                            pepe = ""
                    torrent = decode(pepe)
                    logger.debug('el torrent %s' % torrent)
                    try:
                        name = torrent["info"]["name"]
                        sizet = torrent["info"]['length']
                        sizet = convert_size(sizet)
                    except:
                        name = "no disponible"
                    try:
                        check_video = scrapertools.find_multiple_matches(str(torrent["info"]["files"]),
                                                                         "'length': (\d+)}")
                        size = max([int(i) for i in check_video])
                        for file in torrent["info"]["files"]:
                            manolo = "%r - %d bytes" % ("/".join(file["path"]), file["length"])
                            if str(size) in manolo:
                                video = manolo
                        size = convert_size(size)
                        ext_v = re.sub(r"-.*? bytes|.*?\[.*?\].|'|.*?COM.|.*?\[.*?\]|\(.*?\)|.*?\.", "", video)
                        try:
                            os.remove(torrents_path + "/temp.torrent")
                        except:
                            pass
                    except:
                        size = sizet
                        ext_v = re.sub(r"-.*? bytes|.*?\[.*?\].|'|.*?COM.|.*?\.es.|.*?\[.*?\]|.*?\(.*?\)\.|.*?\.", "",
                                       name)
                        try:
                            os.remove(torrents_path + "/temp.torrent")
                        except:
                            pass
                except:
                    size = "en estos momentos..."
                    ext_v = "no disponible"
                if "Alta" in calidad_bloque:
                    title = "[COLOR navajowhite][B]" + calidad + "[/B][/COLOR]" + " " + "[COLOR peachpuff]( Video [/COLOR]" + "[COLOR peachpuff]" + ext_v + " -- " + size + " )[/COLOR]"
                elif "estandar" in calidad_bloque:
                    title = "[COLOR lavender][B]" + calidad + "[/B][/COLOR]" + " " + "[COLOR azure]( Video [/COLOR]" + "[COLOR azure]" + ext_v + " -- " + size + " )[/COLOR]"
                else:
                    title = "[COLOR gainsboro][B]" + calidad + "[/B][/COLOR]" + " " + "[COLOR silver]( Video [/COLOR]" + "[COLOR silver]" + ext_v + " -- " + size + " )[/COLOR]"
                if "rar" in ext_v:
                    ext_v = ext_v + " -- No reproducible"
                    size = ""
                item.title = re.sub(r"\[.*?\]", "", item.title)
                temp_epi = scrapertools.find_multiple_matches(item.title, '(\d+)x(\d+)')
                for temp, epi in temp_epi:
                    check = temp + "x" + epi
                    if item.extra.split("|")[0] == "fv2":
                        extra = item.extra.split("|")[1] + "|" + " " + "|" + temp + "|" + epi
                    else:
                        extra = item.extra + "|" + temp + "|" + epi

                    itemlist.append(Item(channel=item.channel, title=title, action="play", url=url, server="torrent",
                                         thumbnail=thumbnail, extra=item.extra, show=item.show,
                                         fanart=item.show.split("|")[0], folder=False))
        else:
            patron = '<a href=.*?(http.*?)\'\).*?<i>(.*?)<i>(.*?)<\/i>'
            matches = re.compile(patron, re.DOTALL).findall(bloque_enlaces)
            for url, calidad, peso in matches:
                try:
                    if not url.endswith(".torrent") and not "elitetorrent" in url:
                        if url.endswith("fx"):
                            url = httptools.downloadpage(url, follow_redirects=False)
                            url = url.headers.get("location")
                            if url.endswith(".fx"):
                                url = httptools.downloadpage(url, follow_redirects=False)
                                url = url.headers.get("location")
                            url = " http://estrenosli.org" + url
                        else:
                            if not url.endswith(".mkv"):
                                url = httptools.downloadpage(url, follow_redirects=False)
                                url = url.headers.get("location")
                    torrents_path = config.get_videolibrary_path() + '/torrents'
                    if not os.path.exists(torrents_path):
                        os.mkdir(torrents_path)
                    urllib.URLopener.version = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36 SE 2.X MetaSr 1.0'
                    urllib.urlretrieve(url, torrents_path + "/temp.torrent")
                    pepe = open(torrents_path + "/temp.torrent", "rb").read()
                    if "used CloudFlare" in pepe:
                        try:
                            urllib.urlretrieve("http://anonymouse.org/cgi-bin/anon-www.cgi/" + url.strip(),
                                               torrents_path + "/temp.torrent")
                            pepe = open(torrents_path + "/temp.torrent", "rb").read()
                        except:
                            pepe = ""
                    torrent = decode(pepe)
                    try:
                        name = torrent["info"]["name"]
                    except:
                        name = "no disponible"
                    try:
                        check_video = scrapertools.find_multiple_matches(str(torrent["info"]["files"]),
                                                                         "'length': (\d+)}")
                        size = max([int(i) for i in check_video])
                        for file in torrent["info"]["files"]:
                            manolo = "%r - %d bytes" % ("/".join(file["path"]), file["length"])
                            if str(size) in manolo:
                                video = manolo
                        ext_v = re.sub(r"-.*? bytes|\.*?\[.*?\]\.|'|\.*?COM.|.*?\[.*?\]|\(.*?\)|.*?\.", "", video)
                        try:
                            os.remove(torrents_path + "/temp.torrent")
                        except:
                            pass
                    except:
                        ext_v = re.sub(r"-.*? bytes|.*?\[.*?\].|'|.*?COM.|.*?\.es\.|.*?\[.*?\]|.*?\(.*?\)\.|.*?\.", "",
                                       name)
                        try:
                            os.remove(torrents_path + "/temp.torrent")
                        except:
                            pass
                except:
                    size = "en estos momentos..."
                    ext_v = "no disponible"
                if "rar" in ext_v:
                    ext_v = ext_v + " -- No reproducible"
                calidad = re.sub(r"</i>", "", calidad)
                if "Alta" in calidad_bloque:
                    title = "[COLOR khaki][B]" + calidad + "[/B][/COLOR]" + "[COLOR darkkhaki][B]" + " -  " + peso + "[/B][/COLOR]" + " " + "[COLOR lemonchiffon]( Video [/COLOR]" + "[COLOR lemonchiffon]" + ext_v + " )[/COLOR]"
                elif "estandar" in calidad_bloque:
                    title = "[COLOR darkcyan][B]" + calidad + "[/B][/COLOR]" + "[COLOR cadetblue][B]" + " -  " + peso + "[/B][/COLOR]" + " " + "[COLOR paleturquoise]( Video [/COLOR]" + "[COLOR paleturquoise]" + ext_v + " )[/COLOR]"
                else:
                    title = "[COLOR dimgray][B]" + calidad + "[/B][/COLOR]" + "[COLOR gray][B]" + " -  " + peso + "[/B][/COLOR]" + " " + "[COLOR lightslategray]( Video [/COLOR]" + "[COLOR lightslategray]" + ext_v + " )[/COLOR]"
                itemlist.append(Item(channel=item.channel, title=title, action="play", url=url, server="torrent",
                                     thumbnail=thumbnail, extra=item.extra, show=item.show,
                                     fanart=item.show.split("|")[0], folder=False))
    if "serie" in item.url and item.extra.split("|")[0] != "fv2":
        title_info = 'Temporadas'
        title_info = "[COLOR springgreen][B]" + title_info + "[/B][/COLOR]"
        itemlist.append(Item(channel=item.channel, title="                                             " + title_info,
                             action="mainlist", url="", fanart=item.show.split("|")[0], thumbnail=thumbnail,
                             folder=False))
        data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;", "", data)
        patron = 'class="contactlinkh">(.*?)<\/a><\/div>(.*?)</div></div></div>'
        matches = re.compile(patron, re.DOTALL).findall(data)
        for temporadas, bloque_capitulos in matches:
            thumbnail = scrapertools.get_match(bloque_capitulos, 'background-image:url\(\'([^"]+)\'')
            thumbnail = re.sub(r"w185", "original", thumbnail)
            itemlist.append(Item(channel=item.channel, title="[COLOR chartreuse][B]" + temporadas + "[/B][/COLOR]",
                                 action="capitulos", url=item.url, thumbnail=thumbnail,
                                 extra="fv2" + "|" + bloque_capitulos + "|" + thumb + "|" + item.extra + "|" + check,
                                 show=item.show, fanart=item.show.split("|")[0], category=item.category, folder=True))
    return itemlist
コード例 #29
0
def fanart(item):
    logger.info("pelisalacarta.peliculasdk fanart")
    itemlist = []
    url = item.url
    data = scrapertools.cachePage(url)
    data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
    title_fan = item.extra.split("|")[1]
    title = re.sub(r'Serie Completa|Temporada.*?Completa','',title_fan)
    fulltitle=title
    title= title.replace(' ','%20')
    title = ''.join((c for c in unicodedata.normalize('NFD',unicode(title.decode('utf-8'))) if unicodedata.category(c) != 'Mn'))
    try:
     sinopsis =scrapertools.find_single_match(data,'<span class="clms">Sinopsis: <\/span>(.*?)<\/div>')
    except:
     sinopsis= ""
    year =item.extra.split("|")[0]
   
    if not "series" in item.url:
        
        #filmafinity
        url = "http://www.filmaffinity.com/es/advsearch.php?stext={0}&stype%5B%5D=title&country=&genre=&fromyear={1}&toyear={1}".format(title, year)
        data = scrapertools.downloadpage(url)

        url_filmaf = scrapertools.find_single_match(data, '<div class="mc-poster">\s*<a title="[^"]*" href="([^"]+)"')
        if url_filmaf:
           url_filmaf = "http://www.filmaffinity.com%s" % url_filmaf
           data = scrapertools.downloadpage(url_filmaf)
        else:

               try:
                 url_bing="http://www.bing.com/search?q=%s+%s+site:filmaffinity.com" %  (title.replace(' ', '+'),  year)
                 data = browser (url_bing)
                 data = re.sub(r'\n|\r|\t|\s{2}|&nbsp;','',data)

                 if "myaddrproxy.php" in data:
                     subdata_bing = scrapertools.get_match(data,'li class="b_algo"><div class="b_title"><h2>(<a href="/ myaddrproxy.php/http/www.filmaffinity.com/es/film.*?)"')
                     subdata_bing = re.sub(r'\/myaddrproxy.php\/http\/','',subdata_bing)
                 else:
                     subdata_bing = scrapertools.get_match(data,'li class="b_algo"><h2>(<a href="http://www.filmaffinity.com/es/film.*?)"')
    
                 url_filma = scrapertools.get_match(subdata_bing,'<a href="([^"]+)')
                 
                 if not "http" in url_filma:
                    data = scrapertools.cachePage ("http://"+url_filma)
                 else:
                    data = scrapertools.cachePage (url_filma)
                 data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
            
               except:
                 pass
    
        if sinopsis == " ":
           try:
            sinopsis = scrapertools.find_single_match(data, '<dd itemprop="description">(.*?)</dd>')
            sinopsis = sinopsis.replace("<br><br />", "\n")
            sinopsis=re.sub(r"\(FILMAFFINITY\)<br />","",sinopsis)
           except:
              pass
        try:
            rating_filma=scrapertools.get_match(data,'itemprop="ratingValue" content="(.*?)">')
        except:
            rating_filma = "Sin puntuacion"
        
        critica=""
        patron = '<div itemprop="reviewBody">(.*?)</div>.*?itemprop="author">(.*?)\s*<i alt="([^"]+)"'
        matches_reviews = scrapertools.find_multiple_matches(data, patron)

        if matches_reviews:
            for review, autor, valoracion in matches_reviews:
                review = dhe(scrapertools.htmlclean(review))
                review += "\n" + autor +"[CR]"
                review = re.sub(r'Puntuac.*?\)','',review)
                if "positiva" in valoracion:
                    critica += "[COLOR green][B]%s[/B][/COLOR]\n" % review
                elif "neutral" in valoracion:
                    critica += "[COLOR yellow][B]%s[/B][/COLOR]\n" % review
                else:
                    critica += "[COLOR red][B]%s[/B][/COLOR]\n" % review
        else:
             critica = "[COLOR floralwhite][B]Esta película no tiene críticas todavía...[/B][/COLOR]"
        print "ozuu"
        print critica
    
        url="http://api.themoviedb.org/3/search/movie?api_key=2e2160006592024ba87ccdf78c28f49f&query=" + title +"&year="+year+ "&language=es&include_adult=false"
        data = scrapertools.cachePage(url)
        data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
        patron = '"page":1.*?,"id":(.*?),.*?"backdrop_path":(.*?),"popularity"'
        matches = re.compile(patron,re.DOTALL).findall(data)
        
        
        if len(matches)==0:
                
                
                title= re.sub(r":.*|\(.*?\)","",title)
                url="http://api.themoviedb.org/3/search/movie?api_key=2e2160006592024ba87ccdf78c28f49f&query=" + title + "&language=es&include_adult=false"
                
                data = scrapertools.cachePage(url)
                data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
                patron = '"page":1.*?,"id":(.*?),.*?"backdrop_path":(.*?),"popularity"'
                matches = re.compile(patron,re.DOTALL).findall(data)
                if len(matches)==0:
                    extra=item.thumbnail+"|"+""+"|"+""+"|"+"Sin puntuación"+"|"+rating_filma+"|"+critica
                    show= item.fanart+"|"+""+"|"+sinopsis
                    posterdb = item.thumbnail
                    fanart_info = item.fanart
                    fanart_3 = ""
                    fanart_2 = item.fanart
                    category= item.thumbnail
                    id_scraper=""
                        
                    itemlist.append( Item(channel=item.channel, title=item.title, url=item.url, action="findvideos", thumbnail=item.thumbnail, fanart=item.fanart,extra = extra, show= show, category= category,library=item.library,fulltitle=fulltitle,folder=True) )
    
        for id, fan in matches:
            
            fan = re.sub(r'\\|"','',fan)
            
            try:
                rating = scrapertools.find_single_match(data,'"vote_average":(.*?)}')
            except:
                rating = "Sin puntuación"
            
            id_scraper =id+"|"+"peli"+"|"+rating+"|"+rating_filma+"|"+critica
            try:
                posterdb = scrapertools.get_match(data,'"page":1,.*?"poster_path":"\\\(.*?)"')
                posterdb =  "https://image.tmdb.org/t/p/original" + posterdb
            except:
                posterdb = item.thumbnail

            if "null" in fan:
                fanart = item.fanart
            else:
                fanart="https://image.tmdb.org/t/p/original" + fan
            item.extra= fanart
            
            url ="http://api.themoviedb.org/3/movie/"+id+"/images?api_key=2e2160006592024ba87ccdf78c28f49f"
            data = scrapertools.cachePage(url)
            data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
            
            patron = '"backdrops".*?"file_path":".*?",.*?"file_path":"(.*?)",.*?"file_path":"(.*?)",.*?"file_path":"(.*?)"'
            matches = re.compile(patron,re.DOTALL).findall(data)

            if len(matches) == 0:
              patron = '"backdrops".*?"file_path":"(.*?)",.*?"file_path":"(.*?)",.*?"file_path":"(.*?)"'
              matches = re.compile(patron,re.DOTALL).findall(data)
              if len(matches) == 0:
                  fanart_info = item.extra
                  fanart_3 = ""
                  fanart_2 = item.extra
            for fanart_info, fanart_3, fanart_2 in matches:
                fanart_info = "https://image.tmdb.org/t/p/original" + fanart_info
                fanart_3 = "https://image.tmdb.org/t/p/original" + fanart_3
                fanart_2 = "https://image.tmdb.org/t/p/original" + fanart_2
                if fanart== item.fanart:
                   fanart= fanart_info
            #clearart, fanart_2 y logo
            url ="http://webservice.fanart.tv/v3/movies/"+id+"?api_key=dffe90fba4d02c199ae7a9e71330c987"
            data = scrapertools.cachePage(url)
            data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
            patron = '"hdmovielogo":.*?"url": "([^"]+)"'
            matches = re.compile(patron,re.DOTALL).findall(data)
        
            if '"moviedisc"' in data:
                disc = scrapertools.get_match(data,'"moviedisc":.*?"url": "([^"]+)"')
            if '"movieposter"' in data:
                poster = scrapertools.get_match(data,'"movieposter":.*?"url": "([^"]+)"')
            if '"moviethumb"' in data:
                thumb = scrapertools.get_match(data,'"moviethumb":.*?"url": "([^"]+)"')
            if '"moviebanner"' in data:
                banner= scrapertools.get_match(data,'"moviebanner":.*?"url": "([^"]+)"')
        
            if len(matches)==0:
                extra=  posterdb
                #"http://es.seaicons.com/wp-content/uploads/2015/11/Editing-Overview-Pages-1-icon.png"
                show =fanart_2+"|"+fanart_3+"|"+sinopsis
                category = posterdb
                        
                itemlist.append( Item(channel=item.channel, title = item.title , action="findvideos", url=item.url, server="torrent", thumbnail=posterdb, fanart=item.extra, extra=extra, show=show, category= category, library=item.library,fulltitle=fulltitle,folder=True) )
            for logo in matches:
                if '"hdmovieclearart"' in data:
                    clear=scrapertools.get_match(data,'"hdmovieclearart":.*?"url": "([^"]+)"')
                    if '"moviebackground"' in data:
                    
                        extra=clear
                        show= fanart_2+"|"+fanart_3+"|"+sinopsis
                        if '"moviedisc"' in data:
                            category= disc
                        else:
                            category= clear
                        itemlist.append( Item(channel=item.channel, title = item.title , action="findvideos", url=item.url, server="torrent", thumbnail=logo, fanart=item.extra, extra=extra,show=show,  category= category,library=item.library,fulltitle=fulltitle,folder=True) )
                    else:
                        extra= clear
                        show=fanart_2+"|"+fanart_3+"|"+sinopsis
                        if '"moviedisc"' in data:
                            category= disc
                        else:
                            category= clear
                        itemlist.append( Item(channel=item.channel, title = item.title , action="findvideos", url=item.url, server="torrent", thumbnail=logo, fanart=item.extra, extra=extra,show=show,  category= category,library=item.library, fulltitle=fulltitle,folder=True) )
                                                                                                
                if '"moviebackground"' in data:
                                                                                                    
                    if '"hdmovieclearart"' in data:
                        clear=scrapertools.get_match(data,'"hdmovieclearart":.*?"url": "([^"]+)"')
                        extra=clear
                        show= fanart_2+"|"+fanart_3+"|"+sinopsis
                        if '"moviedisc"' in data:
                            category= disc
                        else:
                            category= clear
                    else:
                        extra=logo
                        show= fanart_2+"|"+fanart_3+"|"+sinopsis
                        if '"moviedisc"' in data:
                            category= disc
                        else:
                            category= logo
                                
                        itemlist.append( Item(channel=item.channel, title = item.title , action="findvideos", url=item.url, server="torrent", thumbnail=logo, fanart=item.extra, extra=extra,show=show,  category= category,library=item.library,fulltitle=fulltitle, folder=True) )
                                                                                                                                                                    
                                                                                                                                                                    
                                                                                                                                                                    
                                                                                                                                                                    
                if not '"hdmovieclearart"' in data and not '"moviebackground"' in data:
                    extra= logo
                    show=  fanart_2+"|"+fanart_3+"|"+sinopsis
                    if '"moviedisc"' in data:
                        category= disc
                    else:
                        category= item.extra
                    itemlist.append( Item(channel=item.channel, title = item.title , action="findvideos", url=item.url, server="torrent", thumbnail=logo, fanart=item.extra, extra=extra,show=show ,  category= category, library=item.library,fulltitle=fulltitle,folder=True) )

    title_info ="Info"
   
    if posterdb == item.thumbnail:
       if '"movieposter"' in data:
           thumbnail= poster
       else:
           thumbnail = item.thumbnail
    else:
        thumbnail = posterdb



    id = id_scraper

    extra = extra+"|"+id+"|"+title.encode('utf8')

    title_info = title_info.replace(title_info,bbcode_kodi2html("[COLOR skyblue]"+title_info+"[/COLOR]"))
    itemlist.append( Item(channel=item.channel, action="info" , title=title_info , url=item.url, thumbnail=thumbnail, fanart=fanart_info, extra = extra, category=category, show = show,folder=False ))

    return itemlist
コード例 #30
0
ファイル: livesportws.py プロジェクト: Jmlaguna89/miNuevoRepo
def mainlist(item):
    logger.info("pelisalacarta.livesportsws lista")
    itemlist = []
    import xbmc, time
    if not xbmc.Player().isPlaying():
       xbmc.executebuiltin('xbmc.PlayMedia('+song+')')
    

    
    """
        Lo que ocurre con
        url = http://translate.googleusercontent.com/translate_c?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&usg=ALkJrhgzJfI1TDn3BxGgPbjgAHHS7J0i9g
        Redirecciones:
        1. http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/
        2. http://translate.googleusercontent.com/translate_p?nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&depth=2&usg=ALkJrhgAAAAAVupk4tLINTbmU7JrcQdl0G4V3LtnRM1n
        3. http://translate.googleusercontent.com/translate_c?depth=2&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&usg=ALkJrhhhRDwHSDRDN4t27cX5CYZLFFQtmA
        Lo que significa que necesitamos una key nueva cada vez en el argumento "usg" y para llegar a la url 3 debemos hacer la petición 1 y 2 con 'follow_redirects=False' o con la convinación de 'follow_redirects=False' y 'header_to_get="location"'
        """
    
    #### Opción 1: 'follow_redirects=False'
    ## Petición 1
    url = "http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://livesport.ws/football"
    data = dhe( scrapertools.downloadpage(url,follow_redirects=False) )#.decode('cp1251').encode('utf8')
    ## Petición 2
    url = scrapertools.get_match(data, ' src="([^"]+)" name=c ')
    data = dhe( scrapertools.downloadpage(url,follow_redirects=False) )#.decode('cp1251').encode('utf8')
    ## Petición 3
    url = scrapertools.get_match(data, 'URL=([^"]+)"')
    data = dhe( scrapertools.cachePage(url) )#.decode('cp1251').encode('utf8')
    
    """
        #### Opción 2: 'follow_redirects=False' y 'header_to_get="location"'
        ## Petición 1
        url = "http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/"
        data = dhe( scrapertools.downloadpage(url,follow_redirects=False) )#.decode('cp1251').encode('utf8')
        ## Petición 2
        url = scrapertools.get_match(data, ' src="([^"]+)" name=c ')
        url = scrapertools.get_header_from_response(url, header_to_get="location")
        ## Petición 3
        data = dhe( scrapertools.cachePage(url ) )#.decode('cp1251').encode('utf8')
        """
    
    
    
    patrondata = '</h1></div>(.*?)</h2>'
    matchesdata = re.compile(patrondata,re.DOTALL).findall(data)
    for bloque_data in matchesdata:
        
        for bloque_data in matchesdata:
            patrondaygame = '<span class=text>.*?<span class=text>(.*?)</span></a>(.*?)</span> --></li></ul></div>'
            matchesdaygame = re.compile(patrondaygame,re.DOTALL).findall(bloque_data)
            
            for day , bloque_games in matchesdaygame:
                day = re.sub(r"</span>|<i class=ico><span>de</span></i>|<span class=text>","",day)
                if "hoy" in day or "Hoy" in day:
                    day = day.replace(day,"[COLOR yellow][B]"+day+"[/B][/COLOR]")
                elif "Ayer" in day or "ayer" in day:
                      day = day.replace(day,"[COLOR darkgoldenrod][B]"+day+"[/B][/COLOR]")
                else:
                     day = day.replace(day,"[COLOR greenyellow][B]"+day+"[/B][/COLOR]")
                itemlist.append( Item(channel=__channel__, title=day,action="mainlist",url="",fanart="http://www.easywallprints.com/upload/designs/background-with-soccer-balls-zoom-1.jpg",thumbnail="http://s6.postimg.org/3yl2y4adt/livesportagenda.png",folder=False) )

                patron = 'es&u=(.*?)&usg.*?id=event-(.*?)>(.*?)</i>.*?<span class=competition>.*?<span class=competition>(.*?)</span></a>.*?<i class="separator">.*?</span>(.*?)</span>.*?src=(.*?)>.*?src=(.*?)>.*?text-align: left">.*?</span>(.*?)</span>.*?<i class="live-broadcasting-status-(\d)"'#'<a class="link" href="([^"]+)" title="(.*?)".*?<span class="liga"><span>(.*?)</span></span>.*?<span class="date"><span>(.*?)</span></span>'
                matches = re.compile(patron,re.DOTALL).findall(bloque_games)
                for url_info,id_event, hora,competition,team1,thumbnail,fanart,team2 , status in matches:
                    competition = re.sub(r"\.","",competition)
                    if status == "4" :
                        datainfo = scrapertools.cachePage(url_info)
                        score = scrapertools.get_match(datainfo,'<div class="score">(.*?)</div>')
                        score=score.strip()
                
                    if "00:" in hora:
                        hora = hora.replace("00:","24:")
                    if not "LIVE" in hora:
                       time= re.compile('(\d+):(\d+)',re.DOTALL).findall(hora)
                       for horas, minutos in time:
                           wrong_time =int(horas)
                           value = 1
                           correct_time = wrong_time - value
                           correct_time = str(correct_time)
                           hora = correct_time +":"+ minutos
                    
                    if "OFFLINE" in hora:
                        extra = hora
                        title = team1+"-"+team2+"____"
                        title = title.title()
                        fulltitle =title.replace(title,"[COLOR burlywood][B]"+title+"[/B][/COLOR]")
                        title= title.replace(title,"[COLOR burlywood]"+title+"[/COLOR]")+"[COLOR green][B]"+score+"[/B][/COLOR]"
                        action = "mainlist"
                        folder = False
                    else:
                        if "hoy" in day or "Hoy" in day:
                            title = team1+"-"+team2
                            title = title.title()
                            fulltitle =title.replace(title,"[COLOR deepskyblue][B]"+title+"[/B][/COLOR]")
                            if "LIVE" in hora:
                               extra= hora
                               hora = u'\u006C\u0456\u0475\u04BC!!'.encode('utf-8')
                               hora = hora.replace(hora,"[COLOR crimson][B]"+hora+"[/B][/COLOR]")
                            else:
                                extra = hora
                                hora = hora.replace(hora,"[COLOR aquamarine][B]"+hora+"[/B][/COLOR]")
                            title = hora+ "  " + title.replace(title,"[COLOR deepskyblue]"+title+"[/COLOR]")+ "[COLOR floralwhite]"+" "+"("+competition+")"+"[/COLOR]"
                            action = "enlaces"
                            folder = True
                        else:
                            title = team1+"-"+team2
                            title = title.title()
                            fulltitle =title.replace(title,"[COLOR mediumaquamarine][B]"+title+"[/B][/COLOR]")
                            title = "[COLOR aquamarine][B]"+hora+"[/B][/COLOR]"+ "  " + title.replace(title,"[COLOR mediumaquamarine]"+title+"[/COLOR]")+ "[COLOR paleturquoise]"+" "+"("+competition+")"+"[/COLOR]"
                            action = "enlaces"
                            folder = True
                    post_id = scrapertools.get_match(url_info,'http.*?livesport.ws\/(.*?)-')
                    
                    url = "http://livesport.ws/engine/modules/sports/sport_refresh.php?from=event&event_id="+id_event+"&tab_id=0&post_id="+post_id
                   
                    itemlist.append( Item(channel=__channel__, title="     "+title,action=action,url=url,thumbnail =urlparse.urljoin(host,thumbnail),fanart =urlparse.urljoin(host,fanart),fulltitle = fulltitle,extra =extra,folder=folder) )


        

    
    
    return itemlist
コード例 #31
0
def fanart(item):
    #Vamos a sacar todos los fanarts y arts posibles
    logger.info("pelisalacarta.verseriesonlinetv fanart")
    itemlist = []
    url = item.url
    data = dhe( scrapertools.cachePage(item.url) )
    data = re.sub(r"\n|\r|\t|\s{2}|\(.*?\)|\[.*?\]|&nbsp;","",data)
    try:
     sinopsis= scrapertools.get_match(data,'<div class="sinopsis">.*?</b>(.*?)</div>')
     if " . Aquí podrán encontrar la información de toda la serie incluyendo sus temporadas y episodios." in sinopsis:
         sinopsis = ""
     else:
       sinopsis=re.sub('.. Aquí podrán encontrar la información de toda la serie incluyendo sus temporadas y episodios.','.',sinopsis)
    except:
     sinopsis=""
        
    title_fan=item.show.split("|")[0]
    title= title_fan.decode('utf8').encode('latin1')
    title= title.replace(' ','%20')
    item.title = re.sub(r"\(.*?\)","",item.title)
    year = item.show.split("|")[1]
    
    url = "http://www.filmaffinity.com/es/advsearch.php?stext={0}&stype%5B%5D=title&country=&ggenre=TV_SE&fromyear={1}&toyear={1}".format(title, year)
    data = scrapertools.downloadpage(url)

    url_filmaf = scrapertools.find_single_match(data, '<div class="mc-poster">\s*<a title="[^"]*" href="([^"]+)"')
    if url_filmaf:
        url_filmaf = "http://www.filmaffinity.com%s" % url_filmaf
        data = scrapertools.downloadpage(url_filmaf)
    else:

               try:
                 url_bing="http://www.bing.com/search?q=%s+%s+site:filmaffinity.com" %  (title.replace(' ', '+'),  year)
                 data = browser (url_bing)
                 data = re.sub(r'\n|\r|\t|\s{2}|&nbsp;','',data)

                 if "myaddrproxy.php" in data:
                     subdata_bing = scrapertools.get_match(data,'li class="b_algo"><div class="b_title"><h2>(<a href="/ myaddrproxy.php/http/www.filmaffinity.com/es/film.*?)"')
                     subdata_bing = re.sub(r'\/myaddrproxy.php\/http\/','',subdata_bing)
                 else:
                     subdata_bing = scrapertools.get_match(data,'li class="b_algo"><h2>(<a href="http://www.filmaffinity.com/es/film.*?)"')
    
                 url_filma = scrapertools.get_match(subdata_bing,'<a href="([^"]+)')
                 if not "http" in url_filma:
                    data = scrapertools.cachePage ("http://"+url_filma)
                 else:
                    data = scrapertools.cachePage (url_filma)
                 data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
            
               except:
                 pass
    if sinopsis == "":
           try:
            sinopsis = scrapertools.find_single_match(data, '<dd itemprop="description">(.*?)</dd>')
            sinopsis = sinopsis.replace("<br><br />", "\n")
            sinopsis=re.sub(r"\(FILMAFFINITY\)<br />","",sinopsis)
           except:
              pass
    try:
        rating_filma=scrapertools.get_match(data,'itemprop="ratingValue" content="(.*?)">')
    except:
        rating_filma = "Sin puntuacion"
    print "lobeznito"
    print rating_filma
        
    critica=""
    patron = '<div itemprop="reviewBody">(.*?)</div>.*?itemprop="author">(.*?)\s*<i alt="([^"]+)"'
    matches_reviews = scrapertools.find_multiple_matches(data, patron)

    if matches_reviews:
            for review, autor, valoracion in matches_reviews:
                review = dhe(scrapertools.htmlclean(review))
                review += "\n" + autor +"[CR]"
                review = re.sub(r'Puntuac.*?\)','',review)
                if "positiva" in valoracion:
                    critica += "[COLOR green][B]%s[/B][/COLOR]\n" % review
                elif "neutral" in valoracion:
                    critica += "[COLOR yellow][B]%s[/B][/COLOR]\n" % review
                else:
                    critica += "[COLOR red][B]%s[/B][/COLOR]\n" % review
    else:
        critica = "[COLOR floralwhite][B]Esta serie no tiene críticas[/B][/COLOR]"


    ###Busqueda en tmdb
        
    url_tmdb="http://api.themoviedb.org/3/search/tv?api_key="+api_key+"&query=" + title +"&language=es&include_adult=false&first_air_date_year="+year
    data_tmdb = scrapertools.cachePage(url_tmdb)
    data_tmdb = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data_tmdb)
    patron = '"page":1.*?,"id":(.*?),"backdrop_path":(.*?),"vote_average"'
    matches = re.compile(patron,re.DOTALL).findall(data_tmdb)

    ###Busqueda en bing el id de imdb de la serie
    if len(matches)==0:
         url_tmdb="http://api.themoviedb.org/3/search/tv?api_key="+api_key+"&query=" + title +"&language=es"
         data_tmdb = scrapertools.cachePage(url_tmdb)
         data_tmdb = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data_tmdb)
         patron = '"page":1.*?,"id":(.*?),"backdrop_path":(.*?),"vote_average"'
         matches = re.compile(patron,re.DOTALL).findall(data_tmdb)
         if len(matches)==0:
          urlbing_imdb = "http://www.bing.com/search?q=%s+%s+tv+series+site:imdb.com" % (title.replace(' ', '+'),  year)
          data = browser (urlbing_imdb)
          data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;|http://ssl-proxy.my-addr.org/myaddrproxy.php/","",data)
          try:
            subdata_imdb =scrapertools.find_single_match(data,'<li class="b_algo">(.*?)h="ID.*?<strong>.*?TV Series')
          except:
             pass
        
    
          try:
              imdb_id = scrapertools.get_match(subdata_imdb,'<a href=.*?http.*?imdb.com/title/(.*?)/.*?"')
          except:
              imdb_id = ""
          ###Busca id de tvdb y tmdb mediante imdb id
         
          urlremotetbdb = "https://api.themoviedb.org/3/find/"+imdb_id+"?api_key="+api_key+"&external_source=imdb_id&language=es"
          data_tmdb= scrapertools.cachePage(urlremotetbdb)
          matches= scrapertools.find_multiple_matches(data_tmdb,'"tv_results":.*?"id":(.*?),.*?"poster_path":(.*?),"popularity"')
         
          if len(matches)==0:
             id_tmdb=""
             fanart_3 = ""
             extra= item.thumbnail+"|"+year+"|"+"no data"+"|"+"no data"+"|"+rating_filma+"|"+critica+"|"+""+"|"+id_tmdb
             show=  item.fanart+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+item.thumbnail+"|"+id_tmdb
             fanart_info = item.fanart
             fanart_2=item.fanart
             id_scraper = " "+"|"+"serie"+"|"+rating_filma+"|"+critica+"|"+" "
             category= ""
             posterdb= item.thumbnail
             itemlist.append( Item(channel=item.channel, title=item.title, url=item.url, action="findvideos", thumbnail=item.thumbnail, fanart=item.fanart ,extra=extra, category= category,  show=show , folder=True) )


    for id_tmdb, fan in matches:
            ###Busca id tvdb
            urlid_tvdb="https://api.themoviedb.org/3/tv/"+id_tmdb+"/external_ids?api_key="+api_key+"&language=es"
            data_tvdb = scrapertools.cachePage(urlid_tvdb)
            id= scrapertools.find_single_match(data_tvdb,'tvdb_id":(.*?),"tvrage_id"')
            if id == "null":
               id = ""
            category = id
            ###Busqueda nºepisodios y temporadas,status
            url_status ="http://api.themoviedb.org/3/tv/"+id_tmdb+"?api_key="+api_key+"&append_to_response=credits&language=es"
            data_status= scrapertools.cachePage(url_status)
            season_episodes=scrapertools.find_single_match(data_status,'"(number_of_episodes":\d+,"number_of_seasons":\d+,)"')
            season_episodes=re.sub(r'"','',season_episodes)
            season_episodes=re.sub(r'number_of_episodes','Episodios ',season_episodes)
            season_episodes=re.sub(r'number_of_seasons','Temporadas',season_episodes)
            season_episodes=re.sub(r'_',' ',season_episodes)
            status = scrapertools.find_single_match(data_status,'"status":"(.*?)"')
            if status== "Ended":
                status ="Finalizada"
            else:
                status = "En emisión"
            status = status +" ("+ season_episodes+")"
            status= re.sub(r',','.',status)
            #######

            fan = re.sub(r'\\|"','',fan)

            try:
             #rating tvdb
             url_rating_tvdb = "http://thetvdb.com/api/1D62F2F90030C444/series/"+id+"/es.xml"
             print "pepote"
             print url_rating_tvdb
             data = scrapertools.cachePage(url_rating_tvdb)
             rating =scrapertools.find_single_match(data,'<Rating>(.*?)<')
            except:
              ratintg_tvdb = ""
              try:
                rating = scrapertools.get_match(data,'"vote_average":(.*?),')
              except:
                
                rating = "Sin puntuación"
         
            id_scraper =id_tmdb+"|"+"serie"+"|"+rating_filma+"|"+critica+"|"+rating+"|"+status #+"|"+emision
            posterdb = scrapertools.find_single_match(data_tmdb,'"poster_path":(.*?)","popularity"')

            if "null" in posterdb:
                posterdb = item.thumbnail
            else:
                posterdb = re.sub(r'\\|"','',posterdb)
                posterdb =  "https://image.tmdb.org/t/p/original" + posterdb
            if "null" in fan:
                fanart = "http://s6.postimg.org/qcbsfbvm9/verseriesnofan2.jpg"
            else:
                fanart="https://image.tmdb.org/t/p/original" + fan

            if fanart =="http://s6.postimg.org/qcbsfbvm9/verseriesnofan2.jpg":
                fanart_info = fanart
                fanart_2 = fanart
                fanart_3 = fanart
                fanart_4 = fanart
            else:
             url ="http://api.themoviedb.org/3/tv/"+id_tmdb+"/images?api_key="+api_key

             data = scrapertools.cachePage(url)
             data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)

             file_path= scrapertools.find_multiple_matches(data, '"file_path":"(.*?)"')
             if len(file_path)>= 5:
                fanart_info = "https://image.tmdb.org/t/p/original" + file_path[1]
                fanart_2 = "https://image.tmdb.org/t/p/original" + file_path[2]
                fanart_3 = "https://image.tmdb.org/t/p/original" + file_path[3]
                fanart_4 = "https://image.tmdb.org/t/p/original" + file_path[4]
                if fanart== "http://s6.postimg.org/qcbsfbvm9/verseriesnofan2.jpg":
                    fanart= "https://image.tmdb.org/t/p/original" + fanart_info
             elif len(file_path)== 4  :
                fanart_info = "https://image.tmdb.org/t/p/original" + file_path[1]
                fanart_2 = "https://image.tmdb.org/t/p/original" + file_path[2]
                fanart_3 = "https://image.tmdb.org/t/p/original" + file_path[3]
                fanart_4 = "https://image.tmdb.org/t/p/original" + file_path[1]
                if fanart== "http://s6.postimg.org/qcbsfbvm9/verseriesnofan2.jpg":
                    fanart= "https://image.tmdb.org/t/p/original" + fanart_info
             elif len(file_path)== 3:
                fanart_info = "https://image.tmdb.org/t/p/original" + file_path[1]
                fanart_2 = "https://image.tmdb.org/t/p/original" + file_path[2]
                fanart_3 = "https://image.tmdb.org/t/p/original" + file_path[1]
                fanart_4 = "https://image.tmdb.org/t/p/original" + file_path[0]
                if fanart== "http://s6.postimg.org/qcbsfbvm9/verseriesnofan2.jpg":
                    fanart= "https://image.tmdb.org/t/p/original" + fanart_info
             elif len(file_path)== 2:
                fanart_info = "https://image.tmdb.org/t/p/original" + file_path[1]
                fanart_2 = "https://image.tmdb.org/t/p/original" + file_path[0]
                fanart_3 = "https://image.tmdb.org/t/p/original" + file_path[1]
                fanart_4 = "https://image.tmdb.org/t/p/original" + file_path[1]
                if fanart== "http://s6.postimg.org/qcbsfbvm9/verseriesnofan2.jpg":
                    fanart= "https://image.tmdb.org/t/p/original" + fanart_info
             else:
                fanart_info = fanart
                fanart_2 = fanart
                fanart_3 = fanart
                fanart_4 = fanart


            url ="http://webservice.fanart.tv/v3/tv/"+id+"?api_key="+api_fankey
            data = scrapertools.cachePage(url)
            data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
            patron = '"clearlogo":.*?"url": "([^"]+)"'
            matches = re.compile(patron,re.DOTALL).findall(data)
            if '"tvbanner"' in data:
                tvbanner = scrapertools.get_match(data,'"tvbanner":.*?"url": "([^"]+)"')
                tfv=tvbanner
            elif '"tvposter"' in data:
                tvposter = scrapertools.get_match(data,'"tvposter":.*?"url": "([^"]+)"')
                tfv=tvposter
            else:
                tfv = posterdb
            if '"tvthumb"' in data:
                tvthumb = scrapertools.get_match(data,'"tvthumb":.*?"url": "([^"]+)"')
            if '"hdtvlogo"' in data:
                hdtvlogo = scrapertools.get_match(data,'"hdtvlogo":.*?"url": "([^"]+)"')
            if '"hdclearart"' in data:
                hdtvclear = scrapertools.get_match(data,'"hdclearart":.*?"url": "([^"]+)"')
            if len(matches)==0:
                if '"hdtvlogo"' in data:
                    if "showbackground" in data:
                
                        if '"hdclearart"' in data:
                            thumbnail = hdtvlogo
                            extra=  hdtvclear+"|"+year
                            show = fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        else:
                            thumbnail = hdtvlogo
                            extra= thumbnail+"|"+year
                            show = fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        itemlist.append( Item(channel=item.channel, title = item.title , action="temporadas", url=item.url, server="torrent", thumbnail=thumbnail, fanart=fanart, category=category, extra=extra, show=show, folder=True) )
                                                                        
                                                                        
                    else:
                        if '"hdclearart"' in data:
                            thumbnail= hdtvlogo
                            extra= hdtvclear+"|"+year
                            show= fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        else:
                            thumbnail= hdtvlogo
                            extra= thumbnail+"|"+year
                            show= fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        itemlist.append( Item(channel=item.channel, title = item.title , action="temporadas", url=item.url, server="torrent", thumbnail=thumbnail, fanart=fanart, extra=extra, show=show,  category= category, folder=True) )
                else:
                    extra=  ""+"|"+year
                    show = fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                    itemlist.append( Item(channel=item.channel, title = item.title , action="temporadas", url=item.url,  server="torrent", thumbnail=posterdb, fanart=fanart, extra=extra, show=show, category = category, folder=True) )
                                                                                                                                
            for logo in matches:
                if '"hdtvlogo"' in data:
                    thumbnail = hdtvlogo
                elif not '"hdtvlogo"' in data :
                        if '"clearlogo"' in data:
                            thumbnail= logo
                else:
                    thumbnail= item.thumbnail
                if '"clearart"' in data:
                    clear=scrapertools.get_match(data,'"clearart":.*?"url": "([^"]+)"')
                    if "showbackground" in data:
                                
                        extra=clear+"|"+year
                        show= fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        itemlist.append( Item(channel=item.channel, title = item.title , action="temporadas", url=item.url, server="torrent", thumbnail=thumbnail, fanart=fanart, extra=extra,show=show, category= category,  folder=True) )
                    else:
                        extra= clear+"|"+year
                        show=fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        itemlist.append( Item(channel=item.channel, title = item.title , action="temporadas", url=item.url, server="torrent", thumbnail=thumbnail, fanart=fanart, extra=extra,show=show, category= category, folder=True) )
                                     
                if "showbackground" in data:
                        
                    if '"clearart"' in data:
                        clear=scrapertools.get_match(data,'"clearart":.*?"url": "([^"]+)"')
                        extra=clear+"|"+year
                        show= fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                    else:
                        extra=logo+"|"+year
                        show= fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        itemlist.append( Item(channel=item.channel, title = item.title , action="temporadas", url=item.url, server="torrent", thumbnail=thumbnail, fanart=fanart, extra=extra,show=show,  category = category, folder=True) )
                                     
                if not '"clearart"' in data and not '"showbackground"' in data:
                        if '"hdclearart"' in data:
                            extra= hdtvclear+"|"+year
                            show= fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        else:
                            extra= thumbnail+"|"+year
                            show=  fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        itemlist.append( Item(channel=item.channel, title = item.title , action="temporadas", url=item.url, server="torrent", thumbnail=thumbnail, fanart=fanart, extra=extra,show=show , category = category, folder=True) )
    title ="Info"
    title_info = title.replace(title,"[COLOR seagreen]"+title+"[/COLOR]")
    
    
    if '"tvposter"' in data:
            thumbnail= scrapertools.get_match(data,'"tvposter":.*?"url": "([^"]+)"')
    else:
        thumbnail = posterdb
        
    if "tvbanner" in data:
        category = tvbanner
    else:
        category = show
    if '"tvthumb"' in data:
        plot = item.plot+"|"+tvthumb
    else:
        plot = item.plot+"|"+item.thumbnail
    if '"tvbanner"' in data:
        plot=plot+"|"+ tvbanner
    elif '"tvthumb"' in data:
        plot=plot+"|"+ tvthumb
    else:
        plot=plot+"|"+ item.thumbnail


    id = id_scraper
    
    extra = extra+"|"+id+"|"+title.encode('utf8')
    
    itemlist.append( Item(channel=item.channel, action="info" , title=title_info , url=item.url, thumbnail=thumbnail, fanart=fanart_info, extra= extra, category = category,plot=plot, show= show, viewmode="movie_with_plot", folder=False ))

    return itemlist
コード例 #32
0
def enlaces(item):
    logger.info("pelisalacarta.livetv enlaces")
    xbmc.executebuiltin("Container.Update")
    if not xbmc.Player().isPlaying():
        xbmc.sleep(20)
        xbmc.executebuiltin('xbmc.PlayMedia(' + song + ')')

    itemlist = []
    data = dhe(scrapertools.cachePage(item.url))
    data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;", "", data)
    if "<i id=\"whelint\" style=\"line-height: 150%;\">" in data:

        if item.extra == "futbol":
            fanart = "http://s6.postimg.org/56n6n0k9d/Wembley.jpg"
        else:
            fanart = "http://s6.postimg.org/naq77nhxt/Sport_Wallpaper_HD_3000x2250.jpg"
        itemlist.append(
            Item(
                channel=__channel__,
                title=
                "[COLOR orangered][B]Las referencias de la transmisión van a ser publicadas no más tarde de media hora de su principio[/B][/COLOR]",
                thumbnail=
                "http://s6.postimg.org/p3t3vz34h/Panasonic_AJ_HDX900.png",
                fanart=fanart,
                folder=False))
    else:
        if '<span class="lnkt">AceStream Links</span>' in data:
            patronacestream = '<span class="lnkt">AceStream Links</span>(.*?)<a name="comments"></a>'
            matchesacestream = re.compile(patronacestream,
                                          re.DOTALL).findall(data)

            for bloque_acestream in matchesacestream:
                patron = '<td width=16><img title.*?src="([^"]+)"></a></td>.*?<a href="(acestream:.*?)"'
                matches = re.compile(patron,
                                     re.DOTALL).findall(bloque_acestream)
                for idioma, url in matches:
                    #if velocidad == "":
                    #  velocidad = "S/N"

                    itemlist.append(
                        Item(
                            channel=__channel__,
                            title=
                            "[COLOR yellow][B]Enlaces Acestream[/B][/COLOR]",
                            action="play",
                            url=url,
                            thumbnail=idioma,
                            fanart=
                            "http://s6.postimg.org/e5hudsej5/Nou_Camp_Stadium_Barcelona_Football_Wallpapers_H.jpg",
                            fulltitle=item.fulltitle,
                            folder=False))
        else:
            itemlist.append(
                Item(
                    channel=__channel__,
                    title="[COLOR yellow][B]No hay elaces Acetream[/B][/COLOR]",
                    thumbnail=
                    "http://s6.postimg.org/c2c0jv441/torrent_stream_logo_300x262.png",
                    fanart=
                    "http://s6.postimg.org/ttnmybjip/5499731408_42e3876093_b.jpg",
                    folder=False))
        #Enlaces Sopcast
        if "<span class=\"lnkt\">SopCast Links" in data:

            patronsopcast = '<span class="lnkt">SopCast Links</span>(.*?)<a name="comments"></a>'
            matchessopcast = re.compile(patronsopcast, re.DOTALL).findall(data)

            for bloque_sopcast in matchessopcast:
                patron = '<td width=16><img title.*?src="([^"]+)".*?title=.*?>([^<]+)</td>.*?<a href="(sop:.*?)"'
                matches = re.compile(patron, re.DOTALL).findall(bloque_sopcast)
                for idioma, bibrate, url in matches:

                    title = "[COLOR aquamarine][B]Enlace Sopcast[/B][/COLOR]" + " (" + "[COLOR green][B]" + bibrate + "[/B][/COLOR]" + ")"
                    itemlist.append(
                        Item(
                            channel=__channel__,
                            title=title,
                            action="play",
                            url=url,
                            thumbnail=idioma,
                            fanart=
                            "http://s6.postimg.org/e5hudsej5/Nou_Camp_Stadium_Barcelona_Football_Wallpapers_H.jpg",
                            fulltitle=item.fulltitle,
                            folder=False))

        else:

            itemlist.append(
                Item(
                    channel=__channel__,
                    title=
                    "[COLOR aquamarine][B]No hay elaces Sopcast[/B][/COLOR]",
                    thumbnail="http://s6.postimg.org/v9z5ggmfl/sopcast.jpg",
                    fanart=
                    "http://s6.postimg.org/ttnmybjip/5499731408_42e3876093_b.jpg",
                    folder=False))

    return itemlist
コード例 #33
0
def mainlist(item):
    logger.info("deportesalacarta.sport7 mainlist")
    itemlist = []
    check = xbmc.getInfoLabel('ListItem.Title')

    if item.channel != __channel__:
        item.channel = __channel__
    else:
        if not xbmc.Player().isPlaying():
            xbmc.executebuiltin('xbmc.PlayMedia(' + song + ')')
    """
        Lo que ocurre con
        url = http://translate.googleusercontent.com/translate_c?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&usg=ALkJrhgzJfI1TDn3BxGgPbjgAHHS7J0i9g
        Redirecciones:
        1. http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/
        2. http://translate.googleusercontent.com/translate_p?nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&depth=2&usg=ALkJrhgAAAAAVupk4tLINTbmU7JrcQdl0G4V3LtnRM1n
        3. http://translate.googleusercontent.com/translate_c?depth=2&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&usg=ALkJrhhhRDwHSDRDN4t27cX5CYZLFFQtmA
        Lo que significa que necesitamos una key nueva cada vez en el argumento "usg" y para llegar a la url 3 debemos hacer la petición 1 y 2 con 'follow_redirects=False' o con la convinación de 'follow_redirects=False' y 'header_to_get="location"'
        """

    #### Opción 1: 'follow_redirects=False'
    ## Petición 1
    url = "http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=https://sport7.co"
    data = dhe(httptools.downloadpage(
        url, follow_redirects=False).data)  #.decode('cp1251').encode('utf8')
    ## Petición 2
    url = scrapertools.get_match(data, ' src="([^"]+)" name=c ')
    data = dhe(httptools.downloadpage(
        url, follow_redirects=False).data)  #.decode('cp1251').encode('utf8')
    ## Petición 3
    url = scrapertools.get_match(data, 'URL=([^"]+)"')
    data = dhe(
        httptools.downloadpage(url).data)  #.decode('cp1251').encode('utf8')
    data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;", "", data)
    logger.info("pocoyo")
    logger.info(data)
    """
        #### Opción 2: 'follow_redirects=False' y 'header_to_get="location"'
        ## Petición 1
        url = "http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/"
        data = dhe( scrapertools.downloadpage(url,follow_redirects=False) )#.decode('cp1251').encode('utf8')
        ## Petición 2
        url = scrapertools.get_match(data, ' src="([^"]+)" name=c ')
        url = scrapertools.get_header_from_response(url, header_to_get="location")
        ## Petición 3
        data = dhe( scrapertools.cachePage(url ) )#.decode('cp1251').encode('utf8')
        """

    patrondata = 'Mostrar todos los partidos(.*?)Рекомендуем посмотреть'
    matchesdata = re.compile(patrondata, re.DOTALL).findall(data)
    logger.info("pacopepe")
    logger.info(str(matchesdata))
    for bloque_data in matchesdata:

        logger.info("pacopepe")
        patronpartidos = 'text-align: left">[^<]+</span>([^<]+</span>)(.*?)<div class="middle data">'
        matchespartidos = re.compile(patronpartidos,
                                     re.DOTALL).findall(bloque_data)
        logger.info(str(matchespartidos))
        for fecha, bloque_partidos in matchespartidos:
            fecha = re.sub(r'de \w+</span>', '', fecha)
            logger.info("tusmuertos")
            logger.info(bloque_partidos)
            #itemlist.append( Item(channel=__channel__, title=fecha,action="mainlist",url="",thumbnail ="",fanart ="",folder=False) )
            patron = 'src=([^"]+)>.*?<span class=time>(\d+:\d+)</span>.*?http.*?http.*?(https://sport.*?)>(.*?)</a>'
            matches = re.compile(patron, re.DOTALL).findall(bloque_partidos)
            for thumbnail, hora, url, title in matches:
                logger.info("jaimito")
                logger.info(thumbnail)
                if not "Spain" in thumbnail and not "England" in thumbnail and not "Germany" in thumbnail and not "Italy" in thumbnail and not "lch" in thumbnail:
                    continue
                fulltitle = "[COLOR darkorange][B]" + title + "[/B][/COLOR]"
                tiempo = re.compile('(\d+):(\d+)', re.DOTALL).findall(hora)
                logger.info("manolo")
                for horas, minutos in tiempo:
                    if horas == "00":
                        horas = horas.replace("00", "24")

                    check = re.compile('(\d)\d', re.DOTALL).findall(horas)
                    if "0" in check:
                        horas = horas.replace("0", "")
                        horas = 24 + int(horas)

                    wrong_time = int(horas)
                    value = 1
                    correct_time = wrong_time - value
                    if correct_time == 23:
                        dates = re.compile('(.*?)(\d+)(.*)',
                                           re.DOTALL).findall(fecha)
                        for d, days, m in dates:
                            dia = int(days) - 1
                            date = d + " " + str(dia) + m

                    else:
                        date = fecha
                    if correct_time > 24:
                        correct_time = int(correct_time) - 24

                    correct_time = '%02d' % int(correct_time)
                    ok_time = correct_time + ":" + minutos
                    print "guay"
                    print ok_time

                if "24:" in ok_time:
                    ok_time = ok_time.replace("24:", "00:")

                from time import gmtime, strftime
                get_date = strftime("%Y-%m-%d %H:%M:%S", time.localtime())

                ok_date_hour = re.compile('(\d+)-(\d+)-(\d+) (\d+:\d+:\d+)',
                                          re.DOTALL).findall(get_date)
                for year, mes, day, hour in ok_date_hour:
                    current_day = day + "/" + mes + "/" + year
                    current_hour = hour
                    today = scrapertools.get_match(current_day,
                                                   '(\d+)/\d+/\d+')
                    check_match_hour = scrapertools.get_match(
                        ok_time, '(\d+):\d+')
                    check_match_minute = scrapertools.get_match(
                        ok_time, '\d+:(\d+)')
                    check_today_hour = scrapertools.get_match(
                        current_hour, '(\d+):\d+')
                    check_today_minute = scrapertools.get_match(
                        current_hour, '\d+:(\d+)')
                    check_match_end_live = int(check_match_hour) + 2
                    check_match_end = int(check_today_hour) - 2
                    print "pepe"
                    print check_match_hour
                    print check_match_end
                    print check_match_end_live
                if day in date and int(check_match_hour) < int(
                        check_today_hour) and int(check_today_hour) >= int(
                            check_match_end_live):
                    continue
                if day in date and int(check_match_hour) == int(
                        check_today_hour
                ) and int(check_match_minute) <= int(
                        check_today_minute) or day in date and int(
                            check_match_hour) < int(check_today_hour) and int(
                                check_today_hour) < int(check_match_end_live):

                    tiempo = ok_time
                    dia = scrapertools.get_match(date, '\d+')
                    mes = scrapertools.get_match(date,
                                                 '\d+\s*(?:de\s*|)([A-z]+)')
                    mes = month_convert(mes.title())
                    mes = str(mes).zfill(2)
                    dia_mes = dia + "/" + mes
                    dia_mes = re.sub(r'</span>', '', dia_mes)
                    evento = re.sub(r" - ", " vs ", title)
                    extra = "live"
                    title = "[COLOR darkorange][B]" + title + "[/B][/COLOR]" + " " + "[COLOR crimson][B]DIRECTO!![/B][/COLOR]"
                else:
                    tiempo = ok_time
                    dia = scrapertools.get_match(date, '\d+')
                    mes = scrapertools.get_match(date,
                                                 '\d+\s*(?:de\s*|)([A-z]+)')
                    mes = month_convert(mes.title())
                    mes = str(mes).zfill(2)
                    dia_mes = dia + "/" + mes
                    dia_mes = re.sub(r'</span>', '', dia_mes)
                    evento = re.sub(r" - ", " vs ", title)
                    title = "[COLOR firebrick][B]" + ok_time + "[/B][/COLOR]" + "  " + "[COLOR deepskyblue]" + "(" + dia_mes.strip(
                    ) + ")" + "[/COLOR]" + " " + "[COLOR olivedrab][B]" + title + "[/B][/COLOR]"
                    extra = "nolive"

                print "amoooo"
                print url
                itemlist.append(
                    Item(channel=__channel__,
                         title="     " + title,
                         action="enlaces",
                         url=url,
                         thumbnail=thumbnail,
                         fanart=
                         "http://s6.postimg.org/uo85sphn5/sport7fanart.jpg",
                         extra=extra,
                         fulltitle=fulltitle,
                         deporte="futbol",
                         evento=evento,
                         date=dia_mes,
                         time=tiempo,
                         context="info_partido",
                         folder=True))

    return itemlist
コード例 #34
0
def fanart(item):
    #Vamos a sacar todos los fanarts y arts posibles
    logger.info("pelisalacarta.verseriesonlinetv fanart")
    itemlist = []
    url = item.url
    data = dhe(httptools.downloadpage(item.url).data)
    data = re.sub(r"\n|\r|\t|\s{2}|\(.*?\)|\[.*?\]|&nbsp;","",data)
    try:
     sinopsis= scrapertools.get_match(data,'<div class="sinopsis">.*?</b>(.*?)</div>')
     if " . Aquí podrán encontrar la información de toda la serie incluyendo sus temporadas y episodios." in sinopsis:
         sinopsis = ""
     else:
       sinopsis=re.sub('.. Aquí podrán encontrar la información de toda la serie incluyendo sus temporadas y episodios.','.',sinopsis)
    except:
     sinopsis=""
        
    title_fan=item.show.split("|")[0]
    title= title_fan.decode('utf8').encode('latin1')
    title= title.replace(' ','%20')
    item.title = re.sub(r"\(.*?\)","",item.title)
    year = item.show.split("|")[1]
    
    url = "http://www.filmaffinity.com/es/advsearch.php?stext={0}&stype%5B%5D=title&country=&ggenre=TV_SE&fromyear={1}&toyear={1}".format(title, year)
    data = httptools.downloadpage(url).data

    url_filmaf = scrapertools.find_single_match(data, '<div class="mc-poster">\s*<a title="[^"]*" href="([^"]+)"')
    if url_filmaf:
        url_filmaf = "http://www.filmaffinity.com%s" % url_filmaf
        data = httptools.downloadpage(url_filmaf).data
    else:

               try:
                 url_bing="http://www.bing.com/search?q=%s+%s+site:filmaffinity.com" %  (title.replace(' ', '+'),  year)
                 data = browser (url_bing)
                 data = re.sub(r'\n|\r|\t|\s{2}|&nbsp;','',data)

                 if "myaddrproxy.php" in data:
                     subdata_bing = scrapertools.get_match(data,'li class="b_algo"><div class="b_title"><h2>(<a href="/ myaddrproxy.php/http/www.filmaffinity.com/es/film.*?)"')
                     subdata_bing = re.sub(r'\/myaddrproxy.php\/http\/','',subdata_bing)
                 else:
                     subdata_bing = scrapertools.get_match(data,'li class="b_algo"><h2>(<a href="http://www.filmaffinity.com/es/film.*?)"')
    
                 url_filma = scrapertools.get_match(subdata_bing,'<a href="([^"]+)')
                 if not "http" in url_filma:
                    data =httptools.downloadpage("http://"+url_filma).data
                 else:
                    data = httptools.downloadpage(url_filma).data
                 data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
            
               except:
                 pass
    if sinopsis == "":
           try:
            sinopsis = scrapertools.find_single_match(data, '<dd itemprop="description">(.*?)</dd>')
            sinopsis = sinopsis.replace("<br><br />", "\n")
            sinopsis=re.sub(r"\(FILMAFFINITY\)<br />","",sinopsis)
           except:
              pass
    try:
        rating_filma=scrapertools.get_match(data,'itemprop="ratingValue" content="(.*?)">')
    except:
        rating_filma = "Sin puntuacion"
    print "lobeznito"
    print rating_filma
        
    critica=""
    patron = '<div itemprop="reviewBody">(.*?)</div>.*?itemprop="author">(.*?)\s*<i alt="([^"]+)"'
    matches_reviews = scrapertools.find_multiple_matches(data, patron)

    if matches_reviews:
            for review, autor, valoracion in matches_reviews:
                review = dhe(scrapertools.htmlclean(review))
                review += "\n" + autor +"[CR]"
                review = re.sub(r'Puntuac.*?\)','',review)
                if "positiva" in valoracion:
                    critica += "[COLOR green][B]%s[/B][/COLOR]\n" % review
                elif "neutral" in valoracion:
                    critica += "[COLOR yellow][B]%s[/B][/COLOR]\n" % review
                else:
                    critica += "[COLOR red][B]%s[/B][/COLOR]\n" % review
    else:
        critica = "[COLOR floralwhite][B]Esta serie no tiene críticas[/B][/COLOR]"


    ###Busqueda en tmdb
        
    url_tmdb="http://api.themoviedb.org/3/search/tv?api_key="+api_key+"&query=" + title +"&language=es&include_adult=false&first_air_date_year="+year
    data_tmdb = httptools.downloadpage(url_tmdb).data
    data_tmdb = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data_tmdb)
    patron = '"page":1.*?,"id":(.*?),"backdrop_path":(.*?),"vote_average"'
    matches = re.compile(patron,re.DOTALL).findall(data_tmdb)

    ###Busqueda en bing el id de imdb de la serie
    if len(matches)==0:
         url_tmdb="http://api.themoviedb.org/3/search/tv?api_key="+api_key+"&query=" + title +"&language=es"
         data_tmdb =httptools.downloadpage(url_tmdb).data
         data_tmdb = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data_tmdb)
         patron = '"page":1.*?,"id":(.*?),"backdrop_path":(.*?),"vote_average"'
         matches = re.compile(patron,re.DOTALL).findall(data_tmdb)
         if len(matches)==0:
          urlbing_imdb = "http://www.bing.com/search?q=%s+%s+tv+series+site:imdb.com" % (title.replace(' ', '+'),  year)
          data = browser (urlbing_imdb)
          data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;|http://ssl-proxy.my-addr.org/myaddrproxy.php/","",data)
          try:
            subdata_imdb =scrapertools.find_single_match(data,'<li class="b_algo">(.*?)h="ID.*?<strong>.*?TV Series')
          except:
             pass
        
    
          try:
              imdb_id = scrapertools.get_match(subdata_imdb,'<a href=.*?http.*?imdb.com/title/(.*?)/.*?"')
          except:
              imdb_id = ""
          ###Busca id de tvdb y tmdb mediante imdb id
         
          urlremotetbdb = "https://api.themoviedb.org/3/find/"+imdb_id+"?api_key="+api_key+"&external_source=imdb_id&language=es"
          data_tmdb= httptools.downloadpage(urlremotetbdb).data
          matches= scrapertools.find_multiple_matches(data_tmdb,'"tv_results":.*?"id":(.*?),.*?"poster_path":(.*?),"popularity"')
         
          if len(matches)==0:
             id_tmdb=""
             fanart_3 = ""
             extra= item.thumbnail+"|"+year+"|"+"no data"+"|"+"no data"+"|"+rating_filma+"|"+critica+"|"+""+"|"+id_tmdb
             show=  item.fanart+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+item.thumbnail+"|"+id_tmdb
             fanart_info = item.fanart
             fanart_2=item.fanart
             id_scraper = " "+"|"+"serie"+"|"+rating_filma+"|"+critica+"|"+" "
             category= ""
             posterdb= item.thumbnail
             itemlist.append( Item(channel=item.channel, title=item.title, url=item.url, action="findvideos", thumbnail=item.thumbnail, fanart=item.fanart ,extra=extra, category= category,  show=show , folder=True) )


    for id_tmdb, fan in matches:
            ###Busca id tvdb
            urlid_tvdb="https://api.themoviedb.org/3/tv/"+id_tmdb+"/external_ids?api_key="+api_key+"&language=es"
            data_tvdb = httptools.downloadpage(urlid_tvdb).data
            id= scrapertools.find_single_match(data_tvdb,'tvdb_id":(.*?),"tvrage_id"')
            if id == "null":
               id = ""
            category = id
            ###Busqueda nºepisodios y temporadas,status
            url_status ="http://api.themoviedb.org/3/tv/"+id_tmdb+"?api_key="+api_key+"&append_to_response=credits&language=es"
            data_status= httptools.downloadpage(url_status).data
            season_episodes=scrapertools.find_single_match(data_status,'"(number_of_episodes":\d+,"number_of_seasons":\d+,)"')
            season_episodes=re.sub(r'"','',season_episodes)
            season_episodes=re.sub(r'number_of_episodes','Episodios ',season_episodes)
            season_episodes=re.sub(r'number_of_seasons','Temporadas',season_episodes)
            season_episodes=re.sub(r'_',' ',season_episodes)
            status = scrapertools.find_single_match(data_status,'"status":"(.*?)"')
            if status== "Ended":
                status ="Finalizada"
            else:
                status = "En emisión"
            status = status +" ("+ season_episodes+")"
            status= re.sub(r',','.',status)
            #######

            fan = re.sub(r'\\|"','',fan)

            try:
             #rating tvdb
             url_rating_tvdb = "http://thetvdb.com/api/1D62F2F90030C444/series/"+id+"/es.xml"
             print "pepote"
             print url_rating_tvdb
             data = httptools.downloadpage(url_rating_tvdb).data
             rating =scrapertools.find_single_match(data,'<Rating>(.*?)<')
            except:
              ratintg_tvdb = ""
              try:
                rating = scrapertools.get_match(data,'"vote_average":(.*?),')
              except:
                
                rating = "Sin puntuación"
         
            id_scraper =id_tmdb+"|"+"serie"+"|"+rating_filma+"|"+critica+"|"+rating+"|"+status #+"|"+emision
            posterdb = scrapertools.find_single_match(data_tmdb,'"poster_path":(.*?)","popularity"')

            if "null" in posterdb:
                posterdb = item.thumbnail
            else:
                posterdb = re.sub(r'\\|"','',posterdb)
                posterdb =  "https://image.tmdb.org/t/p/original" + posterdb
            if "null" in fan:
                fanart = "http://s6.postimg.org/qcbsfbvm9/verseriesnofan2.jpg"
            else:
                fanart="https://image.tmdb.org/t/p/original" + fan

            if fanart =="http://s6.postimg.org/qcbsfbvm9/verseriesnofan2.jpg":
                fanart_info = fanart
                fanart_2 = fanart
                fanart_3 = fanart
                fanart_4 = fanart
            else:
             url ="http://api.themoviedb.org/3/tv/"+id_tmdb+"/images?api_key="+api_key

             data = httptools.downloadpage(url).data
             data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)

             file_path= scrapertools.find_multiple_matches(data, '"file_path":"(.*?)"')
             if len(file_path)>= 5:
                fanart_info = "https://image.tmdb.org/t/p/original" + file_path[1]
                fanart_2 = "https://image.tmdb.org/t/p/original" + file_path[2]
                fanart_3 = "https://image.tmdb.org/t/p/original" + file_path[3]
                fanart_4 = "https://image.tmdb.org/t/p/original" + file_path[4]
                if fanart== "http://s6.postimg.org/qcbsfbvm9/verseriesnofan2.jpg":
                    fanart= "https://image.tmdb.org/t/p/original" + fanart_info
             elif len(file_path)== 4  :
                fanart_info = "https://image.tmdb.org/t/p/original" + file_path[1]
                fanart_2 = "https://image.tmdb.org/t/p/original" + file_path[2]
                fanart_3 = "https://image.tmdb.org/t/p/original" + file_path[3]
                fanart_4 = "https://image.tmdb.org/t/p/original" + file_path[1]
                if fanart== "http://s6.postimg.org/qcbsfbvm9/verseriesnofan2.jpg":
                    fanart= "https://image.tmdb.org/t/p/original" + fanart_info
             elif len(file_path)== 3:
                fanart_info = "https://image.tmdb.org/t/p/original" + file_path[1]
                fanart_2 = "https://image.tmdb.org/t/p/original" + file_path[2]
                fanart_3 = "https://image.tmdb.org/t/p/original" + file_path[1]
                fanart_4 = "https://image.tmdb.org/t/p/original" + file_path[0]
                if fanart== "http://s6.postimg.org/qcbsfbvm9/verseriesnofan2.jpg":
                    fanart= "https://image.tmdb.org/t/p/original" + fanart_info
             elif len(file_path)== 2:
                fanart_info = "https://image.tmdb.org/t/p/original" + file_path[1]
                fanart_2 = "https://image.tmdb.org/t/p/original" + file_path[0]
                fanart_3 = "https://image.tmdb.org/t/p/original" + file_path[1]
                fanart_4 = "https://image.tmdb.org/t/p/original" + file_path[1]
                if fanart== "http://s6.postimg.org/qcbsfbvm9/verseriesnofan2.jpg":
                    fanart= "https://image.tmdb.org/t/p/original" + fanart_info
             else:
                fanart_info = fanart
                fanart_2 = fanart
                fanart_3 = fanart
                fanart_4 = fanart


            url ="http://webservice.fanart.tv/v3/tv/"+id+"?api_key="+api_fankey
            data = httptools.downloadpage(url).data
            data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;","",data)
            patron = '"clearlogo":.*?"url": "([^"]+)"'
            matches = re.compile(patron,re.DOTALL).findall(data)
            if '"tvbanner"' in data:
                tvbanner = scrapertools.get_match(data,'"tvbanner":.*?"url": "([^"]+)"')
                tfv=tvbanner
            elif '"tvposter"' in data:
                tvposter = scrapertools.get_match(data,'"tvposter":.*?"url": "([^"]+)"')
                tfv=tvposter
            else:
                tfv = posterdb
            if '"tvthumb"' in data:
                tvthumb = scrapertools.get_match(data,'"tvthumb":.*?"url": "([^"]+)"')
            if '"hdtvlogo"' in data:
                hdtvlogo = scrapertools.get_match(data,'"hdtvlogo":.*?"url": "([^"]+)"')
            if '"hdclearart"' in data:
                hdtvclear = scrapertools.get_match(data,'"hdclearart":.*?"url": "([^"]+)"')
            if len(matches)==0:
                if '"hdtvlogo"' in data:
                    if "showbackground" in data:
                
                        if '"hdclearart"' in data:
                            thumbnail = hdtvlogo
                            extra=  hdtvclear+"|"+year
                            show = fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        else:
                            thumbnail = hdtvlogo
                            extra= thumbnail+"|"+year
                            show = fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        itemlist.append( Item(channel=item.channel, title = item.title , action="temporadas", url=item.url, server="torrent", thumbnail=thumbnail, fanart=fanart, category=category, extra=extra, show=show, folder=True) )
                                                                        
                                                                        
                    else:
                        if '"hdclearart"' in data:
                            thumbnail= hdtvlogo
                            extra= hdtvclear+"|"+year
                            show= fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        else:
                            thumbnail= hdtvlogo
                            extra= thumbnail+"|"+year
                            show= fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        itemlist.append( Item(channel=item.channel, title = item.title , action="temporadas", url=item.url, server="torrent", thumbnail=thumbnail, fanart=fanart, extra=extra, show=show,  category= category, folder=True) )
                else:
                    extra=  ""+"|"+year
                    show = fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                    itemlist.append( Item(channel=item.channel, title = item.title , action="temporadas", url=item.url,  server="torrent", thumbnail=posterdb, fanart=fanart, extra=extra, show=show, category = category, folder=True) )
                                                                                                                                
            for logo in matches:
                if '"hdtvlogo"' in data:
                    thumbnail = hdtvlogo
                elif not '"hdtvlogo"' in data :
                        if '"clearlogo"' in data:
                            thumbnail= logo
                else:
                    thumbnail= item.thumbnail
                if '"clearart"' in data:
                    clear=scrapertools.get_match(data,'"clearart":.*?"url": "([^"]+)"')
                    if "showbackground" in data:
                                
                        extra=clear+"|"+year
                        show= fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        itemlist.append( Item(channel=item.channel, title = item.title , action="temporadas", url=item.url, server="torrent", thumbnail=thumbnail, fanart=fanart, extra=extra,show=show, category= category,  folder=True) )
                    else:
                        extra= clear+"|"+year
                        show=fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        itemlist.append( Item(channel=item.channel, title = item.title , action="temporadas", url=item.url, server="torrent", thumbnail=thumbnail, fanart=fanart, extra=extra,show=show, category= category, folder=True) )
                                     
                if "showbackground" in data:
                        
                    if '"clearart"' in data:
                        clear=scrapertools.get_match(data,'"clearart":.*?"url": "([^"]+)"')
                        extra=clear+"|"+year
                        show= fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                    else:
                        extra=logo+"|"+year
                        show= fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        itemlist.append( Item(channel=item.channel, title = item.title , action="temporadas", url=item.url, server="torrent", thumbnail=thumbnail, fanart=fanart, extra=extra,show=show,  category = category, folder=True) )
                                     
                if not '"clearart"' in data and not '"showbackground"' in data:
                        if '"hdclearart"' in data:
                            extra= hdtvclear+"|"+year
                            show= fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        else:
                            extra= thumbnail+"|"+year
                            show=  fanart_2+"|"+fanart_3+"|"+sinopsis+"|"+title_fan+"|"+tfv+"|"+id_tmdb+"|"+fanart_4
                        itemlist.append( Item(channel=item.channel, title = item.title , action="temporadas", url=item.url, server="torrent", thumbnail=thumbnail, fanart=fanart, extra=extra,show=show , category = category, folder=True) )
    title ="Info"
    title_info = title.replace(title,"[COLOR seagreen]"+title+"[/COLOR]")
    
    
    if '"tvposter"' in data:
            thumbnail= scrapertools.get_match(data,'"tvposter":.*?"url": "([^"]+)"')
    else:
        thumbnail = posterdb
        
    if "tvbanner" in data:
        category = tvbanner
    else:
        category = show
    if '"tvthumb"' in data:
        plot = item.plot+"|"+tvthumb
    else:
        plot = item.plot+"|"+item.thumbnail
    if '"tvbanner"' in data:
        plot=plot+"|"+ tvbanner
    elif '"tvthumb"' in data:
        plot=plot+"|"+ tvthumb
    else:
        plot=plot+"|"+ item.thumbnail


    id = id_scraper
    
    extra = extra+"|"+id+"|"+title.encode('utf8')
    
    itemlist.append( Item(channel=item.channel, action="info" , title=title_info , url=item.url, thumbnail=thumbnail, fanart=fanart_info, extra= extra, category = category,plot=plot, show= show, viewmode="movie_with_plot", folder=False ))

    return itemlist
コード例 #35
0
def fanart(item):
    logger.info()
    itemlist = []
    url = item.url
    data = scrapertools.cachePage(url)
    data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;", "", data)
    title_fan = item.extra.split("|")[1]
    title = re.sub(r'Serie Completa|Temporada.*?Completa', '', title_fan)
    fulltitle = title
    title = title.replace(' ', '%20')
    title = ''.join(
        (c
         for c in unicodedata.normalize('NFD', unicode(title.decode('utf-8')))
         if unicodedata.category(c) != 'Mn'))
    try:
        sinopsis = scrapertools.find_single_match(
            data, '<span class="clms">Sinopsis: <\/span>(.*?)<\/div>')
    except:
        sinopsis = ""
    year = item.extra.split("|")[0]

    if not "series" in item.url:

        # filmafinity
        url = "http://www.filmaffinity.com/es/advsearch.php?stext={0}&stype%5B%5D=title&country=&genre=&fromyear={1}&toyear={1}".format(
            title, year)
        data = scrapertools.downloadpage(url)

        url_filmaf = scrapertools.find_single_match(
            data, '<div class="mc-poster">\s*<a title="[^"]*" href="([^"]+)"')
        if url_filmaf:
            url_filmaf = "http://www.filmaffinity.com%s" % url_filmaf
            data = scrapertools.downloadpage(url_filmaf)
        else:

            try:
                url_bing = "http://www.bing.com/search?q=%s+%s+site:filmaffinity.com" % (
                    title.replace(' ', '+'), year)
                data = browser(url_bing)
                data = re.sub(r'\n|\r|\t|\s{2}|&nbsp;', '', data)

                if "myaddrproxy.php" in data:
                    subdata_bing = scrapertools.get_match(
                        data,
                        'li class="b_algo"><div class="b_title"><h2>(<a href="/ myaddrproxy.php/http/www.filmaffinity.com/es/film.*?)"'
                    )
                    subdata_bing = re.sub(r'\/myaddrproxy.php\/http\/', '',
                                          subdata_bing)
                else:
                    subdata_bing = scrapertools.get_match(
                        data,
                        'li class="b_algo"><h2>(<a href="http://www.filmaffinity.com/es/film.*?)"'
                    )

                url_filma = scrapertools.get_match(subdata_bing,
                                                   '<a href="([^"]+)')

                if not "http" in url_filma:
                    data = scrapertools.cachePage("http://" + url_filma)
                else:
                    data = scrapertools.cachePage(url_filma)
                data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;", "", data)

            except:
                pass

        if sinopsis == " ":
            try:
                sinopsis = scrapertools.find_single_match(
                    data, '<dd itemprop="description">(.*?)</dd>')
                sinopsis = sinopsis.replace("<br><br />", "\n")
                sinopsis = re.sub(r"\(FILMAFFINITY\)<br />", "", sinopsis)
            except:
                pass
        try:
            rating_filma = scrapertools.get_match(
                data, 'itemprop="ratingValue" content="(.*?)">')
        except:
            rating_filma = "Sin puntuacion"

        critica = ""
        patron = '<div itemprop="reviewBody">(.*?)</div>.*?itemprop="author">(.*?)\s*<i alt="([^"]+)"'
        matches_reviews = scrapertools.find_multiple_matches(data, patron)

        if matches_reviews:
            for review, autor, valoracion in matches_reviews:
                review = dhe(scrapertools.htmlclean(review))
                review += "\n" + autor + "[CR]"
                review = re.sub(r'Puntuac.*?\)', '', review)
                if "positiva" in valoracion:
                    critica += "[COLOR green][B]%s[/B][/COLOR]\n" % review
                elif "neutral" in valoracion:
                    critica += "[COLOR yellow][B]%s[/B][/COLOR]\n" % review
                else:
                    critica += "[COLOR red][B]%s[/B][/COLOR]\n" % review
        else:
            critica = "[COLOR floralwhite][B]Esta película no tiene críticas todavía...[/B][/COLOR]"
        print "ozuu"
        print critica

        url = "http://api.themoviedb.org/3/search/movie?api_key=2e2160006592024ba87ccdf78c28f49f&query=" + title + "&year=" + year + "&language=es&include_adult=false"
        data = scrapertools.cachePage(url)
        data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;", "", data)
        patron = '"page":1.*?,"id":(.*?),.*?"backdrop_path":(.*?),'
        matches = re.compile(patron, re.DOTALL).findall(data)

        if len(matches) == 0:

            title = re.sub(r":.*|\(.*?\)", "", title)
            url = "http://api.themoviedb.org/3/search/movie?api_key=2e2160006592024ba87ccdf78c28f49f&query=" + title + "&language=es&include_adult=false"

            data = scrapertools.cachePage(url)
            data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;", "", data)
            patron = '"page":1.*?,"id":(.*?),.*?"backdrop_path":(.*?),'
            matches = re.compile(patron, re.DOTALL).findall(data)
            if len(matches) == 0:
                extra = item.thumbnail + "|" + "" + "|" + "" + "|" + "Sin puntuación" + "|" + rating_filma + "|" + critica
                show = item.fanart + "|" + "" + "|" + sinopsis
                posterdb = item.thumbnail
                fanart_info = item.fanart
                fanart_3 = ""
                fanart_2 = item.fanart
                category = item.thumbnail
                id_scraper = ""

                itemlist.append(
                    Item(channel=item.channel,
                         title=item.title,
                         url=item.url,
                         action="findvideos",
                         thumbnail=item.thumbnail,
                         fanart=item.fanart,
                         extra=extra,
                         show=show,
                         category=category,
                         library=item.library,
                         fulltitle=fulltitle,
                         folder=True))

        for id, fan in matches:

            fan = re.sub(r'\\|"', '', fan)

            try:
                rating = scrapertools.find_single_match(
                    data, '"vote_average":(.*?),')
            except:
                rating = "Sin puntuación"

            id_scraper = id + "|" + "peli" + "|" + rating + "|" + rating_filma + "|" + critica
            try:
                posterdb = scrapertools.get_match(
                    data, '"page":1,.*?"poster_path":"\\\(.*?)"')
                posterdb = "https://image.tmdb.org/t/p/original" + posterdb
            except:
                posterdb = item.thumbnail

            if "null" in fan:
                fanart = item.fanart
            else:
                fanart = "https://image.tmdb.org/t/p/original" + fan
            item.extra = fanart

            url = "http://api.themoviedb.org/3/movie/" + id + "/images?api_key=2e2160006592024ba87ccdf78c28f49f"
            data = scrapertools.cachePage(url)
            data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;", "", data)

            patron = '"backdrops".*?"file_path":".*?",.*?"file_path":"(.*?)",.*?"file_path":"(.*?)",.*?"file_path":"(.*?)"'
            matches = re.compile(patron, re.DOTALL).findall(data)

            if len(matches) == 0:
                patron = '"backdrops".*?"file_path":"(.*?)",.*?"file_path":"(.*?)",.*?"file_path":"(.*?)"'
                matches = re.compile(patron, re.DOTALL).findall(data)
                if len(matches) == 0:
                    fanart_info = item.extra
                    fanart_3 = ""
                    fanart_2 = item.extra
            for fanart_info, fanart_3, fanart_2 in matches:
                fanart_info = "https://image.tmdb.org/t/p/original" + fanart_info
                fanart_3 = "https://image.tmdb.org/t/p/original" + fanart_3
                fanart_2 = "https://image.tmdb.org/t/p/original" + fanart_2
                if fanart == item.fanart:
                    fanart = fanart_info
            # clearart, fanart_2 y logo
            url = "http://webservice.fanart.tv/v3/movies/" + id + "?api_key=dffe90fba4d02c199ae7a9e71330c987"
            data = scrapertools.cachePage(url)
            data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;", "", data)
            patron = '"hdmovielogo":.*?"url": "([^"]+)"'
            matches = re.compile(patron, re.DOTALL).findall(data)

            if '"moviedisc"' in data:
                disc = scrapertools.get_match(
                    data, '"moviedisc":.*?"url": "([^"]+)"')
            if '"movieposter"' in data:
                poster = scrapertools.get_match(
                    data, '"movieposter":.*?"url": "([^"]+)"')
            if '"moviethumb"' in data:
                thumb = scrapertools.get_match(
                    data, '"moviethumb":.*?"url": "([^"]+)"')
            if '"moviebanner"' in data:
                banner = scrapertools.get_match(
                    data, '"moviebanner":.*?"url": "([^"]+)"')

            if len(matches) == 0:
                extra = posterdb
                # "http://es.seaicons.com/wp-content/uploads/2015/11/Editing-Overview-Pages-1-icon.png"
                show = fanart_2 + "|" + fanart_3 + "|" + sinopsis
                category = posterdb

                itemlist.append(
                    Item(channel=item.channel,
                         title=item.title,
                         action="findvideos",
                         url=item.url,
                         server="torrent",
                         thumbnail=posterdb,
                         fanart=item.extra,
                         extra=extra,
                         show=show,
                         category=category,
                         library=item.library,
                         fulltitle=fulltitle,
                         folder=True))
            for logo in matches:
                if '"hdmovieclearart"' in data:
                    clear = scrapertools.get_match(
                        data, '"hdmovieclearart":.*?"url": "([^"]+)"')
                    if '"moviebackground"' in data:

                        extra = clear
                        show = fanart_2 + "|" + fanart_3 + "|" + sinopsis
                        if '"moviedisc"' in data:
                            category = disc
                        else:
                            category = clear
                        itemlist.append(
                            Item(channel=item.channel,
                                 title=item.title,
                                 action="findvideos",
                                 url=item.url,
                                 server="torrent",
                                 thumbnail=logo,
                                 fanart=item.extra,
                                 extra=extra,
                                 show=show,
                                 category=category,
                                 library=item.library,
                                 fulltitle=fulltitle,
                                 folder=True))
                    else:
                        extra = clear
                        show = fanart_2 + "|" + fanart_3 + "|" + sinopsis
                        if '"moviedisc"' in data:
                            category = disc
                        else:
                            category = clear
                        itemlist.append(
                            Item(channel=item.channel,
                                 title=item.title,
                                 action="findvideos",
                                 url=item.url,
                                 server="torrent",
                                 thumbnail=logo,
                                 fanart=item.extra,
                                 extra=extra,
                                 show=show,
                                 category=category,
                                 library=item.library,
                                 fulltitle=fulltitle,
                                 folder=True))

                if '"moviebackground"' in data:

                    if '"hdmovieclearart"' in data:
                        clear = scrapertools.get_match(
                            data, '"hdmovieclearart":.*?"url": "([^"]+)"')
                        extra = clear
                        show = fanart_2 + "|" + fanart_3 + "|" + sinopsis
                        if '"moviedisc"' in data:
                            category = disc
                        else:
                            category = clear
                    else:
                        extra = logo
                        show = fanart_2 + "|" + fanart_3 + "|" + sinopsis
                        if '"moviedisc"' in data:
                            category = disc
                        else:
                            category = logo

                        itemlist.append(
                            Item(channel=item.channel,
                                 title=item.title,
                                 action="findvideos",
                                 url=item.url,
                                 server="torrent",
                                 thumbnail=logo,
                                 fanart=item.extra,
                                 extra=extra,
                                 show=show,
                                 category=category,
                                 library=item.library,
                                 fulltitle=fulltitle,
                                 folder=True))

                if not '"hdmovieclearart"' in data and not '"moviebackground"' in data:
                    extra = logo
                    show = fanart_2 + "|" + fanart_3 + "|" + sinopsis
                    if '"moviedisc"' in data:
                        category = disc
                    else:
                        category = item.extra
                    itemlist.append(
                        Item(channel=item.channel,
                             title=item.title,
                             action="findvideos",
                             url=item.url,
                             thumbnail=logo,
                             fanart=item.extra,
                             extra=extra,
                             show=show,
                             category=category,
                             library=item.library,
                             fulltitle=fulltitle,
                             folder=True))

    title_info = "Info"

    if posterdb == item.thumbnail:
        if '"movieposter"' in data:
            thumbnail = poster
        else:
            thumbnail = item.thumbnail
    else:
        thumbnail = posterdb

    id = id_scraper

    extra = extra + "|" + id + "|" + title.encode('utf8')

    title_info = title_info.replace(
        title_info,
        bbcode_kodi2html("[COLOR skyblue]" + title_info + "[/COLOR]"))
    itemlist.append(
        Item(channel=item.channel,
             action="info",
             title=title_info,
             url=item.url,
             thumbnail=thumbnail,
             fanart=fanart_info,
             extra=extra,
             category=category,
             show=show,
             folder=False))

    return itemlist
コード例 #36
0
def mainlist(item):
    logger.info("pelisalacarta.topbongda mainlist")
    itemlist = []

    if item.extra != "next_page":
        item.url = "http://topbongda.com"  #/wendy/ajax/home_matches/?page=1"
        if not xbmc.Player().isPlaying():
            xbmc.executebuiltin('xbmc.PlayMedia(' + song + ')')
    data = dhe(get_page(item.url))
    data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;|&amp;", "", data)
    #data = jsontools.load_json(data)

    patrongames = '<nav class="display-list">(.*?)<div class="match-block mdl-shadow--2dp ng-cloak" ng-repeat="match_block in match_data" ng-if="match_data.length > 0">'
    matchesgames = re.compile(patrongames, re.DOTALL).findall(data)
    for bloque_games in matchesgames:
        patrondaygames = '<i class="material-icons md-18">date_range</i>(.*?)<small>(.*?)</div></li></ul></div>'
        matchesdaygames = re.compile(patrondaygames,
                                     re.DOTALL).findall(bloque_games)
        for fecha, bloque_partidos in matchesdaygames:
            fecha = fecha.strip()
            #LIVE
            patronlive = '<span class="time">(.*?)</span>.*?<span class="minute">(.*?)<i class="playing">.*?<strong>(.*?)</strong>.*?<img src="/myaddrproxy.php/(.*?)".*?class="score">(.*?)</a>.*?<img src="/myaddrproxy.php/(.*?)" alt=""></a><strong>(.*?)</strong>.*?<a href="/myaddrproxy.php/(.*?)"'
            matcheslive = re.compile(patronlive,
                                     re.DOTALL).findall(bloque_partidos)
            for hora, minuto, team1, thumbnail, score, fanart, team2, url in matcheslive:
                thumbnail = re.sub(r"https", "https:/", thumbnail)
                thumbnail = re.sub(r"_.*?\.", ".", thumbnail)
                fanart = re.sub(r"https", "https:/", fanart)
                fanart = re.sub(r"_.*?\.", ".", fanart)
                minuto = minuto.strip()
                if "HT" in minuto:
                    minuto = "Descanso"
                title = "[COLOR chartreuse][B]" + team1 + "[/B][/COLOR]" + "[COLOR yellowgreen]__[/COLOR]" + "[COLOR yellow][B]" + score + "[/B][/COLOR]" + "[COLOR yellowgreen]__[/COLOR]" + "[COLOR chartreuse][B]" + team2 + "[/B][/COLOR]"
                title = "[COLOR olivedrab]([/COLOR]" + "[COLOR yellowgreen][B]" + minuto + "[B][/COLOR]" + "[COLOR olivedrab])[/COLOR]" + " " + title + " " + "[COLOR crimson][B]LIVE!![/B][/COLOR]"
                url = re.sub(r"https/", "http://", url) + "sopcast"
                url = re.sub(r"/ti-le", "", url)
                if "default" in thumbnail:
                    thumbnail = "http://s6.postimg.org/bwlfc3fdd/topbongdafan.jpg"
                if "default" in fanart:
                    fanart = "http://s6.postimg.org/bwlfc3fdd/topbongdafan.jpg"
                itemlist.append(
                    Item(channel=__channel__,
                         title=title,
                         action="enlaces",
                         url=url,
                         thumbnail=thumbnail,
                         fanart=
                         "http://s6.postimg.org/bwlfc3fdd/topbongdafan.jpg",
                         fulltitle="[COLOR chartreuse][B]" + team1 + " Vs " +
                         team2 + "[/B][/COLOR]",
                         extra="LIVE",
                         folder=True))
            #NO LIVE
            patronnolive = '<div class="info"><span class="time">(\d+:\d+)</span><a href.*?class="league">(.*?)</a>.*?<strong>(.*?)</strong>.*?<img.*?"/myaddrproxy.php/(.*?)" alt="">.*?<img.*?"/myaddrproxy.php/(.*?)" alt=""></a><strong>(.*?)</strong>.*?<a href="/myaddrproxy.php/(.*?)" '
            matchesnolive = re.compile(patronnolive,
                                       re.DOTALL).findall(bloque_partidos)
            for hora, league, team1, thumbnail, fanart, team2, url in matchesnolive:

                thumbnail = re.sub(r"https", "https:/", thumbnail)
                thumbnail = re.sub(r"_.*?\.", ".", thumbnail)
                fanart = re.sub(r"https", "https:/", fanart)
                fanart = re.sub(r"_.*?\.", ".", fanart)

                from time import gmtime, strftime
                import time
                get_date = strftime("%Y-%m-%d %H:%M:%S", time.localtime())

                ok_date = re.compile('(\d+)-(\d+)-(\d+) (\d+:\d+:\d+)',
                                     re.DOTALL).findall(get_date)
                for year, mes, dia, current_hour in ok_date:
                    date = dia + "/" + mes + "/" + year
                    current_date = date

                if fecha == "Hôm Nay":
                    check_hour = scrapertools.get_match(
                        current_hour, '(\d+):\d+')
                    if check_hour >= "19":
                        dates = re.compile('(\d+)(/\d+/\d+)',
                                           re.DOTALL).findall(date)
                        for d, m_y in dates:
                            days = int(d) + 1
                            date = str(days) + m_y
                            extra = "nuevodia"
                    else:
                        date = date

                elif fecha == "Ngày Mai":
                    check_hour = scrapertools.get_match(
                        current_hour, '(\d+):\d+')
                    dates = re.compile('(\d+)(/\d+/\d+)',
                                       re.DOTALL).findall(date)
                    for d, m_y in dates:
                        # check_hour ="00"
                        if check_hour >= "19":

                            days = int(d) + 2
                            date = str(days) + m_y
                        else:
                            days = int(d) + 1
                            date = str(days) + m_y

                else:
                    check_hour = scrapertools.get_match(
                        current_hour, '(\d+):\d+')
                    dates = re.compile('(\d+)(/\d+/\d+)',
                                       re.DOTALL).findall(fecha)
                    for d, m_y in dates:
                        if check_hour >= "19":
                            days = int(d) - 1
                            date = str(days) + m_y
                        else:
                            date = fecha
                time = re.compile('(\d+):(\d+)', re.DOTALL).findall(hora)
                #Corregimos las 5h de diferencia horaria con Vietnam
                for horas, minutos in time:
                    if horas == "00":
                        horas = horas.replace("00", "24")
                        #if minutos != "00":
                        dates = re.compile('(\d+)(/\d+/\d+)',
                                           re.DOTALL).findall(date)
                        for d, m_y in dates:
                            days = int(d) - 1
                            date = str(days) + m_y

                    check = re.compile('(\d)\d', re.DOTALL).findall(horas)
                    if "0" in check:
                        horas = horas.replace("0", "")
                        horas = 24 + int(horas)
                        dates = re.compile('(\d+)(/\d+/\d+)',
                                           re.DOTALL).findall(date)
                        for d, m_y in dates:
                            days = int(d) - 1
                            date = str(days) + m_y

                    wrong_time = int(horas)
                    value = 5
                    correct_time = wrong_time - value

                    if correct_time > 24:
                        correct_time = int(correct_time) - 24

                        dates = re.compile('(\d+)(/\d+/\d+)',
                                           re.DOTALL).findall(date)
                        for d, m_y in dates:
                            days = int(d) + 1
                            date = str(days) + m_y
                    correct_time = '%02d' % int(correct_time)

                    ok_time = correct_time + ":" + minutos
                if "24:" in ok_time:
                    ok_time = ok_time.replace("24:", "00:")
                    dates = re.compile('(\d+)(/\d+/\d+)',
                                       re.DOTALL).findall(date)
                    for d, m_y in dates:
                        days = int(d) + 1
                        date = str(days) + m_y

                check_date = scrapertools.get_match(date, '(\d+)/\d+/\d+')
                check_date = check_date.strip()

                if int(check_date) < 10:
                    if "0" in (check_date):
                        continue

                    date = "0" + date
                if "Ngoại Hạng Anh" in league:
                    league = "Premier League"
                if "Hạng Nhất Anh" in league:
                    league = "Premier League"

                extra = ok_time + "|" + date
                title = team1 + " Vs " + team2
                title = "[COLOR chartreuse]" + ok_time + "[/COLOR]" + "[COLOR olivedrab]--[/COLOR]" + "[COLOR gold]" + date + "[/COLOR]" + " " + "[COLOR seagreen][B]" + title + "[/B][/COLOR]" + " " + "[COLOR olivedrab]([/COLOR]" + "[COLOR yellowgreen]" + league + "[/COLOR]" + "[COLOR olivedrab])[/COLOR]"
                if "default" in thumbnail:
                    thumbnail = "http://s6.postimg.org/bwlfc3fdd/topbongdafan.jpg"
                if "default" in fanart:
                    fanart = "http://s6.postimg.org/bwlfc3fdd/topbongdafan.jpg"
                itemlist.append(
                    Item(channel=__channel__,
                         title=title,
                         action="enlaces",
                         url=url,
                         thumbnail=thumbnail,
                         fanart=fanart,
                         fulltitle="[COLOR seagreen][B]" + team1 + " Vs " +
                         team2 + "[/B][/COLOR]",
                         extra=extra,
                         folder=True))

    return itemlist