\(([^>]+)\)<\/a><\/td>' #título
+ patron += '| ([^>]+)<\/td><\/tr>' #calidad y tipo de contenido
+ matches_alt = scrapertools.find_multiple_matches(data, patron)
+
+ i = 0
+ if len(matches_alt) > 0:
+ status = True
+ for scrapedurl, scrapedtitle, scrapedquality, scrapedtype in matches_alt:
+ if scrapedtype not in ['Juegos', 'Capitulos', 'Musica']: #limpiamos de contenidos no deseados
+ matches.append(matches_alt[i]) #acumulamos los títulos
+ i += 1
+ cnt_title = len(matches) #número de títulos a pintar
+
+ if not matches_alt and not 'Se han encontrado0 resultado(s).' in data and not "Introduce alguna palabra para buscar con al menos 3 letras" in data and status is False: #error
+ item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
+ if item.intervencion: #Sí ha sido clausurada judicialmente
+ item, itemlist = generictools.post_tmdb_listado(item, itemlist) #Llamamos al método para el pintado del error
+ return itemlist #Salimos
+
+ logger.error("ERROR 02: LISTADO_BUSQUEDA: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
+ itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: LISTADO_BUSQUEDA: Ha cambiado la estructura de la Web. Reportar el error con el log'))
+ item, itemlist = generictools.post_tmdb_listado(item, itemlist) #Llamamos al método para el pintado del error
+ return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
+
+ #Capturamos el num. de la última página para informala a pié de página
+ try:
+ last_page = int(scrapertools.find_single_match(data, 'Se han encontrado(\d+)<\/b> resultado\(s\).'))
+ last_page = (last_page / total_pag) + 1
+ except:
+ last_page = 0
+ pass
+
+ curr_page_num = int(scrapertools.find_single_match(url_next_page, '\/page\/(\d+)\/$'))
+ if (curr_page_num + 1) <= last_page: #Tenemos la pantalla llena?
+ url_next_page = re.sub(r'\/page\/\d+\/$', '/page/%s/' % str(curr_page_num + 1), url_next_page) #actualizamos el num. pag.
+ else:
+ url_next_page = '' #si no hay más página, limpiamos para salir
+ cnt_title = 99
+
+ if cnt_title >= cnt_tot * 0.75: #Si el num. de títulos supera el límite, salimos del loop
+ cnt_title = 99
+
+ #logger.debug("MATCHES: ")
+ #logger.debug(matches)
+ #logger.debug(data)
+
+ for scrapedurl, scrapedtitle_alt, scrapedquality, scrapedtype in matches:
+ # Creamos "item_local" y lo limpiamos un poco de algunos restos de item
+ item_local = item.clone()
+ if item_local.category:
+ category = item.category
+ del item_local.category
+ item_local.tipo = True
+ del item_local.tipo
+ if item_local.totalItems:
+ del item_local.totalItems
+ if item_local.text_color:
+ del item_local.text_color
+ if item_local.cnt_pag_num:
+ del item_local.cnt_pag_num
+ item_local.url = scrapedurl
+ item_local.contentThumbnail = ''
+ item_local.thumbnail = ''
+ item_local.title = ''
+ item_local.context = "['buscar_trailer']"
+ item_local.infoLabels['year'] = '-' # Al no saber el año, le ponemos "-" y TmDB lo calcula automáticamente
+
+ # Limpiamos títulos, Sacamos datos de calidad, audio y lenguaje
+ scrapedtitle = re.sub('\r\n', '', scrapedtitle_alt).decode('utf8').encode('utf8').strip()
+ title = scrapedtitle
+ title = title.replace("á", "a").replace("é", "e").replace("í", "i").replace("ó", "o").replace("ú", "u").replace("ü", "u").replace("�", "ñ").replace("ñ", "ñ")
+
+ title_subs = []
+
+ #Determinamos y marcamos idiomas distintos del castellano
+ item_local.language = []
+ if "[subs" in title.lower() or "[vos" in title.lower() or "v.o.s" in title.lower() or "vo" in title.lower():
+ item_local.language += ["VOS"]
+ title = title.replace(" [Subs. integrados]", "").replace(" [subs. Integrados]", "").replace(" [VOSE", "").replace(" [VOS", "").replace(" (V.O.S.E)", "").replace(" VO", "")
+ if "latino" in title.lower() or "argentina" in title.lower():
+ item_local.language += ["LAT"]
+ title = title.replace(" Latino", "").replace(" latino", "").replace(" Argentina", "").replace(" argentina", "")
+ title = title.replace("Castellano", "").replace("castellano", "").replace("inglés", "").replace("ingles", "").replace("Inglés", "").replace("Ingles", "")
+
+ if "3d" in title or "3D" in title: #Reservamos info para después de TMDB
+ item_local.quality += " 3D"
+ title = title.replace(" [3d]", "").replace(" 3d", "").replace(" [3D]", "").replace(" 3D", "")
+ if "audio" in title.lower(): #Reservamos info de audio para después de TMDB
+ title_subs += ['[%s]' % scrapertools.find_single_match(title, r'(\[[a|A]udio.*?\])')]
+ title = re.sub(r'\[[a|A]udio.*?\]', '', title)
+ if "[dual" in title.lower():
+ item_local.language[0:0] = ["DUAL"]
+ title = title = re.sub(r'\[D|dual.*?\]', '', title)
+ if scrapertools.find_single_match(title, r'-\s[m|M].*?serie'):
+ title = re.sub(r'-\s[m|M].*?serie', '', title)
+ title_subs += ["Miniserie"]
+
+ if title.endswith('.'):
+ title = title[:-1]
+
+ if not title:
+ title = "SIN TÍTULO"
+ title = scrapertools.remove_htmltags(title)
+
+ # Ahora preparamos el título y la calidad tanto para series como para documentales y películas
+ if item.extra == "novedades" and ("Series" in scrapedtype or "Documentales" in scrapedtype):
+ item_local.quality = scrapertools.find_single_match(scrapedtitle, '.*?\[(.*?)\]')
+ else:
+ item_local.quality = scrapertools.remove_htmltags(scrapedquality).decode('utf8').encode('utf8')
+ item_local.quality = item_local.quality.replace("(", "").replace(")", "").replace("[", "").replace("]", "").replace("Documental", "").replace("documental", "")
+
+ #Preparamos la información básica para TMDB
+ if "Series" in scrapedtype or "Documentales" in scrapedtype:
+ item_local.action = "episodios"
+ if "Series" in scrapedtype:
+ item_local.extra = "series"
+ else:
+ item_local.extra = "documentales"
+ item_local.contentType = "season"
+
+ title = re.sub(r'\[\d+.*?\]', '', title) # Quitar la calidad del título
+ item_local.contentSerieName = scrapertools.find_single_match(title, '(.*?) Temporada \d+\s?').strip()
+ if not item_local.contentSerieName:
+ item_local.contentSerieName = title.strip()
+ if item_local.infoLabels['title']:
+ del item_local.infoLabels['title']
+ title = item_local.contentSerieName
+ item_local.title = title
+ if not item_local.contentSerieName:
+ item_local.contentSerieName = "SIN TITULO"
+ item_local.contentSeason = scrapertools.find_single_match(scrapedurl, 'temporada-?(?:\d+p-)?(\d{1,2})[-|\/]')
+ if not item_local.contentSeason:
+ item_local.contentSeason = 1
+
+ if "(hdrip" in title.lower() or "(br" in title.lower() or "(vhsrip" in title.lower() or "(dvdrip" in title.lower() or "(fullb" in title.lower() or "(blu" in title.lower() or "(4k" in title.lower() or "(hevc" in title.lower() or "(imax" in title.lower() or "extendida" in title.lower() or "[720p]" in title.lower() or "[1080p]" in title.lower():
+ if not item_local.quality:
+ item_local.quality = scrapertools.find_single_match(title, r'\(.*?\)?\(.*?\)')
+ if not item_local.quality:
+ item_local.quality = scrapertools.find_single_match(title, r'[\[|\(](.*?)[\)|\]]')
+ title = re.sub(r'\(.*?\)?\(.*?\)', '', title)
+ title = re.sub(r'[\[|\(].*?[\)|\]]', '', title)
+ if not item_local.quality:
+ if "fullbluray" in title.lower():
+ item_local.quality = "FullBluRay"
+ title = title.replace("FullBluRay", "").replace("fullbluray", "")
+ if "4k" in title.lower() or "hdr" in title.lower():
+ item_local.quality = "4K"
+ title = title.replace("4k-hdr", "").replace("4K-HDR", "").replace("hdr", "").replace("HDR", "").replace("4k", "").replace("4K", "")
+ title = title.replace("(", "").replace(")", "").replace("[", "").replace("]", "").strip()
+ item_local.title = title
+
+ if "Peliculas" in scrapedtype or "Variados" in scrapedtype:
+ item_local.action = "findvideos"
+ item_local.extra = "peliculas"
+ item_local.contentType = "movie"
+ item_local.contentTitle = title
+ if "Variados" in scrapedtype:
+ item_local.extra = "varios"
+
+ if "saga" in item_local.contentTitle.lower() or "saga" in item_local.contentSerieName.lower():
+ item_local.contentTitle = item_local.contentTitle.replace("Saga ", "").replace("Saga", "")
+ item_local.contentSerieName = item_local.contentSerieName.replace("Saga ", "").replace("Saga", "")
+ title_subs += ["Saga"]
+ if "colecc" in item_local.contentTitle.lower() or "colecc" in item_local.contentSerieName.lower():
+ item_local.contentTitle = item_local.contentTitle.replace("Coleccion ", "").replace("Coleccion", "")
+ item_local.contentSerieName = item_local.contentSerieName.replace("Coleccion ", "").replace("Coleccion", "")
+ title_subs += ["Coleccion"]
+
+ #Guarda la variable temporal que almacena la info adicional del título a ser restaurada después de TMDB
+ item_local.title_subs = title_subs
+
+ #Salvamos y borramos el número de temporadas porque TMDB a veces hace tonterias. Lo pasamos como serie completa
+ if item_local.contentSeason and (item_local.contentType == "season" or item_local.contentType == "tvshow"):
+ item_local.contentSeason_save = item_local.contentSeason
+ del item_local.infoLabels['season']
+
+ itemlist.append(item_local.clone())
+
+ #logger.debug(item_local)
+
+ if not category: #Si este campo no existe es que viene de la primera pasada de una búsqueda global
+ return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo
+
+ #Llamamos a TMDB para que complete InfoLabels desde itemlist. Mejor desde itemlist porque envía las queries en paralelo
+ tmdb.set_infoLabels(itemlist, __modo_grafico__)
+
+ #Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
+ item, itemlist = generictools.post_tmdb_listado(item, itemlist)
+
+ if url_next_page:
+ title_foot = str(curr_page_num)
+ if last_page > 0:
+ title_foot += ' de %s' % str(last_page)
+ itemlist.append(
+ Item(channel=item.channel, action="listado_busqueda", title="[COLOR gold][B]Pagina siguiente >> [/B][/COLOR]" + title_foot, url=url_next_page, extra=item.extra))
+
+ return itemlist
+
+
+def findvideos(item):
+ logger.info()
+ itemlist = []
+
+ data = ''
+ torrent_data = ''
+ headers = {'Content-Type': 'application/x-www-form-urlencoded', 'Referer': item.url} #Necesario para el Post del .Torrent
+
+ #Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB
+ item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
+
+ #Bajamos los datos de la página de todo menos de Documentales y Varios
+ if not item.post:
+ try:
+ data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data)
+ data = data.replace('"', "'")
+ patron = " |