def busqueda(item): logger.info() itemlist = [] host = detectar_host(item.channel) data = httptools.downloadpage(item.url).data # ~ logger.debug(data) patron = '<div class="poster-media-card">(.*?)(?:<li class="search-results-item media-item">|<footer>)' bloque = scrapertools.find_multiple_matches(data, patron) for match in bloque: # ~ logger.debug(match) patron = 'href="([^"]+)" title="([^"]+)".*?src="([^"]+)".*?' \ '<p class="search-results-main-info">.*?del año (\d+).*?' \ 'p class.*?>(.*?)<' matches = scrapertools.find_multiple_matches(match, patron) for scrapedurl, scrapedtitle, scrapedthumbnail, year, plot in matches: scrapedtitle = scrapedtitle.capitalize() plot = scrapertools.htmlclean(plot) new_item = Item(channel=item.channel, thumbnail=scrapedthumbnail, plot=plot) new_item.infoLabels["year"] = year if "/serie/" in scrapedurl: new_item.contentType = 'tvshow' new_item.contentSerieName = scrapedtitle new_item.action = 'temporadas' scrapedurl += "/episodios" elif "/pelicula/" in scrapedurl or "/adulto/" in scrapedurl: new_item.contentType = 'movie' new_item.contentTitle = scrapedtitle new_item.action = 'findvideos' # ~ filter_list = {"poster_path": limpiar_thumbnail(scrapedthumbnail)} # ~ new_item.infoLabels['filtro'] = filter_list.items() # parece que con filtro se detectan peor en tmdb !? else: logger.info('Enlace no tratado: %s' % scrapedurl) continue if item.search_type == 'all' or item.search_type == new_item.contentType: new_item.fmt_sufijo = '' if item.search_type != 'all' else new_item.contentType new_item.title = scrapedtitle new_item.url = scrapedurl itemlist.append(new_item) # ~ for it in itemlist: logger.debug(it) tmdb.set_infoLabels(itemlist) next_page = scrapertools.find_single_match( data, 'href="([^"]+)"[^>]+>Más resultados') if next_page != "" and len(bloque) > 0: next_page = urlparse.urljoin(host, next_page) itemlist.append( item.clone(title=">> Página siguiente", url=next_page, action='busqueda')) return itemlist