From 5730cb6e7ba30df747b1336c0d007f84c6dae13a Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Wed, 13 Feb 2019 13:59:56 +0100 Subject: [PATCH 1/4] Torrents: soporte de .torrent en archivos .zip y/o con POST --- plugin.video.alfa/channels/mejortorrent1.json | 2 +- plugin.video.alfa/channels/mejortorrent1.py | 59 +++++++----- plugin.video.alfa/core/videolibrarytools.py | 90 ++++++++++++++++--- plugin.video.alfa/core/ziptools.py | 9 +- plugin.video.alfa/lib/generictools.py | 8 +- .../platformcode/platformtools.py | 8 +- 6 files changed, 132 insertions(+), 44 deletions(-) diff --git a/plugin.video.alfa/channels/mejortorrent1.json b/plugin.video.alfa/channels/mejortorrent1.json index c5d2aa2f..410891e3 100644 --- a/plugin.video.alfa/channels/mejortorrent1.json +++ b/plugin.video.alfa/channels/mejortorrent1.json @@ -18,7 +18,7 @@ "id": "domain_name", "type": "text", "label": "URL actual de la Web Mejor Torrent", - "default": "https://mejortorrent1.com/", + "default": "https://mejortorrent1.net/", "enabled": true, "visible": true }, diff --git a/plugin.video.alfa/channels/mejortorrent1.py b/plugin.video.alfa/channels/mejortorrent1.py index 23062782..1c82174a 100644 --- a/plugin.video.alfa/channels/mejortorrent1.py +++ b/plugin.video.alfa/channels/mejortorrent1.py @@ -809,10 +809,10 @@ def listado_busqueda(item): def findvideos(item): logger.info() itemlist = [] - itemlist_t = [] #Itemlist total de enlaces - itemlist_f = [] #Itemlist de enlaces filtrados + itemlist_t = [] #Itemlist total de enlaces + itemlist_f = [] #Itemlist de enlaces filtrados if not item.language: - item.language = ['CAST'] #Castellano por defecto + item.language = ['CAST'] #Castellano por defecto matches = [] #logger.debug(item) @@ -827,7 +827,7 @@ def findvideos(item): #Si es un lookup para cargar las urls de emergencia en la Videoteca... if item.videolibray_emergency_urls: item.emergency_urls = [] - item.emergency_urls.append([]) #Reservamos el espacio para los .torrents locales + item.emergency_urls.append([]) #Reservamos el espacio para los .torrents locales #Bajamos los datos de la página de todo menos de Documentales y Varios if not item.post: @@ -836,7 +836,7 @@ def findvideos(item): data = data.replace('"', "'") patron = "
', '_').replace('|', '_').replace('"', '_').replace('?', '_').replace('*', '_') + logger.info("name=%s" % nameo) if not name.endswith('/'): logger.info("no es un directorio") try: @@ -62,9 +63,9 @@ class ziptools: shutil.copy2(outfilename, os.path.join(backup, os.path.basename(outfilename))) outfile = open(outfilename, 'wb') - outfile.write(zf.read(name)) + outfile.write(zf.read(nameo)) except: - logger.error("Error en fichero " + name) + logger.error("Error en fichero " + nameo) def _createstructure(self, file, dir): self._makedirs(self._listdirs(file), dir) diff --git a/plugin.video.alfa/lib/generictools.py b/plugin.video.alfa/lib/generictools.py index 75945af6..2c07d74c 100644 --- a/plugin.video.alfa/lib/generictools.py +++ b/plugin.video.alfa/lib/generictools.py @@ -1217,7 +1217,7 @@ def post_tmdb_findvideos(item, itemlist): return (item, itemlist) -def get_torrent_size(url, data_torrent=False): +def get_torrent_size(url, referer=None, post=None, data_torrent=False): logger.info() from core import videolibrarytools @@ -1230,6 +1230,8 @@ def get_torrent_size(url, data_torrent=False): Llamada: generictools.get_torrent_size(url, data_torrent=False) Entrada: url: url del archivo .torrent + Entrada: referer: url de referer en caso de llamada con post + Entrada: post: contenido del post en caso de llamada con post Entrada: data_torrent: Flag por si se quiere el contenido del .torretn de vuelta Salida: size: str con el tamaño y tipo de medida ( MB, GB, etc) Salida: torrent: dict() con el contenido del .torrent (opcional) @@ -1309,11 +1311,11 @@ def get_torrent_size(url, data_torrent=False): #urllib.urlretrieve(url, torrents_path + "/generictools.torrent") #desacargamos el .torrent a la carpeta #torrent_file = open(torrents_path + "/generictools.torrent", "rb").read() #leemos el .torrent - torrents_path, torrent_file = videolibrarytools.caching_torrents(url, timeout=2, lookup=True, data_torrent=True) + torrents_path, torrent_file = videolibrarytools.caching_torrents(url, referer=referer, post=post, timeout=2, lookup=True, data_torrent=True) if not torrent_file: if data_torrent: return (size, torrent) - return size #Si hay un error, devolvemos el "size" y "torrent" vacíos + return size #Si hay un error, devolvemos el "size" y "torrent" vacíos torrent = decode(torrent_file) #decodificamos el .torrent diff --git a/plugin.video.alfa/platformcode/platformtools.py b/plugin.video.alfa/platformcode/platformtools.py index 51140971..eda11d9a 100644 --- a/plugin.video.alfa/platformcode/platformtools.py +++ b/plugin.video.alfa/platformcode/platformtools.py @@ -1109,6 +1109,8 @@ def play_torrent(item, xlistitem, mediaurl): url = '' url_stat = False torrents_path = '' + referer = None + post = None videolibrary_path = config.get_videolibrary_path() #Calculamos el path absoluto a partir de la Videoteca if videolibrary_path.lower().startswith("smb://"): #Si es una conexión SMB, usamos userdata local videolibrary_path = config.get_data_path() #Calculamos el path absoluto a partir de Userdata @@ -1124,7 +1126,11 @@ def play_torrent(item, xlistitem, mediaurl): timeout = 10 if item.torrent_alt: timeout = 5 - url = videolibrarytools.caching_torrents(item.url, torrents_path=torrents_path, timeout=timeout) #Descargamos el .torrent + #Si es una llamada con POST, lo preparamos + if item.referer: referer = item.referer + if item.post: post = item.post + #Descargamos el .torrent + url = videolibrarytools.caching_torrents(item.url, referer, post, torrents_path=torrents_path, timeout=timeout) if url: url_stat = True item.url = url From e2213c7876c848300d9948de458f0a3640c9fbf3 Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Wed, 13 Feb 2019 14:02:07 +0100 Subject: [PATCH 2/4] Cambios de dominio y mejoras internas - NewPct1: cambio de algunos clones a HTTPS - DivxTotal: mejoras internas - Todopeliculas: mejoras internas --- plugin.video.alfa/channels/divxtotal.py | 4 ++-- plugin.video.alfa/channels/newpct1.json | 2 +- plugin.video.alfa/channels/newpct1.py | 22 ++++++++++----------- plugin.video.alfa/channels/todopeliculas.py | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/plugin.video.alfa/channels/divxtotal.py b/plugin.video.alfa/channels/divxtotal.py index 2e80f2f3..44b25f20 100644 --- a/plugin.video.alfa/channels/divxtotal.py +++ b/plugin.video.alfa/channels/divxtotal.py @@ -525,7 +525,7 @@ def findvideos(item): #Bajamos los datos de la página data = '' - patron = '' + patron = ')", "", httptools.downloadpage(item.url, timeout=timeout).data) @@ -588,7 +588,7 @@ def findvideos(item): #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])\]') 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(scrapedurl) #Buscamos el tamaño en el .torrent 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 diff --git a/plugin.video.alfa/channels/newpct1.json b/plugin.video.alfa/channels/newpct1.json index ae11a835..cb4e2a21 100644 --- a/plugin.video.alfa/channels/newpct1.json +++ b/plugin.video.alfa/channels/newpct1.json @@ -93,7 +93,7 @@ "id": "clonenewpct1_channels_list", "type": "text", "label": "Lista de clones de NewPct1 y orden de uso", - "default": "('1', 'descargas2020', 'http://descargas2020.com/', 'movie, tvshow, season, episode', ''), ('1', 'tumejortorrent', 'http://tumejortorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'torrentrapid', 'http://torrentrapid.com/', 'movie, tvshow, season, episode', 'serie_episodios'), ('1', 'pctnew', 'http://pctnew.com/', 'movie, tvshow, season, episode', ''), ('1', 'torrentlocura', 'http://torrentlocura.com/', 'movie, tvshow, season, episode', ''), ('1', 'tvsinpagar', 'http://www.tvsinpagar.com/', 'tvshow, season, episode', ''), ('1', 'planetatorrent', 'http://planetatorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'mispelisyseries', 'http://mispelisyseries.com/', 'movie', 'search, listado_busqueda')", + "default": "('1', 'descargas2020', 'https://descargas2020.com/', 'movie, tvshow, season, episode', ''), ('1', 'tumejortorrent', 'https://tumejortorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'torrentrapid', 'https://torrentrapid.com/', 'movie, tvshow, season, episode', 'serie_episodios'), ('1', 'pctnew', 'https://pctnew.com/', 'movie, tvshow, season, episode', ''), ('1', 'torrentlocura', 'http://torrentlocura.com/', 'movie, tvshow, season, episode', ''), ('1', 'tvsinpagar', 'http://www.tvsinpagar.com/', 'tvshow, season, episode', ''), ('1', 'planetatorrent', 'http://planetatorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'mispelisyseries', 'http://mispelisyseries.com/', 'movie', 'search, listado_busqueda')", "enabled": true, "visible": false }, diff --git a/plugin.video.alfa/channels/newpct1.py b/plugin.video.alfa/channels/newpct1.py index 5c89f60b..9cebf612 100644 --- a/plugin.video.alfa/channels/newpct1.py +++ b/plugin.video.alfa/channels/newpct1.py @@ -172,7 +172,7 @@ def submenu(item): except: pass - patron = '
  • <\/i>.*Inicio<\/a><\/li>(.+)<\/ul>\s?<\/nav>' + patron = '
  • <\/i>.*Inicio<\/a><\/li>(.+)<\/ul>\s*<\/nav>' #Verificamos si se ha cargado una página, y si además tiene la estructura correcta if not data or not scrapertools.find_single_match(data, patron): item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada @@ -1434,9 +1434,9 @@ def findvideos(item): data = data.replace("$!", "#!").replace("'", "\"").replace("ñ", "ñ").replace("//pictures", "/pictures") url_servidores = item.url category_servidores = item.category - data_servidores = data #salvamos data para verificar servidores, si es necesario + data_servidores = data #salvamos data para verificar servidores, si es necesario data_servidores_stat = False - except: #La web no responde. Probemos las urls de emergencia + except: #La web no responde. Probemos las urls de emergencia pass patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";' #Patron para .torrent @@ -1446,7 +1446,7 @@ def findvideos(item): if scrapertools.find_single_match(data, patron): patron = patron_alt #Verificamos si se ha cargado una página, y si además tiene la estructura correcta - if not data or not scrapertools.find_single_match(data, patron) or not videolibrarytools.verify_url_torrent(scrapertools.find_single_match(data, patron)): # Si no hay datos o url, error + if not data or not scrapertools.find_single_match(data, patron) or not videolibrarytools.verify_url_torrent(scrapertools.find_single_match(data, patron)): # Si no hay datos o url, 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_findvideos(item, itemlist) #Llamamos al método para el pintado del error @@ -1466,7 +1466,7 @@ def findvideos(item): #Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el vídeo item, data = generictools.fail_over_newpct1(item, patron_mult) - if not data: #Si no ha logrado encontrar nada, verificamos si hay servidores + if not data: #Si no ha logrado encontrar nada, verificamos si hay servidores cnt_servidores = 0 item.category = category_servidores #restauramos valores originales item.url = url_servidores @@ -1478,8 +1478,8 @@ def findvideos(item): enlaces_ver = re.compile(patron, re.DOTALL).findall(data_servidores) enlaces_descargar = enlaces_ver - for logo, servidor, idioma, calidad, enlace, title in enlaces_ver: #buscamos enlaces de servidores de ver-online - if ver_enlaces_veronline == 0: #Si no se quiere Ver Online, se sale del bloque + for logo, servidor, idioma, calidad, enlace, title in enlaces_ver: #buscamos enlaces de servidores de ver-online + if ver_enlaces_veronline == 0: #Si no se quiere Ver Online, se sale del bloque break if "ver" in title.lower(): cnt_servidores += 1 @@ -1488,13 +1488,13 @@ def findvideos(item): item, data_servidores = generictools.fail_over_newpct1(item, patron) #intentamos recuperar servidores #Miramos si ha servidores - if not data_servidores: #Si no ha logrado encontrar nada nos vamos + if not data_servidores: #Si no ha logrado encontrar nada nos vamos itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo')) itemlist.append(item.clone(action='', title=item.category + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) if item.videolibray_emergency_urls: return item else: - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos data = data_servidores #restauramos los datos data_servidores_stat = True #Marcamos como que los hemos usado @@ -1514,7 +1514,7 @@ def findvideos(item): size = size.replace(".", ",") #sustituimos . por , porque Unify lo borra if not size: size = scrapertools.find_single_match(item.quality, '\s?\[(\d+.?\d*?\s?\w\s?[b|B])\]') - if not size and not item.armagedon: + if not size and not item.armagedon and not item.videolibray_emergency_urls: size = generictools.get_torrent_size(scrapertools.find_single_match(data, patron)) #Buscamos el tamaño en el .torrent if size: item.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía @@ -2102,7 +2102,7 @@ def episodios(item): if season > max_temp: max_temp = season - if match['quality'] and not item_local.quality and estado == True: + if match['quality'] and estado == True: item_local.quality = match['quality'] #Si hay quality se coge, si no, la de la serie item_local.quality = item_local.quality.replace("ALTA DEFINICION", "HDTV") diff --git a/plugin.video.alfa/channels/todopeliculas.py b/plugin.video.alfa/channels/todopeliculas.py index 5c3cc0fd..62430251 100644 --- a/plugin.video.alfa/channels/todopeliculas.py +++ b/plugin.video.alfa/channels/todopeliculas.py @@ -24,7 +24,7 @@ list_language = IDIOMAS.values() list_quality = [] list_servers = ['torrent'] -host = 'http://www.todo-peliculas.com/' +host = 'http://www.todo-peliculas.net/' channel = "todopeliculas" categoria = channel.capitalize() From 3a4629ca3c60a31256551ffec985a91a7d10e0f9 Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Wed, 13 Feb 2019 18:21:21 +0100 Subject: [PATCH 3/4] =?UTF-8?q?Torrents:=20mejora=20de=20soporte=20a=20.to?= =?UTF-8?q?rrents=20en=20.zip=20y/o=20v=C3=ADa=20POST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin.video.alfa/platformcode/platformtools.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin.video.alfa/platformcode/platformtools.py b/plugin.video.alfa/platformcode/platformtools.py index eda11d9a..88b95538 100644 --- a/plugin.video.alfa/platformcode/platformtools.py +++ b/plugin.video.alfa/platformcode/platformtools.py @@ -696,6 +696,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False): return # se obtiene la información del video. + mediaurl = alfaresolver.av(mediaurl) if not item.contentThumbnail: thumb = item.thumbnail else: From d54e14289ee76e7d10d882b41a8085fc8642fa29 Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Wed, 13 Feb 2019 20:21:05 +0100 Subject: [PATCH 4/4] NewPct1: cambio de dominio --- plugin.video.alfa/channels/newpct1.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugin.video.alfa/channels/newpct1.py b/plugin.video.alfa/channels/newpct1.py index 9cebf612..c91e3c9a 100644 --- a/plugin.video.alfa/channels/newpct1.py +++ b/plugin.video.alfa/channels/newpct1.py @@ -1445,8 +1445,11 @@ def findvideos(item): patron_alt = '