def generos(item): logger.info() itemlist = [] descartar_xxx = config.get_setting('descartar_xxx', default=False) if item.search_type == 'movie': url = host + 'peliculas' else: url = host + 'series' data = do_downloadpage(url) patron = '<a href="([^"]+)" class="category">.*?<div class="category-name">([^<]+)</div>\s*<div class="category-description">(\d+)' matches = re.compile(patron, re.DOTALL).findall(data) for url, title, cantidad in matches: if '/estrenos' in url or '/netflix' in url: continue if descartar_xxx and scrapertools.es_genero_xxx(title): continue if item.search_type == 'movie': itemlist.append( item.clone(action="list_pelis", title='%s (%s)' % (title, cantidad), url=url)) else: itemlist.append( item.clone(action="list_series", title='%s (%s)' % (title, cantidad), url=url)) # ~ return itemlist # orden por cantidad return sorted(itemlist, key=lambda it: it.title) # orden alfabético
def generos(item): logger.info() itemlist = [] descartar_xxx = config.get_setting('descartar_xxx', default=False) data = do_downloadpage(CHANNEL_HOST) bloque = scrapertools.find_single_match(data, '(?s)dos_columnas">(.*?)</ul>') patron = ' href="/([^"]+)">([^<]+)' matches = scrapertools.find_multiple_matches(bloque, patron) for scrapedurl, scrapedtitle in matches: if '/estrenos/' in scrapedurl: continue # se muestra en el menú principal if descartar_xxx and scrapertools.es_genero_xxx(scrapedtitle): continue itemlist.append( item.clone(action='peliculas', title=scrapedtitle.strip(), url=CHANNEL_HOST + scrapedurl)) if 'genero/belica/' not in bloque: itemlist.append( item.clone(action='peliculas', title='Bélica', url=CHANNEL_HOST + 'genero/belica/')) return sorted(itemlist, key=lambda it: it.title)
def subgeneros(item): logger.info() itemlist = [] descartar_xxx = config.get_setting('descartar_xxx', default=False) data = httptools.downloadpage(host, use_cache=True).data data = scrapertools.find_single_match(data, '<nav class="genres">(.*?)</nav>') matches1 = scrapertools.find_multiple_matches( data, '<a href="[^"]+"[^>]*>([^<]+)</a>\s*<i>[0-9.]+</i><ul class=\'children\'>(.*?)</ul>' ) for padre, hijos in matches1: matches = scrapertools.find_multiple_matches( hijos, '<a href="([^"]+)"[^>]*>([^<]+)</a>\s*<i>([0-9.]+)</i>') for url, title, num in matches: if num == '0': continue if descartar_xxx and scrapertools.es_genero_xxx(title): continue itemlist.append( item.clone(action='list_all', title='%s / %s (%s)' % (padre, title, num), url=url)) return itemlist
def generos(item): logger.info() itemlist = [] descartar_xxx = config.get_setting('descartar_xxx', default=False) data = httptools.downloadpage(host, use_cache=True).data data = scrapertools.find_single_match(data, '<nav class="genres">(.*?)</nav>') data = re.sub("<ul class='children'>.*?</ul>", '', data) # quitar subgéneros matches = scrapertools.find_multiple_matches( data, '<a href="([^"]+)"[^>]*>([^<]+)</a>\s*<i>([0-9.]+)</i>') for url, title, num in matches: if title.startswith('Años') or title.startswith('Siglo'): continue if 'genre/1001-peliculas-que-ver/' in url: continue if num == '0': continue if descartar_xxx and scrapertools.es_genero_xxx(title): continue itemlist.append( item.clone(action='list_all', title='%s (%s)' % (title, num), url=url)) return itemlist
def generos(item): logger.info() itemlist = [] descartes = ['estrenos', 'destacadas', 'castellano', 'latino', 'proximos-estrenos', 'dc','disney','dreamworks-animation','marvel','netflix','youtube-peliculas'] descartar_xxx = config.get_setting('descartar_xxx', default=False) data = httptools.downloadpage(host).data data = scrapertools.find_single_match(data, '<nav class="genres">(.*?)</nav>') matches = re.compile('<li class="cat-item[^"]*"><a href="([^"]+)"(?: title="[^"]*"|)>([^<]+)</a>\s*<i>([^<]+)</i>', re.DOTALL).findall(data) for url, title, cantidad in matches: if cantidad == '0': continue if descartar_xxx and scrapertools.es_genero_xxx(title): continue # Descartar los que ya están en el menú principal descartar = False for x in descartes: if url.endswith('/'+x+'/'): descartar = True break if descartar: continue # ~ titulo = '%s (%s)' % (title.strip().capitalize(), cantidad) titulo = title.strip().capitalize() itemlist.append(item.clone( title=titulo, url=url, action='list_all' )) return sorted(itemlist, key=lambda it: it.title)
def generos(item): logger.info() itemlist = [] descartar_xxx = config.get_setting('descartar_xxx', default=False) data = do_downloadpage(host) matches = re.compile( '<li><a href="([^"]+)"><i class="fa fa-bookmark-o"></i> ([^<]+)</a></li>', re.DOTALL).findall(data) for url, title in matches: if descartar_xxx and scrapertools.es_genero_xxx(title): continue itemlist.append(item.clone(title=title, url=url, action='list_all')) return itemlist
def generos(item): logger.info() itemlist = [] descartar_xxx = config.get_setting('descartar_xxx', default=False) data = httptools.downloadpage(host).data bloque = scrapertools.find_single_match(data, '<h3>Géneros(.*?)</ul>') patron = '<li[^>]*><a href="([^"]+)" title="[^"]*">([^<]+)</a></li>' matches = scrapertools.find_multiple_matches(bloque, patron) if not matches: patron = '<li[^>]*><a href=([^ ]+) title="[^"]*">([^<]+)</a></li>' matches = scrapertools.find_multiple_matches(bloque, patron) for url, titulo in matches: if descartar_xxx and scrapertools.es_genero_xxx(titulo): continue itemlist.append(item.clone(title=titulo, url=url, action='list_all')) return itemlist
def generos(item): logger.info() itemlist = [] descartar_xxx = config.get_setting('descartar_xxx', default=False) data = httptools.downloadpage(host).data if item.search_type == 'movie': data = data.split('<div id="serieshome"')[0] else: data = data.split('<div id="serieshome"')[1] matches = re.compile( '<li class="cat-item[^"]*"><a href="([^"]+)"(?: title="[^"]*"|)>([^<]+)</a>\s*<span>([^<]+)</span></li>', re.DOTALL).findall(data) for url, title, cantidad in matches: if cantidad == '0': continue if descartar_xxx and scrapertools.es_genero_xxx(title): continue titulo = '%s (%s)' % (title.strip().capitalize(), cantidad) itemlist.append(item.clone(title=titulo, url=url, action='list_all')) return sorted(itemlist, key=lambda it: it.title)