Exemplo n.º 1
0
def findvideos(item):
    logger.info()

    itemlist = list()

    data = get_source(item.url)

    js_data = get_source("%sstatic/style/js/jquery.hdfull.view.min.js" % host)

    data_js = get_source("%sstatic/js/providers.js" % host)

    provs = alfaresolver.jhexdecode(data_js)

    data_decrypt = jsontools.load(alfaresolver.obfs(data, js_data))

    infolabels = item.infoLabels
    year = scrapertools.find_single_match(data, '<span>A&ntilde;o:\s*</span>.*?(\d{4})')
    infolabels["year"] = year

    matches = []

    for match in data_decrypt:
        if match['provider'] in provs:
            try:
                embed = provs[match['provider']]['t']
                url = provs[match['provider']]['d'] % match['code']
                matches.append([match['lang'], match['quality'], url, embed])
            except:
                pass

    for idioma, calidad, url, embed in matches:
        idioma = IDIOMAS.get(idioma.lower(), idioma)
        if not PY3: calidad = unicode(calidad, "utf8").upper().encode("utf8")
        title = "%s (" + calidad + ")(" + idioma + ")"

        itemlist.append(Item(channel=item.channel, action="play", title=title, url=url,
                             infoLabels=item.infoLabels, language=idioma, contentType=item.contentType,
                             quality=calidad))

    itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server.capitalize())

    # Requerido para FilterTools
    itemlist = filtertools.get_links(itemlist, item, list_language)

    # Requerido para AutoPlay
    autoplay.start(itemlist, item)

    itemlist = sorted(itemlist, key=lambda i: i.language)
    if config.get_videolibrary_support() and itemlist and not item.contentSerieName and not item.extra:
            itemlist.append(Item(channel=item.channel, title='[COLOR yellow]{}[/COLOR]'.format(config.get_localized_string(60353)),
                                 action="add_pelicula_to_library", url=item.url, thumbnail = item.thumbnail,
                                 contentTitle=item.contentTitle, infoLabels=item.infoLabels, extra="findvideos"
                                 ))

    return itemlist
Exemplo n.º 2
0
def findvideos(item):
    logger.info()
    itemlist = []
    it1 = []
    it2 = []

    ## Carga estados
    status = check_status()

    url_targets = item.url

    ## Vídeos
    id = ""
    type = ""
    calidad = ""
    if "###" in item.url:
        id = item.url.split("###")[1].split(";")[0]
        type = item.url.split("###")[1].split(";")[1]
        item.url = item.url.split("###")[0]

    if type == "2" and account and item.category != "Cine":
        title = " [COLOR orange][B]( Agregar a Favoritos )[/B][/COLOR]"
        if "Favorito" in item.title:
            title = " [COLOR darkgrey][B]( Quitar de Favoritos )[/B][/COLOR]"

        it1.append(
            Item(channel=item.channel,
                 action="set_status",
                 title=title,
                 url=url_targets,
                 thumbnail=item.thumbnail,
                 contentTitle=item.contentTitle,
                 language=item.language,
                 folder=True))
    js_url = urlparse.urljoin(
        host, "/templates/hdfull/js/jquery.hdfull.view.min.js")
    js_data = agrupa_datos(js_url)

    data_js_url = urlparse.urljoin(host, "/js/providers.js")
    data_js = agrupa_datos(data_js_url)

    provs = alfaresolver.jhexdecode(data_js)

    data = agrupa_datos(item.url, force_check=True, force_login=True)
    try:
        data_decrypt = jsontools.load(alfaresolver.obfs(data, js_data))
    except:
        return []

    infolabels = item.infoLabels
    year = scrapertools.find_single_match(data,
                                          '<span>Año:\s*</span>.*?(\d{4})')
    infolabels["year"] = year
    matches = []
    for match in data_decrypt:
        if match['provider'] in provs:
            try:
                embed = provs[match['provider']]['t']
                url = provs[match['provider']]['d'] % match['code']
                matches.append([match['lang'], match['quality'], url, embed])
            except:
                pass

    for idioma, calidad, url, embed in matches:
        if embed == 'd':
            option = "Descargar"
            option1 = 2
        else:
            option = "Ver"
            option1 = 1

        idioma = IDIOMAS.get(idioma.lower(), idioma)
        if not PY3:
            calidad = unicode(calidad, "utf8").upper().encode("utf8")
        title = option + ": %s [COLOR greenyellow](" + calidad + ")[/COLOR] [COLOR darkgrey](" + idioma + ")[/COLOR]"
        plot = item.plot
        if not item.plot:
            plot = scrapertools.find_single_match(
                data, '<meta property="og:description" content="([^"]+)"')
            plot = scrapertools.htmlclean(plot)
            plot = re.sub('^.*?y latino', '', plot)
        fanart = scrapertools.find_single_match(
            data, '<div style="background-image.url. ([^\s]+)')
        if account:
            url += "###" + id + ";" + type
        it2.append(
            Item(channel=item.channel,
                 action="play",
                 title=title,
                 url=url,
                 plot=plot,
                 fanart=fanart,
                 contentSerieName=item.contentSerieName,
                 infoLabels=item.infoLabels,
                 language=idioma,
                 contentType=item.contentType,
                 tipo=option,
                 tipo1=option1,
                 quality=calidad))

    it2 = servertools.get_servers_itemlist(
        it2, lambda i: i.title % i.server.capitalize())
    it2.sort(key=lambda it: (it.tipo1, it.language, it.server))
    for item in it2:
        if "###" not in item.url:
            item.url += "###" + id + ";" + type
    itemlist.extend(it1)
    itemlist.extend(it2)

    ## 2 = película
    if type == "2" and item.category != "Cine":
        if config.get_videolibrary_support():
            itemlist.append(
                Item(
                    channel=item.channel,
                    title="Añadir a la videoteca",
                    text_color="greenyellow",
                    action="add_pelicula_to_library",
                    url=url_targets,
                    thumbnail=item.thumbnail,
                    contentTitle=item.contentTitle,
                    infoLabels=item.infoLabels,
                    quality=calidad,
                ))

    # Requerido para FilterTools
    itemlist = filtertools.get_links(itemlist, item, list_language)

    # Requerido para AutoPlay
    autoplay.start(itemlist, item)

    return itemlist
Exemplo n.º 3
0
def findvideos(item):
    logger.info()

    itemlist = list()

    data = get_source(item.url)

    js_data = get_source("%s/static/style/js/jquery.hdfull.view.min.js" % host)

    data_js = get_source("%s/static/js/providers.js" % host)
    decoded = alfaresolver.jhexdecode(data_js).replace("'", '"')

    providers_pattern = 'p\[(\d+)\]= {"t":"([^"]+)","d":".*?","e":.function.*?,"l":.function.*?return "([^"]+)".*?};'
    providers = scrapertools.find_multiple_matches(decoded, providers_pattern)

    provs = {}

    for provider, e, l in providers:
        provs[provider] = [e, l]

    try:
        data_decrypt = jsontools.load(alfaresolver.obfs(data, js_data))
    except:
        return itemlist

    infolabels = item.infoLabels
    year = scrapertools.find_single_match(
        data, '<span>A&ntilde;o:\s*</span>.*?(\d{4})')
    infolabels["year"] = year

    matches = []

    for match in data_decrypt:
        if match['provider'] in provs:
            try:
                embed = provs[match['provider']][0]
                url = provs[match['provider']][1] + match['code']
                matches.append([match['lang'], match['quality'], url, embed])
            except:
                pass

    for idioma, calidad, url, embed in matches:

        idioma = IDIOMAS.get(idioma.lower(), idioma)
        calidad = unicode(calidad, "utf8").upper().encode("utf8")
        title = "%s (" + calidad + ")(" + idioma + ")"

        itemlist.append(
            Item(channel=item.channel,
                 action="play",
                 title=title,
                 url=url,
                 infoLabels=item.infoLabels,
                 language=idioma,
                 contentType=item.contentType,
                 quality=calidad))

    itemlist = servertools.get_servers_itemlist(
        itemlist, lambda i: i.title % i.server.capitalize())

    # Requerido para FilterTools
    itemlist = filtertools.get_links(itemlist, item, list_language)

    # Requerido para AutoPlay
    autoplay.start(itemlist, item)

    itemlist = sorted(itemlist, key=lambda i: i.language)
    if config.get_videolibrary_support(
    ) and itemlist and not item.contentSerieName and item.extra != 'findvideos':
        itemlist.append(
            Item(channel=item.channel,
                 title=
                 '[COLOR yellow]Añadir esta pelicula a la videoteca[/COLOR]',
                 action="add_pelicula_to_library",
                 url=item.url,
                 thumbnail=item.thumbnail,
                 contentTitle=item.contentTitle,
                 infoLabels=item.infoLabels,
                 extra="findvideos"))

    return itemlist