Cacheo de enlaces de emergencias:
Adaptados: - DivxTotal - Pelismagnet - Subtorrents - Todopleiculas - Zonatorrent
This commit is contained in:
@@ -577,7 +577,8 @@ def findvideos(item):
|
|||||||
return item #... y nos vamos
|
return item #... y nos vamos
|
||||||
|
|
||||||
#Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB
|
#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)
|
if not item.videolibray_emergency_urls:
|
||||||
|
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
|
||||||
|
|
||||||
#Ahora tratamos los enlaces .torrent
|
#Ahora tratamos los enlaces .torrent
|
||||||
for scrapedurl in matches: #leemos los torrents con la diferentes calidades
|
for scrapedurl in matches: #leemos los torrents con la diferentes calidades
|
||||||
|
|||||||
@@ -100,7 +100,7 @@
|
|||||||
"id": "intervenidos_channels_list",
|
"id": "intervenidos_channels_list",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"label": "Lista de canales y clones de NewPct1 intervenidos y orden de sustitución de URLs",
|
"label": "Lista de canales y clones de NewPct1 intervenidos y orden de sustitución de URLs",
|
||||||
"default": "('0', 'canal_org', 'canal_des', 'url_org', 'url_des', 'patron1', 'patron2', 'patron3', 'patron4', 'patron5', 'content_inc', 'content_exc', 'ow_force'), ('0', 'mejortorrent', 'mejortorrent1', 'http://www.mejortorrent.com/', 'https://mejortorrent1.com/', '(http.?:\/\/.*?\/)', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-(?:[^-]+-)([^0-9]+-)', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-(?:[^-]+-)[^0-9]+-\\d+-(Temporada-).html', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-(?:[^-]+-)[^0-9]+-(\\d+)-', '', 'tvshow, season', '', 'force'), ('0', 'mejortorrent', 'mejortorrent1', 'http://www.mejortorrent.com/', 'https://mejortorrent1.com/', '(http.?:\/\/.*?\/)', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-([^.]+).html', '', '', '', 'movie', '', 'force'), ('0', 'mejortorrent', 'mejortorrent', 'http://www.mejortorrent.com/', 'http://www.mejortorrent.org/', '', '', '', '', '', '*', '', 'force'), ('0', 'plusdede', 'megadede', 'https://www.plusdede.com', 'https://www.megadede.com', '', '', '', '', '', '*', '', 'auto')",
|
"default": "('0', 'canal_org', 'canal_des', 'url_org', 'url_des', 'patron1', 'patron2', 'patron3', 'patron4', 'patron5', 'content_inc', 'content_exc', 'ow_force'), ('0', 'mejortorrent', 'mejortorrent1', 'http://www.mejortorrent.com/', 'https://mejortorrent1.com/', '(http.?:\/\/.*?\/)', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-(?:[^-]+-)([^0-9]+-)', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-(?:[^-]+-)[^0-9]+-\\d+-(Temporada-).html', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-(?:[^-]+-)[^0-9]+-(\\d+)-', '', 'tvshow, season', '', 'force'), ('0', 'mejortorrent', 'mejortorrent1', 'http://www.mejortorrent.com/', 'https://mejortorrent1.com/', '(http.?:\/\/.*?\/)', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-([^.]+).html', '', '', '', 'movie', '', 'force'), ('0', 'mejortorrent', 'mejortorrent', 'http://www.mejortorrent.com/', 'http://www.mejortorrent.org/', '', '', '', '', '', '*', '', 'force'), ('1', 'plusdede', 'megadede', 'https://www.plusdede.com', 'https://www.megadede.com', '', '', '', '', '', '*', '', 'auto'), ('1', 'newpct1', 'descargas2020', 'http://www.newpct1.com', 'http://descargas2020.com', '', '', '', '', '', '*', '', 'force')",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"visible": false
|
"visible": false
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -45,6 +45,28 @@
|
|||||||
"VOSE"
|
"VOSE"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "emergency_urls",
|
||||||
|
"type": "list",
|
||||||
|
"label": "Se quieren guardar Enlaces de Emergencia por si se cae la Web?",
|
||||||
|
"default": 1,
|
||||||
|
"enabled": true,
|
||||||
|
"visible": true,
|
||||||
|
"lvalues": [
|
||||||
|
"No",
|
||||||
|
"Guardar",
|
||||||
|
"Borrar",
|
||||||
|
"Actualizar"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "emergency_urls_torrents",
|
||||||
|
"type": "bool",
|
||||||
|
"label": "Se quieren guardar Torrents de Emergencia por si se cae la Web?",
|
||||||
|
"default": true,
|
||||||
|
"enabled": true,
|
||||||
|
"visible": "!eq(-1,'No')"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "include_in_newest_torrent",
|
"id": "include_in_newest_torrent",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ def listado(item):
|
|||||||
title = re.sub(r'[\(|\[]\s+[\)|\]]', '', title)
|
title = re.sub(r'[\(|\[]\s+[\)|\]]', '', title)
|
||||||
title = title.replace('()', '').replace('[]', '').strip().lower().title()
|
title = title.replace('()', '').replace('[]', '').strip().lower().title()
|
||||||
|
|
||||||
item_local.from_title = title.strip().lower().title() #Guardamos esta etiqueta para posible desambiguación de título
|
item_local.from_title = title.strip().lower().title() #Guardamos esta etiqueta para posible desambiguación de título
|
||||||
|
|
||||||
#Salvamos el título según el tipo de contenido
|
#Salvamos el título según el tipo de contenido
|
||||||
if item_local.contentType == "movie":
|
if item_local.contentType == "movie":
|
||||||
@@ -387,8 +387,8 @@ def listado(item):
|
|||||||
|
|
||||||
title = '%s' % curr_page
|
title = '%s' % curr_page
|
||||||
|
|
||||||
if cnt_matches + 1 >= last_title: #Si hemos pintado ya todo lo de esta página...
|
if cnt_matches + 1 >= last_title: #Si hemos pintado ya todo lo de esta página...
|
||||||
cnt_matches = 0 #... la próxima pasada leeremos otra página
|
cnt_matches = 0 #... la próxima pasada leeremos otra página
|
||||||
next_page_url = re.sub(r'page=(\d+)', r'page=' + str(int(re.search('\d+', next_page_url).group()) + 1), next_page_url)
|
next_page_url = re.sub(r'page=(\d+)', r'page=' + str(int(re.search('\d+', next_page_url).group()) + 1), next_page_url)
|
||||||
|
|
||||||
itemlist.append(Item(channel=item.channel, action="listado", title=">> Página siguiente " + title, url=next_page_url, extra=item.extra, extra2=item.extra2, last_page=str(last_page), curr_page=str(curr_page + 1), cnt_matches=str(cnt_matches)))
|
itemlist.append(Item(channel=item.channel, action="listado", title=">> Página siguiente " + title, url=next_page_url, extra=item.extra, extra2=item.extra2, last_page=str(last_page), curr_page=str(curr_page + 1), cnt_matches=str(cnt_matches)))
|
||||||
@@ -399,10 +399,10 @@ def listado(item):
|
|||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
logger.info()
|
logger.info()
|
||||||
itemlist = []
|
itemlist = []
|
||||||
itemlist_t = [] #Itemlist total de enlaces
|
itemlist_t = [] #Itemlist total de enlaces
|
||||||
itemlist_f = [] #Itemlist de enlaces filtrados
|
itemlist_f = [] #Itemlist de enlaces filtrados
|
||||||
if not item.language:
|
if not item.language:
|
||||||
item.language = ['CAST'] #Castellano por defecto
|
item.language = ['CAST'] #Castellano por defecto
|
||||||
matches = []
|
matches = []
|
||||||
item.category = categoria
|
item.category = categoria
|
||||||
|
|
||||||
@@ -412,22 +412,53 @@ def findvideos(item):
|
|||||||
#logger.debug(item)
|
#logger.debug(item)
|
||||||
|
|
||||||
matches = item.url
|
matches = item.url
|
||||||
if not matches: #error
|
if not matches: #error
|
||||||
logger.error("ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web: " + item)
|
logger.error("ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web: " + str(item))
|
||||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web. Verificar en la Web esto último y reportar el error con el log'))
|
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web. Verificar en la Web esto último y reportar el error con el log'))
|
||||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
|
||||||
|
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||||
|
matches = item.emergency_urls[1] #Restauramos matches
|
||||||
|
item.armagedon = True #Marcamos la situación como catastrófica
|
||||||
|
else:
|
||||||
|
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
||||||
|
return item #Devolvemos el Item de la llamada
|
||||||
|
else:
|
||||||
|
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||||
|
|
||||||
#logger.debug(matches)
|
#logger.debug(matches)
|
||||||
|
|
||||||
|
#Si es un lookup para cargar las urls de emergencia en la Videoteca...
|
||||||
|
if item.videolibray_emergency_urls:
|
||||||
|
item.emergency_urls = [] #Iniciamos emergency_urls
|
||||||
|
item.emergency_urls.append([]) #Reservamos el espacio para los .torrents locales
|
||||||
|
item.emergency_urls.append(matches) #Salvamnos matches...
|
||||||
|
|
||||||
#Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB
|
#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)
|
if not item.videolibray_emergency_urls:
|
||||||
|
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
|
||||||
|
|
||||||
#Ahora tratamos los enlaces .torrent
|
#Ahora tratamos los enlaces .torrent
|
||||||
for scrapedurl, quality in matches: #leemos los magnets con la diferentes calidades
|
for scrapedurl, quality in matches: #leemos los magnets con la diferentes calidades
|
||||||
#Generamos una copia de Item para trabajar sobre ella
|
#Generamos una copia de Item para trabajar sobre ella
|
||||||
item_local = item.clone()
|
item_local = item.clone()
|
||||||
|
|
||||||
item_local.url = scrapedurl
|
item_local.url = scrapedurl
|
||||||
|
if item.videolibray_emergency_urls:
|
||||||
|
item.emergency_urls[0].append(scrapedurl) #guardamos la url y pasamos a la siguiente
|
||||||
|
continue
|
||||||
|
if item.emergency_urls and not item.videolibray_emergency_urls:
|
||||||
|
item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la url del .Torrent ALTERNATIVA
|
||||||
|
if item.armagedon:
|
||||||
|
item_local.url = item.emergency_urls[0][0] #... ponemos la emergencia como primaria
|
||||||
|
del item.emergency_urls[0][0] #Una vez tratado lo limpiamos
|
||||||
|
|
||||||
|
size = ''
|
||||||
|
if not item.armagedon:
|
||||||
|
size = generictools.get_torrent_size(item_local.url) #Buscamos el tamaño en el .torrent
|
||||||
|
if size:
|
||||||
|
quality += ' [%s]' % size
|
||||||
|
if item.armagedon: #Si es catastrófico, lo marcamos
|
||||||
|
quality = '[/COLOR][COLOR hotpink][E] [COLOR limegreen]%s' % quality
|
||||||
|
|
||||||
#Añadimos la calidad y copiamos la duración
|
#Añadimos la calidad y copiamos la duración
|
||||||
item_local.quality = quality
|
item_local.quality = quality
|
||||||
@@ -445,9 +476,9 @@ def findvideos(item):
|
|||||||
item_local.quality = re.sub(r'\s?\[COLOR \w+\]\s?\[\/COLOR\]', '', item_local.quality).strip()
|
item_local.quality = re.sub(r'\s?\[COLOR \w+\]\s?\[\/COLOR\]', '', item_local.quality).strip()
|
||||||
item_local.quality = item_local.quality.replace("--", "").replace("[]", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
|
item_local.quality = item_local.quality.replace("--", "").replace("[]", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
|
||||||
|
|
||||||
item_local.alive = "??" #Calidad del link sin verificar
|
item_local.alive = "??" #Calidad del link sin verificar
|
||||||
item_local.action = "play" #Visualizar vídeo
|
item_local.action = "play" #Visualizar vídeo
|
||||||
item_local.server = "torrent" #Servidor Torrent
|
item_local.server = "torrent" #Servidor Torrent
|
||||||
|
|
||||||
itemlist_t.append(item_local.clone()) #Pintar pantalla, si no se filtran idiomas
|
itemlist_t.append(item_local.clone()) #Pintar pantalla, si no se filtran idiomas
|
||||||
|
|
||||||
@@ -459,6 +490,9 @@ def findvideos(item):
|
|||||||
|
|
||||||
#logger.debug(item_local)
|
#logger.debug(item_local)
|
||||||
|
|
||||||
|
if item.videolibray_emergency_urls: #Si ya hemos guardado todas las urls...
|
||||||
|
return item #... nos vamos
|
||||||
|
|
||||||
if len(itemlist_f) > 0: #Si hay entradas filtradas...
|
if len(itemlist_f) > 0: #Si hay entradas filtradas...
|
||||||
itemlist.extend(itemlist_f) #Pintamos pantalla filtrada
|
itemlist.extend(itemlist_f) #Pintamos pantalla filtrada
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -44,6 +44,28 @@
|
|||||||
"VOSE"
|
"VOSE"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "emergency_urls",
|
||||||
|
"type": "list",
|
||||||
|
"label": "Se quieren guardar Enlaces de Emergencia por si se cae la Web?",
|
||||||
|
"default": 1,
|
||||||
|
"enabled": true,
|
||||||
|
"visible": true,
|
||||||
|
"lvalues": [
|
||||||
|
"No",
|
||||||
|
"Guardar",
|
||||||
|
"Borrar",
|
||||||
|
"Actualizar"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "emergency_urls_torrents",
|
||||||
|
"type": "bool",
|
||||||
|
"label": "Se quieren guardar Torrents de Emergencia por si se cae la Web?",
|
||||||
|
"default": true,
|
||||||
|
"enabled": true,
|
||||||
|
"visible": "!eq(-1,'No')"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "timeout_downloadpage",
|
"id": "timeout_downloadpage",
|
||||||
"type": "list",
|
"type": "list",
|
||||||
|
|||||||
@@ -372,6 +372,7 @@ def findvideos(item):
|
|||||||
if not item.language:
|
if not item.language:
|
||||||
item.language = ['CAST'] #Castellano por defecto
|
item.language = ['CAST'] #Castellano por defecto
|
||||||
matches = []
|
matches = []
|
||||||
|
subtitles = []
|
||||||
item.category = categoria
|
item.category = categoria
|
||||||
|
|
||||||
#logger.debug(item)
|
#logger.debug(item)
|
||||||
@@ -389,51 +390,74 @@ def findvideos(item):
|
|||||||
if not data:
|
if not data:
|
||||||
logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url)
|
logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url)
|
||||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log'))
|
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log'))
|
||||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
|
||||||
|
|
||||||
#Extraemos el thumb
|
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||||
if not item.thumbnail:
|
matches = item.emergency_urls[1] #Restauramos matches de vídeos
|
||||||
item.thumbnail = scrapertools.find_single_match(data, patron) #guardamos thumb si no existe
|
subtitles = item.emergency_urls[2] #Restauramos matches de subtítulos
|
||||||
|
item.armagedon = True #Marcamos la situación como catastrófica
|
||||||
|
else:
|
||||||
|
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
||||||
|
return item #Devolvemos el Item de la llamada
|
||||||
|
else:
|
||||||
|
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||||
|
|
||||||
#Extraemos quality, audio, year, country, size, scrapedlanguage
|
if not item.armagedon:
|
||||||
patron = '<\/script><\/div><ul>(?:<li><label>Fecha de estreno <\/label>[^<]+<\/li>)?(?:<li><label>Genero <\/label>[^<]+<\/li>)?(?:<li><label>Calidad <\/label>([^<]+)<\/li>)?(?:<li><label>Audio <\/label>([^<]+)<\/li>)?(?:<li><label>Fecha <\/label>.*?(\d+)<\/li>)?(?:<li><label>Pais de Origen <\/label>([^<]+)<\/li>)?(?:<li><label>Tamaño <\/label>([^<]+)<\/li>)?(<li> Idioma[^<]+<img src=.*?<br \/><\/li>)?'
|
#Extraemos el thumb
|
||||||
try:
|
if not item.thumbnail:
|
||||||
quality, audio, year, country, size, scrapedlanguage = scrapertools.find_single_match(data, patron)
|
item.thumbnail = scrapertools.find_single_match(data, patron) #guardamos thumb si no existe
|
||||||
except:
|
|
||||||
quality = ''
|
|
||||||
audio = ''
|
|
||||||
year = ''
|
|
||||||
country = ''
|
|
||||||
size = ''
|
|
||||||
scrapedlanguage = ''
|
|
||||||
if quality: item.quality = quality
|
|
||||||
if audio: item.quality += ' %s' % audio.strip()
|
|
||||||
if not item.infoLabels['year'] and year: item.infoLabels['year'] = year
|
|
||||||
if size: item.quality += ' [%s]' % size.replace('GB', 'G B').replace('Gb', 'G b').replace('MB', 'M B').replace('Mb', 'M b').replace('.', ',').strip()
|
|
||||||
if size: item.title += ' [%s]' % size.replace('GB', 'G B').replace('Gb', 'G b').replace('MB', 'M B').replace('Mb', 'M b').replace('.', ',').strip()
|
|
||||||
language = []
|
|
||||||
matches = re.compile('(\d+.png)', re.DOTALL).findall(scrapedlanguage)
|
|
||||||
for lang in matches:
|
|
||||||
if "1.png" in lang and not 'CAST' in language: language += ['CAST']
|
|
||||||
if "512.png" in lang and not 'LAT' in language: language += ['LAT']
|
|
||||||
if ("1.png" not in lang and "512.png" not in lang) and not 'VOSE' in language: language += ['VOSE']
|
|
||||||
if language: item.language = language
|
|
||||||
|
|
||||||
#Extraemos los enlaces .torrent
|
#Extraemos quality, audio, year, country, size, scrapedlanguage
|
||||||
##Modalidad de varios archivos
|
patron = '<\/script><\/div><ul>(?:<li><label>Fecha de estreno <\/label>[^<]+<\/li>)?(?:<li><label>Genero <\/label>[^<]+<\/li>)?(?:<li><label>Calidad <\/label>([^<]+)<\/li>)?(?:<li><label>Audio <\/label>([^<]+)<\/li>)?(?:<li><label>Fecha <\/label>.*?(\d+)<\/li>)?(?:<li><label>Pais de Origen <\/label>([^<]+)<\/li>)?(?:<li><label>Tamaño <\/label>([^<]+)<\/li>)?(<li> Idioma[^<]+<img src=.*?<br \/><\/li>)?'
|
||||||
patron = '<div class="fichadescargat"><\/div><div class="table-responsive"[^>]+>.*?<\/thead><tbody>(.*?)<\/tbody><\/table><\/div>'
|
try:
|
||||||
if scrapertools.find_single_match(data, patron):
|
quality = ''
|
||||||
data_torrents = scrapertools.find_single_match(data, patron)
|
audio = ''
|
||||||
patron = '<tr><td>.*?<\/td><td><a href="([^"]+)"[^>]+><[^>]+><\/a><\/td><\/tr>'
|
year = ''
|
||||||
#Modalidad de un archivo
|
country = ''
|
||||||
else:
|
size = ''
|
||||||
data_torrents = data
|
scrapedlanguage = ''
|
||||||
patron = '<div class="fichasubtitulos">.*?<\/div><\/li><\/ul>.*?<a href="([^"]+)"'
|
quality, audio, year, country, size, scrapedlanguage = scrapertools.find_single_match(data, patron)
|
||||||
matches = re.compile(patron, re.DOTALL).findall(data_torrents)
|
except:
|
||||||
if not matches: #error
|
pass
|
||||||
logger.error("ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web " + " / PATRON: " + patron + data)
|
if quality: item.quality = quality
|
||||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web. Verificar en la Web esto último y reportar el error con el log'))
|
if audio: item.quality += ' %s' % audio.strip()
|
||||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
if not item.infoLabels['year'] and year: item.infoLabels['year'] = year
|
||||||
|
if size: item.quality += ' [%s]' % size.replace('GB', 'G B').replace('Gb', 'G b').replace('MB', 'M B').replace('Mb', 'M b').replace('.', ',').strip()
|
||||||
|
if size:
|
||||||
|
item.title = re.sub(r'\s*\[\d+,?\d*?\s\w\s*[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
|
||||||
|
item.title += ' [%s]' % size.replace('GB', 'G B').replace('Gb', 'G b').replace('MB', 'M B').replace('Mb', 'M b').replace('.', ',').strip()
|
||||||
|
|
||||||
|
language = []
|
||||||
|
matches_lang = re.compile('(\d+.png)', re.DOTALL).findall(scrapedlanguage)
|
||||||
|
for lang in matches_lang:
|
||||||
|
if "1.png" in lang and not 'CAST' in language: language += ['CAST']
|
||||||
|
if "512.png" in lang and not 'LAT' in language: language += ['LAT']
|
||||||
|
if ("1.png" not in lang and "512.png" not in lang) and not 'VOSE' in language: language += ['VOSE']
|
||||||
|
if language: item.language = language
|
||||||
|
|
||||||
|
#Extraemos los enlaces .torrent
|
||||||
|
#Modalidad de varios archivos
|
||||||
|
patron = '<div class="fichadescargat"><\/div><div class="table-responsive"[^>]+>.*?<\/thead><tbody>(.*?)<\/tbody><\/table><\/div>'
|
||||||
|
if scrapertools.find_single_match(data, patron):
|
||||||
|
data_torrents = scrapertools.find_single_match(data, patron)
|
||||||
|
patron = '<tr><td>.*?<\/td><td><a href="([^"]+)"[^>]+><[^>]+><\/a><\/td><\/tr>'
|
||||||
|
#Modalidad de un archivo
|
||||||
|
else:
|
||||||
|
data_torrents = data
|
||||||
|
patron = '<div class="fichasubtitulos">.*?<\/div><\/li><\/ul>.*?<a href="([^"]+)"'
|
||||||
|
matches = re.compile(patron, re.DOTALL).findall(data_torrents)
|
||||||
|
if not matches: #error
|
||||||
|
logger.error("ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web " + " / PATRON: " + patron + data)
|
||||||
|
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web. Verificar en la Web esto último y reportar el error con el log'))
|
||||||
|
|
||||||
|
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||||
|
matches = item.emergency_urls[1] #Restauramos matches de vídeos
|
||||||
|
subtitles = item.emergency_urls[2] #Restauramos matches de subtítulos
|
||||||
|
item.armagedon = True #Marcamos la situación como catastrófica
|
||||||
|
else:
|
||||||
|
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
||||||
|
return item #Devolvemos el Item de la llamada
|
||||||
|
else:
|
||||||
|
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||||
|
|
||||||
else: #SERIES: ya viene con las urls
|
else: #SERIES: ya viene con las urls
|
||||||
data = item.url #inicio data por compatibilidad
|
data = item.url #inicio data por compatibilidad
|
||||||
@@ -447,11 +471,22 @@ def findvideos(item):
|
|||||||
del item.subtitle
|
del item.subtitle
|
||||||
else:
|
else:
|
||||||
subtitle = scrapertools.find_single_match(data, patron).replace('&', '&').replace('.io/', sufix).replace('.com/', sufix)
|
subtitle = scrapertools.find_single_match(data, patron).replace('&', '&').replace('.io/', sufix).replace('.com/', sufix)
|
||||||
data_subtitle = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(subtitle, timeout=timeout).data)
|
|
||||||
patron = '<tbody>(<tr class="fichserietabla_b">.*?<\/tr>)<\/tbody>' #salvamos el bloque
|
try:
|
||||||
data_subtitle = scrapertools.find_single_match(data_subtitle, patron)
|
data_subtitle = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(subtitle, timeout=timeout).data)
|
||||||
patron = '<tr class="fichserietabla_b">.*?<a href="([^"]+)"'
|
except:
|
||||||
subtitles = re.compile(patron, re.DOTALL).findall(data_subtitle) #Creamos una lista con todos los sub-títulos
|
pass
|
||||||
|
|
||||||
|
if not data_subtitle:
|
||||||
|
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||||
|
matches = item.emergency_urls[1] #Restauramos matches de vídeos
|
||||||
|
subtitles = item.emergency_urls[2] #Restauramos matches de subtítulos
|
||||||
|
item.armagedon = True #Marcamos la situación como catastrófica
|
||||||
|
else:
|
||||||
|
patron = '<tbody>(<tr class="fichserietabla_b">.*?<\/tr>)<\/tbody>' #salvamos el bloque
|
||||||
|
data_subtitle = scrapertools.find_single_match(data_subtitle, patron)
|
||||||
|
patron = '<tr class="fichserietabla_b">.*?<a href="([^"]+)"'
|
||||||
|
subtitles = re.compile(patron, re.DOTALL).findall(data_subtitle) #Creamos una lista con todos los sub-títulos
|
||||||
if subtitles:
|
if subtitles:
|
||||||
item.subtitle = []
|
item.subtitle = []
|
||||||
for subtitle in subtitles:
|
for subtitle in subtitles:
|
||||||
@@ -460,29 +495,49 @@ def findvideos(item):
|
|||||||
|
|
||||||
#logger.debug("PATRON: " + patron)
|
#logger.debug("PATRON: " + patron)
|
||||||
#logger.debug(matches)
|
#logger.debug(matches)
|
||||||
|
#logger.debug(subtitles)
|
||||||
#logger.debug(data)
|
#logger.debug(data)
|
||||||
|
|
||||||
|
#Si es un lookup para cargar las urls de emergencia en la Videoteca...
|
||||||
|
if item.videolibray_emergency_urls:
|
||||||
|
item.emergency_urls = [] #Iniciamos emergency_urls
|
||||||
|
item.emergency_urls.append([]) #Reservamos el espacio para los .torrents locales
|
||||||
|
item.emergency_urls.append(matches) #Salvamnos matches de los vídeos...
|
||||||
|
item.emergency_urls.append(subtitles) #Salvamnos matches de los subtítulos
|
||||||
|
|
||||||
#Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB
|
#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)
|
if not item.videolibray_emergency_urls:
|
||||||
|
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
|
||||||
|
|
||||||
#Ahora tratamos los enlaces .torrent
|
#Ahora tratamos los enlaces .torrent
|
||||||
for scrapedurl in matches: #leemos los torrents con la diferentes calidades
|
for scrapedurl in matches: #leemos los torrents con la diferentes calidades
|
||||||
#Generamos una copia de Item para trabajar sobre ella
|
#Generamos una copia de Item para trabajar sobre ella
|
||||||
item_local = item.clone()
|
item_local = item.clone()
|
||||||
|
|
||||||
|
item_local.url = scrapedurl.replace('&', '&').replace('.io/', sufix).replace('.com/', sufix)
|
||||||
|
if item.videolibray_emergency_urls:
|
||||||
|
item.emergency_urls[0].append(scrapedurl) #guardamos la url y pasamos a la siguiente
|
||||||
|
continue
|
||||||
|
if item.emergency_urls and not item.videolibray_emergency_urls:
|
||||||
|
item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la url del .Torrent ALTERNATIVA
|
||||||
|
if item.armagedon:
|
||||||
|
item_local.url = item.emergency_urls[0][0] #... ponemos la emergencia como primaria
|
||||||
|
del item.emergency_urls[0][0] #Una vez tratado lo limpiamos
|
||||||
|
|
||||||
#Buscamos si ya tiene tamaño, si no, los buscamos en el archivo .torrent
|
#Buscamos si ya tiene tamaño, si no, los buscamos en el archivo .torrent
|
||||||
size = scrapertools.find_single_match(item_local.quality, '\s\[(\d+,?\d*?\s\w\s?[b|B])\]')
|
size = scrapertools.find_single_match(item_local.quality, '\s*\[(\d+,?\d*?\s\w\s*[b|B])\]')
|
||||||
if not size:
|
if not size and not item.armagedon:
|
||||||
size = generictools.get_torrent_size(scrapedurl) #Buscamos el tamaño en el .torrent
|
size = generictools.get_torrent_size(scrapedurl) #Buscamos el tamaño en el .torrent
|
||||||
if size:
|
if size:
|
||||||
item_local.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item_local.title) #Quitamos size de título, si lo traía
|
|
||||||
item_local.title = '%s [%s]' % (item_local.title, size) #Agregamos size al final del título
|
|
||||||
size = size.replace('GB', 'G B').replace('Gb', 'G b').replace('MB', 'M B').replace('Mb', 'M b')
|
size = size.replace('GB', 'G B').replace('Gb', 'G b').replace('MB', 'M B').replace('Mb', 'M b')
|
||||||
item_local.quality = re.sub(r'\s\[\d+,?\d*?\s\w\s?[b|B]\]', '', item_local.quality) #Quitamos size de calidad, si lo traía
|
item_local.title = re.sub(r'\s*\[\d+,?\d*?\s\w\s*[b|B]\]', '', item_local.title) #Quitamos size de título, si lo traía
|
||||||
item_local.quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final de la calidad
|
item_local.title = '%s [%s]' % (item_local.title, size) #Agregamos size al final del título
|
||||||
|
item_local.quality = re.sub(r'\s*\[\d+,?\d*?\s\w\s*[b|B]\]', '', item_local.quality) #Quitamos size de calidad, si lo traía
|
||||||
|
item_local.quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final de la calidad
|
||||||
|
if item.armagedon: #Si es catastrófico, lo marcamos
|
||||||
|
item_local.quality = '[/COLOR][COLOR hotpink][E] [COLOR limegreen]%s' % item_local.quality
|
||||||
|
|
||||||
#Ahora pintamos el link del Torrent
|
#Ahora pintamos el link del Torrent
|
||||||
item_local.url = scrapedurl.replace('&', '&').replace('.io/', sufix).replace('.com/', sufix)
|
|
||||||
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.quality, str(item_local.language))
|
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.quality, str(item_local.language))
|
||||||
|
|
||||||
#Preparamos título y calidad, quitamos etiquetas vacías
|
#Preparamos título y calidad, quitamos etiquetas vacías
|
||||||
@@ -506,6 +561,9 @@ def findvideos(item):
|
|||||||
#logger.debug("TORRENT: " + scrapedurl + " / title gen/torr: " + item.title + " / " + item_local.title + " / calidad: " + item_local.quality + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
|
#logger.debug("TORRENT: " + scrapedurl + " / title gen/torr: " + item.title + " / " + item_local.title + " / calidad: " + item_local.quality + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
|
||||||
#logger.debug(item_local)
|
#logger.debug(item_local)
|
||||||
|
|
||||||
|
if item.videolibray_emergency_urls: #Si ya hemos guardado todas las urls...
|
||||||
|
return item #... nos vamos
|
||||||
|
|
||||||
if len(itemlist_f) > 0: #Si hay entradas filtradas...
|
if len(itemlist_f) > 0: #Si hay entradas filtradas...
|
||||||
itemlist.extend(itemlist_f) #Pintamos pantalla filtrada
|
itemlist.extend(itemlist_f) #Pintamos pantalla filtrada
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -45,6 +45,28 @@
|
|||||||
"VOSE"
|
"VOSE"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "emergency_urls",
|
||||||
|
"type": "list",
|
||||||
|
"label": "Se quieren guardar Enlaces de Emergencia por si se cae la Web?",
|
||||||
|
"default": 1,
|
||||||
|
"enabled": true,
|
||||||
|
"visible": true,
|
||||||
|
"lvalues": [
|
||||||
|
"No",
|
||||||
|
"Guardar",
|
||||||
|
"Borrar",
|
||||||
|
"Actualizar"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "emergency_urls_torrents",
|
||||||
|
"type": "bool",
|
||||||
|
"label": "Se quieren guardar Torrents de Emergencia por si se cae la Web?",
|
||||||
|
"default": true,
|
||||||
|
"enabled": true,
|
||||||
|
"visible": "!eq(-1,'No')"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "include_in_newest_peliculas",
|
"id": "include_in_newest_peliculas",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
|
|||||||
@@ -345,56 +345,100 @@ def findvideos(item):
|
|||||||
if not data:
|
if not data:
|
||||||
logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url)
|
logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url)
|
||||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log'))
|
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log'))
|
||||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
|
||||||
|
|
||||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||||
|
matches = item.emergency_urls[1] #Restauramos matches
|
||||||
|
item.armagedon = True #Marcamos la situación como catastrófica
|
||||||
|
else:
|
||||||
|
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
||||||
|
return item #Devolvemos el Item de la llamada
|
||||||
|
else:
|
||||||
|
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||||
|
|
||||||
|
if not item.armagedon:
|
||||||
|
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||||
if not matches: #error
|
if not matches: #error
|
||||||
logger.error("ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web " + " / PATRON: " + patron + data)
|
item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
|
||||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web. Verificar en la Web esto último y reportar el error con el log'))
|
if item.intervencion: #Sí ha sido clausurada judicialmente
|
||||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error
|
||||||
|
else:
|
||||||
|
logger.error("ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web " + " / PATRON: " + patron + data)
|
||||||
|
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web. Verificar en la Web esto último y reportar el error con el log'))
|
||||||
|
|
||||||
|
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||||
|
matches = item.emergency_urls[1] #Restauramos matches
|
||||||
|
item.armagedon = True #Marcamos la situación como catastrófica
|
||||||
|
else:
|
||||||
|
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
||||||
|
return item #Devolvemos el Item de la llamada
|
||||||
|
else:
|
||||||
|
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||||
|
|
||||||
#logger.debug("PATRON: " + patron)
|
#logger.debug("PATRON: " + patron)
|
||||||
#logger.debug(matches)
|
#logger.debug(matches)
|
||||||
#logger.debug(data)
|
#logger.debug(data)
|
||||||
|
|
||||||
|
#Si es un lookup para cargar las urls de emergencia en la Videoteca...
|
||||||
|
if item.videolibray_emergency_urls:
|
||||||
|
item.emergency_urls = [] #Iniciamos emergency_urls
|
||||||
|
item.emergency_urls.append([]) #Reservamos el espacio para los .torrents locales
|
||||||
|
item.emergency_urls.append(matches) #Salvamnos matches de los vídeos...
|
||||||
|
|
||||||
#Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB
|
#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)
|
if not item.videolibray_emergency_urls:
|
||||||
|
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
|
||||||
|
|
||||||
#Ahora tratamos los enlaces .torrent
|
#Ahora tratamos los enlaces .torrent
|
||||||
for scrapedurl in matches: #leemos los torrents con la diferentes calidades
|
for scrapedurl in matches: #leemos los torrents con la diferentes calidades
|
||||||
if 'javascript' in scrapedurl: #evitamos la basura
|
if 'javascript' in scrapedurl: #evitamos la basura
|
||||||
continue
|
continue
|
||||||
|
url = ''
|
||||||
|
if not item.armagedon:
|
||||||
|
url = urlparse.urljoin(host, scrapedurl)
|
||||||
|
#Leemos la siguiente página, que es de verdad donde está el magnet/torrent
|
||||||
|
try:
|
||||||
|
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)| ", "", httptools.downloadpage(url, timeout=timeout).data)
|
||||||
|
data = unicode(data, "utf-8", errors="replace").encode("utf-8")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
url = urlparse.urljoin(host, scrapedurl)
|
patron = "window.open\('([^']+)'"
|
||||||
#Leemos la siguiente página, que es de verdad donde está el magnet/torrent
|
url = scrapertools.find_single_match(data, patron)
|
||||||
try:
|
if not url: #error
|
||||||
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)| ", "", httptools.downloadpage(url, timeout=timeout).data)
|
logger.error("ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web " + " / PATRON: " + patron + data)
|
||||||
data = unicode(data, "utf-8", errors="replace").encode("utf-8")
|
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web. Verificar en la Web esto último y reportar el error con el log'))
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
patron = "window.open\('([^']+)'"
|
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||||
url = scrapertools.find_single_match(data, patron)
|
item.armagedon = True #Marcamos la situación como catastrófica
|
||||||
if not url: #error
|
else:
|
||||||
logger.error("ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web " + " / PATRON: " + patron + data)
|
continue #si no hay más datos, algo no funciona, pasamos al siguiente
|
||||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web. Verificar en la Web esto último y reportar el error con el log'))
|
|
||||||
continue #si no hay más datos, algo no funciona, pasamos al siguiente
|
|
||||||
|
|
||||||
#Generamos una copia de Item para trabajar sobre ella
|
#Generamos una copia de Item para trabajar sobre ella
|
||||||
item_local = item.clone()
|
item_local = item.clone()
|
||||||
|
|
||||||
item_local.url = urlparse.urljoin(host, url)
|
item_local.url = urlparse.urljoin(host, url)
|
||||||
|
if item.videolibray_emergency_urls:
|
||||||
|
item.emergency_urls[0].append(item_local.url) #guardamos la url y pasamos a la siguiente
|
||||||
|
continue
|
||||||
|
if item.emergency_urls and not item.videolibray_emergency_urls:
|
||||||
|
item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la url del .Torrent ALTERNATIVA
|
||||||
|
if item.armagedon:
|
||||||
|
item_local.url = item.emergency_urls[0][0] #Restauramos la url
|
||||||
|
if len(item.emergency_urls[0]) > 1:
|
||||||
|
del item.emergency_urls[0][0]
|
||||||
|
|
||||||
#Buscamos si ya tiene tamaño, si no, los buscamos en el archivo .torrent
|
#Buscamos si ya tiene tamaño, si no, los buscamos en el archivo .torrent
|
||||||
size = scrapertools.find_single_match(item_local.quality, '\s\[(\d+,?\d*?\s\w\s?[b|B])\]')
|
size = scrapertools.find_single_match(item_local.quality, '\s?\[(\d+,?\d*?\s\w\s?[b|B])\]')
|
||||||
if not size:
|
if not size and not item.armagedon:
|
||||||
size = generictools.get_torrent_size(item_local.url) #Buscamos el tamaño en el .torrent
|
size = generictools.get_torrent_size(item_local.url) #Buscamos el tamaño en el .torrent
|
||||||
if size:
|
if size:
|
||||||
item_local.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item_local.title) #Quitamos size de título, si lo traía
|
item_local.title = re.sub(r'\s?\[\d+,?\d*?\s\w\s?[b|B]\]', '', item_local.title) #Quitamos size de título, si lo traía
|
||||||
item_local.title = '%s [%s]' % (item_local.title, size) #Agregamos size al final del título
|
item_local.title = '%s [%s]' % (item_local.title, size) #Agregamos size al final del título
|
||||||
size = size.replace('GB', 'G B').replace('Gb', 'G b').replace('MB', 'M B').replace('Mb', 'M b')
|
size = size.replace('GB', 'G B').replace('Gb', 'G b').replace('MB', 'M B').replace('Mb', 'M b')
|
||||||
item_local.quality = re.sub(r'\s\[\d+,?\d*?\s\w\s?[b|B]\]', '', item_local.quality) #Quitamos size de calidad, si lo traía
|
item_local.quality = re.sub(r'\s?\[\d+,?\d*?\s\w\s?[b|B]\]', '', item_local.quality) #Quitamos size de calidad, si lo traía
|
||||||
item_local.quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final de la calidad
|
item_local.quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final de la calidad
|
||||||
|
if item.armagedon: #Si es catastrófico, lo marcamos
|
||||||
|
item_local.quality = '[/COLOR][COLOR hotpink][E] [COLOR limegreen]%s' % item_local.quality
|
||||||
|
|
||||||
#Ahora pintamos el link del Torrent
|
#Ahora pintamos el link del Torrent
|
||||||
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.quality, str(item_local.language))
|
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.quality, str(item_local.language))
|
||||||
@@ -421,6 +465,9 @@ def findvideos(item):
|
|||||||
|
|
||||||
#logger.debug(item_local)
|
#logger.debug(item_local)
|
||||||
|
|
||||||
|
if item.videolibray_emergency_urls: #Si ya hemos guardado todas las urls...
|
||||||
|
return item #... nos vamos
|
||||||
|
|
||||||
if len(itemlist_f) > 0: #Si hay entradas filtradas...
|
if len(itemlist_f) > 0: #Si hay entradas filtradas...
|
||||||
itemlist.extend(itemlist_f) #Pintamos pantalla filtrada
|
itemlist.extend(itemlist_f) #Pintamos pantalla filtrada
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -47,6 +47,28 @@
|
|||||||
"VOSE"
|
"VOSE"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "emergency_urls",
|
||||||
|
"type": "list",
|
||||||
|
"label": "Se quieren guardar Enlaces de Emergencia por si se cae la Web?",
|
||||||
|
"default": 1,
|
||||||
|
"enabled": true,
|
||||||
|
"visible": true,
|
||||||
|
"lvalues": [
|
||||||
|
"No",
|
||||||
|
"Guardar",
|
||||||
|
"Borrar",
|
||||||
|
"Actualizar"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "emergency_urls_torrents",
|
||||||
|
"type": "bool",
|
||||||
|
"label": "Se quieren guardar Torrents de Emergencia por si se cae la Web?",
|
||||||
|
"default": true,
|
||||||
|
"enabled": true,
|
||||||
|
"visible": "!eq(-1,'No')"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "timeout_downloadpage",
|
"id": "timeout_downloadpage",
|
||||||
"type": "list",
|
"type": "list",
|
||||||
|
|||||||
@@ -488,6 +488,8 @@ def findvideos(item):
|
|||||||
itemlist = []
|
itemlist = []
|
||||||
itemlist_t = [] #Itemlist total de enlaces
|
itemlist_t = [] #Itemlist total de enlaces
|
||||||
itemlist_f = [] #Itemlist de enlaces filtrados
|
itemlist_f = [] #Itemlist de enlaces filtrados
|
||||||
|
titles = [] #Títulos de servidores Directos
|
||||||
|
urls = [] #Urls de servidores Directos
|
||||||
if not item.language:
|
if not item.language:
|
||||||
item.language = ['CAST'] #Castellano por defecto
|
item.language = ['CAST'] #Castellano por defecto
|
||||||
matches = []
|
matches = []
|
||||||
@@ -512,33 +514,75 @@ def findvideos(item):
|
|||||||
if not data:
|
if not data:
|
||||||
logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url)
|
logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url)
|
||||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log'))
|
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log'))
|
||||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
|
||||||
|
|
||||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||||
|
matches = item.emergency_urls[1] #Restauramos matches de torrents
|
||||||
|
titles = item.emergency_urls[2] #Restauramos títulos de servidores Directos
|
||||||
|
urls = item.emergency_urls[3] #Restauramos urls de servidores Directos
|
||||||
|
item.armagedon = True #Marcamos la situación como catastrófica
|
||||||
|
else:
|
||||||
|
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
||||||
|
return item #Devolvemos el Item de la llamada
|
||||||
|
else:
|
||||||
|
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||||
|
|
||||||
|
if not item.armagedon:
|
||||||
|
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||||
if not matches and not scrapertools.find_single_match(data, 'data-TPlayerNv="Opt\d+">.*? <span>(.*?)</span></li>'): #error
|
if not matches and not scrapertools.find_single_match(data, 'data-TPlayerNv="Opt\d+">.*? <span>(.*?)</span></li>'): #error
|
||||||
logger.error("ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web " + " / PATRON: " + patron + data)
|
item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
|
||||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web. Verificar en la Web esto último y reportar el error con el log'))
|
if item.intervencion: #Sí ha sido clausurada judicialmente
|
||||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error
|
||||||
|
else:
|
||||||
|
logger.error("ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web " + " / PATRON: " + patron + data)
|
||||||
|
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web. Verificar en la Web esto último y reportar el error con el log'))
|
||||||
|
|
||||||
|
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||||
|
matches = item.emergency_urls[1] #Restauramos matches de torrents
|
||||||
|
titles = item.emergency_urls[2] #Restauramos títulos de servidores Directos
|
||||||
|
urls = item.emergency_urls[3] #Restauramos urls de servidores Directos
|
||||||
|
item.armagedon = True #Marcamos la situación como catastrófica
|
||||||
|
else:
|
||||||
|
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
||||||
|
return item #Devolvemos el Item de la llamada
|
||||||
|
else:
|
||||||
|
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||||
|
|
||||||
#logger.debug("PATRON: " + patron)
|
#logger.debug("PATRON: " + patron)
|
||||||
#logger.debug(matches)
|
#logger.debug(matches)
|
||||||
#logger.debug(data)
|
logger.debug(data)
|
||||||
|
|
||||||
|
#Si es un lookup para cargar las urls de emergencia en la Videoteca...
|
||||||
|
if item.videolibray_emergency_urls:
|
||||||
|
item.emergency_urls = [] #Iniciamos emergency_urls
|
||||||
|
item.emergency_urls.append([]) #Reservamos el espacio para los .torrents locales
|
||||||
|
item.emergency_urls.append(matches) #Salvamnos matches de los vídeos...
|
||||||
|
|
||||||
#Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB
|
#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)
|
if not item.videolibray_emergency_urls:
|
||||||
|
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
|
||||||
|
|
||||||
#Ahora tratamos los enlaces .torrent
|
#Ahora tratamos los enlaces .torrent
|
||||||
for scrapedurl, scrapedserver, language, quality in matches: #leemos los torrents con la diferentes calidades
|
for scrapedurl, scrapedserver, language, quality in matches: #leemos los torrents con la diferentes calidades
|
||||||
#Generamos una copia de Item para trabajar sobre ella
|
#Generamos una copia de Item para trabajar sobre ella
|
||||||
item_local = item.clone()
|
item_local = item.clone()
|
||||||
|
|
||||||
if 'torrent' not in scrapedserver.lower(): #Si es un servidor Directo, lo dejamos para luego
|
if 'torrent' not in scrapedserver.lower(): #Si es un servidor Directo, lo dejamos para luego
|
||||||
continue
|
continue
|
||||||
|
|
||||||
item_local.url = scrapedurl
|
item_local.url = scrapedurl
|
||||||
if '.io/' in item_local.url:
|
if '.io/' in item_local.url:
|
||||||
item_local.url = re.sub(r'http.?:\/\/\w+\.\w+\/', host, item_local.url) #Aseguramos el dominio del canal
|
item_local.url = re.sub(r'http.?:\/\/\w+\.\w+\/', host, item_local.url) #Aseguramos el dominio del canal
|
||||||
|
|
||||||
|
if item.videolibray_emergency_urls:
|
||||||
|
item.emergency_urls[0].append(item_local.url) #guardamos la url y pasamos a la siguiente
|
||||||
|
continue
|
||||||
|
if item.emergency_urls and not item.videolibray_emergency_urls:
|
||||||
|
item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la url del .Torrent ALTERNATIVA
|
||||||
|
if item.armagedon:
|
||||||
|
item_local.url = item.emergency_urls[0][0] #Restauramos la url
|
||||||
|
if len(item.emergency_urls[0]) > 1:
|
||||||
|
del item.emergency_urls[0][0]
|
||||||
|
|
||||||
#Detectamos idiomas
|
#Detectamos idiomas
|
||||||
if ("latino" in scrapedurl.lower() or "latino" in language.lower()) and "LAT" not in item_local.language:
|
if ("latino" in scrapedurl.lower() or "latino" in language.lower()) and "LAT" not in item_local.language:
|
||||||
item_local.language += ['LAT']
|
item_local.language += ['LAT']
|
||||||
@@ -554,17 +598,19 @@ def findvideos(item):
|
|||||||
item_local.quality = quality
|
item_local.quality = quality
|
||||||
if scrapertools.find_single_match(item.quality, '(\[\d+:\d+\ h])'):
|
if scrapertools.find_single_match(item.quality, '(\[\d+:\d+\ h])'):
|
||||||
item_local.quality += ' [/COLOR][COLOR white]%s' % scrapertools.find_single_match(item.quality, '(\[\d+:\d+\ h])')
|
item_local.quality += ' [/COLOR][COLOR white]%s' % scrapertools.find_single_match(item.quality, '(\[\d+:\d+\ h])')
|
||||||
|
if item.armagedon: #Si es catastrófico, lo marcamos
|
||||||
|
item_local.quality = '[/COLOR][COLOR hotpink][E] [COLOR limegreen]%s' % item_local.quality
|
||||||
|
|
||||||
#Buscamos si ya tiene tamaño, si no, los buscamos en el archivo .torrent
|
#Buscamos si ya tiene tamaño, si no, los buscamos en el archivo .torrent
|
||||||
size = scrapertools.find_single_match(item_local.quality, '\s\[(\d+,?\d*?\s\w\s?[b|B])\]')
|
size = scrapertools.find_single_match(item_local.quality, '\s\[(\d+,?\d*?\s\w\s?[b|B])\]')
|
||||||
if not size:
|
if not size and not item.armagedon:
|
||||||
size = generictools.get_torrent_size(item_local.url) #Buscamos el tamaño en el .torrent
|
size = generictools.get_torrent_size(item_local.url) #Buscamos el tamaño en el .torrent
|
||||||
if size:
|
if size:
|
||||||
item_local.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item_local.title) #Quitamos size de título, si lo traía
|
item_local.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item_local.title) #Quitamos size de título, si lo traía
|
||||||
item_local.title = '%s [%s]' % (item_local.title, size) #Agregamos size al final del título
|
item_local.title = '%s [%s]' % (item_local.title, size) #Agregamos size al final del título
|
||||||
size = size.replace('GB', 'G B').replace('Gb', 'G b').replace('MB', 'M B').replace('Mb', 'M b')
|
size = size.replace('GB', 'G B').replace('Gb', 'G b').replace('MB', 'M B').replace('Mb', 'M b')
|
||||||
item_local.quality = re.sub(r'\s\[\d+,?\d*?\s\w\s?[b|B]\]', '', item_local.quality) #Quitamos size de calidad, si lo traía
|
item_local.quality = re.sub(r'\s\[\d+,?\d*?\s\w\s?[b|B]\]', '', item_local.quality) #Quitamos size de calidad, si lo traía
|
||||||
item_local.quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final de la calidad
|
item_local.quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final de la calidad
|
||||||
|
|
||||||
#Ahora pintamos el link del Torrent
|
#Ahora pintamos el link del Torrent
|
||||||
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.quality, str(item_local.language))
|
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.quality, str(item_local.language))
|
||||||
@@ -577,9 +623,9 @@ def findvideos(item):
|
|||||||
item_local.quality = re.sub(r'\s?\[COLOR \w+\]\s?\[\/COLOR\]', '', item_local.quality).strip()
|
item_local.quality = re.sub(r'\s?\[COLOR \w+\]\s?\[\/COLOR\]', '', item_local.quality).strip()
|
||||||
item_local.quality = item_local.quality.replace("--", "").replace("[]", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
|
item_local.quality = item_local.quality.replace("--", "").replace("[]", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
|
||||||
|
|
||||||
item_local.alive = "??" #Calidad del link sin verificar
|
item_local.alive = "??" #Calidad del link sin verificar
|
||||||
item_local.action = "play" #Visualizar vídeo
|
item_local.action = "play" #Visualizar vídeo
|
||||||
item_local.server = "torrent" #Servidor Torrent
|
item_local.server = "torrent" #Servidor Torrent
|
||||||
|
|
||||||
itemlist_t.append(item_local.clone()) #Pintar pantalla, si no se filtran idiomas
|
itemlist_t.append(item_local.clone()) #Pintar pantalla, si no se filtran idiomas
|
||||||
|
|
||||||
@@ -601,8 +647,15 @@ def findvideos(item):
|
|||||||
#Ahora tratamos los Servidores Directos
|
#Ahora tratamos los Servidores Directos
|
||||||
itemlist_t = [] #Itemlist total de enlaces
|
itemlist_t = [] #Itemlist total de enlaces
|
||||||
itemlist_f = [] #Itemlist de enlaces filtrados
|
itemlist_f = [] #Itemlist de enlaces filtrados
|
||||||
titles = re.compile('data-TPlayerNv="Opt\d+">.*? <span>(.*?)</span></li>', re.DOTALL).findall(data)
|
if not item.armagedon:
|
||||||
urls = re.compile('id="Opt\d+"><iframe[^>]+src="([^"]+)"', re.DOTALL).findall(data)
|
titles = re.compile('data-..layer..="Opt\d+">(?:<span>)?.*?\s?(?:<strong>.*?<\/strong>)?(?:<\/span>)?<span>(.*?)<\/span><\/li>', re.DOTALL).findall(data)
|
||||||
|
urls = re.compile('id="Opt\d+"><iframe[^>]+src="([^"]+)"', re.DOTALL).findall(data)
|
||||||
|
|
||||||
|
#Si es un lookup para cargar las urls de emergencia en la Videoteca...
|
||||||
|
if item.videolibray_emergency_urls:
|
||||||
|
item.emergency_urls.append(titles) #Salvamnos matches de los títulos...
|
||||||
|
item.emergency_urls.append(urls) #Salvamnos matches de las urls...
|
||||||
|
return item #... y nos vamos
|
||||||
|
|
||||||
#Recorremos la lista de servidores Directos, excluyendo YouTube para trailers
|
#Recorremos la lista de servidores Directos, excluyendo YouTube para trailers
|
||||||
if len(titles) == len(urls):
|
if len(titles) == len(urls):
|
||||||
@@ -618,8 +671,11 @@ def findvideos(item):
|
|||||||
title = titles[0]
|
title = titles[0]
|
||||||
|
|
||||||
if "goo.gl" in urls[i]:
|
if "goo.gl" in urls[i]:
|
||||||
urls[i] = httptools.downloadpage(urls[i], follow_redirects=False, only_headers=True)\
|
try:
|
||||||
.headers.get("location", "")
|
urls[i] = httptools.downloadpage(urls[i], follow_redirects=False, only_headers=True)\
|
||||||
|
.headers.get("location", "")
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
|
||||||
videourl = servertools.findvideos(urls[i]) #Buscamos la url del vídeo
|
videourl = servertools.findvideos(urls[i]) #Buscamos la url del vídeo
|
||||||
|
|
||||||
@@ -661,6 +717,8 @@ def findvideos(item):
|
|||||||
item_local.quality = quality #Añadimos la calidad
|
item_local.quality = quality #Añadimos la calidad
|
||||||
if scrapertools.find_single_match(item.quality, '(\[\d+:\d+\ h])'): #Añadimos la duración
|
if scrapertools.find_single_match(item.quality, '(\[\d+:\d+\ h])'): #Añadimos la duración
|
||||||
item_local.quality += ' [/COLOR][COLOR white]%s' % scrapertools.find_single_match(item.quality, '(\[\d+:\d+\ h])')
|
item_local.quality += ' [/COLOR][COLOR white]%s' % scrapertools.find_single_match(item.quality, '(\[\d+:\d+\ h])')
|
||||||
|
if item.armagedon: #Si es catastrófico, lo marcamos
|
||||||
|
item_local.quality = '[/COLOR][COLOR hotpink][E] [COLOR limegreen]%s' % item_local.quality
|
||||||
item_local.title = '[COLOR yellow][%s][/COLOR] [COLOR yellow][%s][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (alive, server.capitalize(), item_local.quality, str(item_local.language))
|
item_local.title = '[COLOR yellow][%s][/COLOR] [COLOR yellow][%s][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (alive, server.capitalize(), item_local.quality, str(item_local.language))
|
||||||
|
|
||||||
#Preparamos título y calidad, quitamos etiquetas vacías
|
#Preparamos título y calidad, quitamos etiquetas vacías
|
||||||
|
|||||||
Reference in New Issue
Block a user