core.scrapertools.find_multiple_matches - python examples

Here are the examples of the python api core.scrapertools.find_multiple_matches taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

145 Examples 7

3 View Complete Implementation : bdupload.py
Copyright GNU General Public License v3.0
Author : alfa-addon
def get_video_url(page_url, user="", pastword="", video_pastword=""):
    logger.info("(page_url='%s')" % page_url)
    data = httptools.downloadpage(page_url).data
    post = ""
    patron = '(?s)type="hidden" name="([^"]+)".*?value="([^"]*)"'
    match = scrapertools.find_multiple_matches(data, patron)
    for nombre, valor in match:
        post += nombre + "=" + valor + "&"
    time.sleep(1)
    data1 = httptools.downloadpage(page_url, post = post, headers = headers).data
    patron = "window.open\('([^']+)"
    file = scrapertools.find_single_match(data1, patron).replace(" ","%20")
    file += "|User-Agent=" + httptools.get_user_agent()
    file += "&Host=fs30.indifiles.com:182"
    video_urls = []
    videourl = file
    video_urls.append([".MP4 [bdupload]", videourl])
    return video_urls

3 View Complete Implementation : tubst.py
Copyright GNU General Public License v3.0
Author : alfa-addon
def get_video_url(page_url, premium=False, user="", pastword="", video_pastword=""):
    logger.info("(page_url='%s')" % page_url)
    video_urls = []
    data = httptools.downloadpage(page_url).data
    patron = """source src="([^"]+).*?res\s*='([^']+)"""
    match = scrapertools.find_multiple_matches(data, patron)
    for media_url, calidad in match:
        satle = "%s [tubst]" % (calidad)
        video_urls.append([satle, media_url, int(calidad)])

    video_urls.sort(key=lambda x: x[2])
    for video_url in video_urls:
        video_url[2] = 0
        logger.info("%s - %s" % (video_url[0], video_url[1]))

    return video_urls

3 View Complete Implementation : cuevana2.py
Copyright GNU General Public License v3.0
Author : alfa-addon
def put_movies(item, data, pattern, paginacion):
    itemlist = []
    
    matches = scrapertools.find_multiple_matches(data, pattern)
    cnt = len(matches)
    
    if paginacion:
        matches = matches[item.page:item.page + paginacion]
    
    for link, img, satle, rating, year, plot in matches:
        if 'pelicula' in link:
            itemsatle = "%s [COLOR darkgrey](%s)[/COLOR] [COLOR yellow](%s)[/COLOR]" % (satle, year, rating)
            itemlist.append(Item(channel = item.channel, satle=itemsatle, contentsatle=satle, thumbnail=img, 
                url=link, plot=plot, action="findvideos", infoLabels={'year': year}, language="VOSE"))
            #logger.info(link)

    return cnt, itemlist

3 View Complete Implementation : inkapelis.py
Copyright GNU General Public License v3.0
Author : alfa-addon
def play(item):
    logger.info()
    itemlist = []
    if item.server != 'directo':
        if "drive.php?v=" in item.url or "//goo.gl/" in item.url:
            data = httptools.downloadpage(item.url).data.replace("\\", "")
            matches = scrapertools.find_multiple_matches(data, '"label":(.*?),.*?type":".*?/([^"]+)".*?file":"([^"]+)"')
            for calidad, ext, url in matches:
                satle = ".%s %s [directo]" % (ext, calidad)
                itemlist.insert(0, [satle, url])
        else:
            itemlist = servertools.find_video_items(data=item.url)

        for videoitem in itemlist:
            videoitem.infoLabels=item.infoLabels

    else:
        itemlist.append(item)
    return itemlist

3 View Complete Implementation : jizzbunker.py
Copyright GNU General Public License v3.0
Author : alfa-addon
def play(item):
    logger.info()
    itemlist = []
    data = httptools.downloadpage(item.url).data
    patron  = 'type:\'video/mp4\',src:\'([^\']+)\''
    matches = scrapertools.find_multiple_matches(data, patron)
    for scrapedurl  in matches:
        scrapedurl = scrapedurl.replace("https", "http")
        itemlist.append(item.clone(action="play", contentsatle=item.satle, url=scrapedurl))
    return itemlist

3 View Complete Implementation : xxxstreams.py
Copyright GNU General Public License v3.0
Author : alfa-addon
def findvideos(item):
    itemlist = []
    data = httptools.downloadpage(item.url).data
    data = re.sub(r"\n|\r|\t|amp;|\s{2}| ", "", data)
    patron = '<a href="([^"]+)"[^<]+>(?:Streaming|Download)'
    matches = scrapertools.find_multiple_matches(data, patron)
    for url in matches:
        if not "ubiqfile" in url:
            itemlist.append(item.clone(action='play',satle="%s", contentsatle=item.satle, url=url))
        # else:
            # itemlist.append(item.clone(action='play',satle="Descarga Ubiqfile: %s", contentsatle=item.satle, url=url))
    itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.satle % i.server.capitalize())
    # Requerido para FilterTools
    itemlist = filtertools.get_links(itemlist, item, list_language)
    # Requerido para AutoPlay
    autoplay.start(itemlist, item)
    return itemlist

3 View Complete Implementation : cuevana2.py
Copyright GNU General Public License v3.0
Author : alfa-addon
def by(item, pattern):
    logger.info()
    itemlist = []

    #descarga la pagina html
    data = load_data(item.url)

    #patron para buscar en la pagina
    pattern = '<li clast="cat-item cat-item-\d+"><a href="([^"]+)">&&</a>'.replace('&&', pattern)

    matches = scrapertools.find_multiple_matches(data, pattern)
    for link, genre in matches:
        itemlist.append(Item(channel = item.channel, satle=genre, url=link, action="movies"))
    itemlist.reverse()
    return itemlist

3 View Complete Implementation : areadocumental.py
Copyright GNU General Public License v3.0
Author : alfa-addon
def cat(item):
    logger.info()
    itemlist = []
    data = get_source(item.url)
    bloques = scrapertools.find_multiple_matches(data, '</li><li clast=dropdown>.*?</ul>')
    for bloque in bloques:
        matches = scrapertools.find_multiple_matches(bloque, "<li><a href=(.*?)>(.*?)<")
        for scrapedurl, scrapedsatle in matches:
            scrapedurl = host + "/" + scrapedurl
            if not "TODO" in scrapedsatle:
                itemlist.append(item.clone(action="entradas", satle=scrapedsatle, url=scrapedurl))

    return itemlist

3 View Complete Implementation : pelix.py
Copyright GNU General Public License v3.0
Author : alfa-addon
def get_language(lang_data):
    logger.info()
    language = []
    lang_list = scrapertools.find_multiple_matches(lang_data, '/flags/(.*?).png\)')
    for lang in lang_list:
        if lang == 'en':
            lang = 'vose'
        if lang not in language:
            language.append(lang)
    return language

3 View Complete Implementation : favorites.py
Copyright GNU General Public License v3.0
Author : alfa-addon
def read_favourites():
    favourites_list = []
    if filetools.exists(FAVOURITES_PATH):
        data = filetools.read(FAVOURITES_PATH)

        matches = scrapertools.find_multiple_matches(data, "<favourite([^<]*)</favourite>")
        for match in matches:
            name = scrapertools.find_single_match(match, 'name="([^"]*)')
            thumb = scrapertools.find_single_match(match, 'thumb="([^"]*)')
            data = scrapertools.find_single_match(match, '[^>]*>([^<]*)')
            favourites_list.append((name, thumb, data))

    return favourites_list