def listado(item): logger.info() itemlist = [] data = httptools.downloadpage(item.url).data data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) patron = '<div class="MiniFicha">.*?' patron += '<img src="([^"]+).*?' patron += '<div class="MiniF_TitleSpecial">[^>]+>([^<]+).*?' patron += '<b>Categoria:\s*</b>([^&]+)»\s*([^<]+).*?' patron += '<div class="OpcionesDescargasMini">(.*?)</div>' matches = re.compile(patron, re.DOTALL).findall(data) for thumbnail, title, cat_padres, cat_hijos, opciones in matches: #logger.debug(thumbnail + "\n" + title + "\n" + cat_padres + "\n" + cat_hijos + "\n" + opciones) # Obtenemos el año del titulo y eliminamos lo q sobre patron = '\d{4}$' year = scrapertools.find_single_match(title, patron) if year: title = re.sub(patron, "", title) patron = '\s?-?\s?(line)?\s?-\s?$' regex = re.compile(patron, re.I) title = regex.sub("", title) # Obtenemos la imagen b por q es mayor thumbnail = HOST + thumbnail[:-5] + 'b' + thumbnail[-4:] # Buscamos opcion de ver online patron = '<a href="http://estrenosly.org/ver-online-([^"]+)' url_ver = scrapertools.find_single_match(opciones, patron) if url_ver: new_item = Item(channel=item.channel, action="findvideos", title=title, thumbnail=thumbnail, url=url_ver, infoLabels={"year": year}, text_color=color1) cat_padres = cat_padres.strip() if cat_padres in ["peliculas-dvdrip", "HDRIP", "cartelera"]: #if item.extra == 'movie': new_item.contentTitle = title new_item.extra = "movie" # Filtramos nombres validos para la calidad patron = ("rip|dvd|screener|hd|ts|Telesync") if re.search(patron, cat_hijos, flags=re.IGNORECASE): new_item.contentQuality = cat_hijos new_item.title = "%s [%s]" % (title, cat_hijos) elif cat_padres == "peliculas-dvdrip": new_item.contentQuality = "DVDRIP" new_item.title = "%s [DVDRIP]" % title elif cat_padres == "HDRIP": new_item.contentQuality = "HDRIP" new_item.title = "%s [HDRIP]" % title elif cat_padres == "series": new_item.contentSerieName = cat_hijos patron = re.compile('(\d+)x(\d+)') matches = patron.findall(title) if len(matches) == 1: new_item.contentSeason = matches[0][0] new_item.contentEpisodeNumber = matches[0][1].zfill(2) new_item.extra = "episodie" else: # matches == [('1', '01'), ('1', '02'), ('1', '03')] new_item.extra = "multi-episodie" else: #Otras categorias q de momento no nos interesan continue ''' Opcionalmente podriamos obtener los enlaces torrent y descargas directas patron = '<a href="http://estrenosli.org/descarga-directa-([^"]+)' new_item.url_descarga = scrapertools.find_single_match(opciones,patron) patron = '<a href="http://estrenosli.org/descargar-torrent-([^"]+).*?' new_item.url_torrent = scrapertools.find_single_match(opciones,patron)''' itemlist.append(new_item) if itemlist: # Obtenemos los datos basicos de todas las peliculas mediante multihilos tmdb.set_infoLabels(itemlist) # Si es necesario añadir paginacion patron = '<div class="sPages">.*?' patron += '<a href="([^"]+)">Siguiente' url_next_page = scrapertools.find_single_match(data, patron) if url_next_page: itemlist.append( Item(channel=item.channel, action="listado", title=">> Página siguiente", thumbnail=thumbnail_host, url=HOST + url_next_page, folder=True, text_color=color3, text_blod=True)) return itemlist
def listado(item): logger.info() itemlist = [] data = httptools.downloadpage(item.url).data data = re.sub(r"\n|\r|\t|\s{2}| ","",data) patron = '<div class="MiniFicha">.*?' patron += '<img src="([^"]+).*?' patron += '<div class="MiniF_TitleSpecial">[^>]+>([^<]+).*?' patron += '<b>Categoria:\s*</b>([^&]+)»\s*([^<]+).*?' patron += '<div class="OpcionesDescargasMini">(.*?)</div>' matches = re.compile(patron,re.DOTALL).findall(data) for thumbnail, title, cat_padres, cat_hijos, opciones in matches: #logger.debug(thumbnail + "\n" + title + "\n" + cat_padres + "\n" + cat_hijos + "\n" + opciones) # Obtenemos el año del titulo y eliminamos lo q sobre patron = '\d{4}$' year = scrapertools.find_single_match(title,patron) if year: title = re.sub(patron, "", title) patron = '\s?-?\s?(line)?\s?-\s?$' title = re.sub(patron, "", title,flags=re.IGNORECASE) # Obtenemos la imagen b por q es mayor thumbnail = HOST + thumbnail[:-5] + 'b' + thumbnail[-4:] # Buscamos opcion de ver online patron = '<a href="http://estrenosly.org/ver-online-([^"]+)' url_ver = scrapertools.find_single_match(opciones, patron) if url_ver: new_item = Item(channel=item.channel, action="findvideos", title=title, thumbnail=thumbnail, url=url_ver, infoLabels={"year":year}, text_color = color1) cat_padres = cat_padres.strip() if cat_padres in ["peliculas-dvdrip", "HDRIP", "cartelera"]: #if item.extra == 'movie': new_item.contentTitle = title new_item.extra = "movie" # Filtramos nombres validos para la calidad patron = ("rip|dvd|screener|hd|ts|Telesync") if re.search(patron,cat_hijos,flags=re.IGNORECASE): new_item.contentQuality = cat_hijos new_item.title = "%s [%s]" % (title, cat_hijos) elif cat_padres == "peliculas-dvdrip": new_item.contentQuality = "DVDRIP" new_item.title = "%s [DVDRIP]" % title elif cat_padres == "HDRIP": new_item.contentQuality = "HDRIP" new_item.title = "%s [HDRIP]" % title elif cat_padres == "series": new_item.contentSerieName = cat_hijos patron = re.compile('(\d+)x(\d+)') matches = patron.findall(title) if len(matches) == 1: new_item.contentSeason = matches[0][0] new_item.contentEpisodeNumber = matches[0][1].zfill(2) new_item.extra = "episodie" else: # matches == [('1', '01'), ('1', '02'), ('1', '03')] new_item.extra = "multi-episodie" else: #Otras categorias q de momento no nos interesan continue ''' Opcionalmente podriamos obtener los enlaces torrent y descargas directas patron = '<a href="http://estrenosli.org/descarga-directa-([^"]+)' new_item.url_descarga = scrapertools.find_single_match(opciones,patron) patron = '<a href="http://estrenosli.org/descargar-torrent-([^"]+).*?' new_item.url_torrent = scrapertools.find_single_match(opciones,patron)''' itemlist.append(new_item) if itemlist: # Obtenemos los datos basicos de todas las peliculas mediante multihilos tmdb.set_infoLabels(itemlist) # Si es necesario añadir paginacion patron = '<div class="sPages">.*?' patron += '<a href="([^"]+)">Siguiente' url_next_page = scrapertools.find_single_match(data,patron) if url_next_page: itemlist.append(Item(channel=item.channel, action="listado", title=">> Página siguiente", thumbnail=thumbnail_host, url=HOST + url_next_page, folder=True, text_color = color3, text_blod=True)) return itemlist