Merge pull request #592 from lopezvg/master

Mejoras internas
This commit is contained in:
Alfa
2019-04-03 11:08:09 -05:00
committed by GitHub
12 changed files with 390 additions and 249 deletions

View File

@@ -85,7 +85,7 @@ def submenu(item):
if item.extra == "series":
item.url_plus = "serie/"
item.url_plus = "series-12/"
itemlist.append(item.clone(title="Series completas", action="listado", url=item.url + item.url_plus, url_plus=item.url_plus, thumbnail=thumb_series, extra="series"))
itemlist.append(item.clone(title="Alfabético A-Z", action="alfabeto", url=item.url + item.url_plus + "?s=letra-%s", url_plus=item.url_plus, thumbnail=thumb_series, extra="series"))
@@ -141,7 +141,7 @@ def categorias(item):
if not extra3:
itemlist.append(item.clone(title="Todas las " + item.extra.upper(), action="listado"))
itemlist.append(item.clone(title="Alfabético A-Z", action="alfabeto", url=item.url + "?s=letra-%s"))
itemlist.append(item.clone(title="Géneros", url=item.url))
#itemlist.append(item.clone(title="Géneros", url=item.url))
for scrapedurl, scrapedtitle in matches:
if item.url_plus not in scrapedurl:

View File

@@ -24,7 +24,7 @@ list_language = IDIOMAS.values()
list_quality = []
list_servers = ['torrent']
host = 'http://www.elitetorrent.biz'
host = 'http://www.elitetorrent.io'
channel = "elitetorrent"
categoria = channel.capitalize()
@@ -85,9 +85,9 @@ def submenu(item):
return itemlist #Algo no funciona, pintamos lo que tenemos
patron = '<div class="cab_menu">.*?<\/div>' #Menú principal
data1 = scrapertools.get_match(data, patron)
data1 = scrapertools.find_single_match(data, patron)
patron = '<div id="menu_langen">.*?<\/div>' #Menú de idiomas
data1 += scrapertools.get_match(data, patron)
data1 += scrapertools.find_single_match(data, patron)
patron = '<a href="(.*?)".*?title="(.*?)"' #Encontrar todos los apartados
matches = re.compile(patron, re.DOTALL).findall(data1)
@@ -155,16 +155,16 @@ def listado(item):
patron = '<div id="principal">.*?<\/nav><\/div><\/div>'
data = scrapertools.find_single_match(data, patron)
patron = '<li>.*?<a href="(.*?)".*?' #url
patron += 'title="(.*?)".*?' #título
patron += 'src="(.*?)".*?' #thumb
patron += "title='(.*?)'.*?" #categoría, idioma
patron += '"><i>(.*?)<\/i><\/span.*?' #calidad
patron += '="dig1">(.*?)<.*?' #tamaño
patron += '="dig2">(.*?)<\/span><\/div>' #tipo tamaño
patron = '<li>\s*<div\s*class="[^"]+">\s*<a href="([^"]+)"\s*' #url
patron += 'title="([^"]+)"\s*(?:alt="[^"]+")?\s*>\s*' #título
patron += '<img (?:class="[^"]+")?\s*src="([^"]+)"\s*border="[^"]+"\s*' #thumb
patron += 'title="([^"]+)".*?' #categoría, idioma
patron += '<span class="[^"]+" style="[^"]+"\s*><i>(.*?)<\/i><\/span.*?' #calidad
patron += '="dig1">(.*?)<.*?' #tamaño
patron += '="dig2">(.*?)<\/span><\/div>' #tipo tamaño
matches = re.compile(patron, re.DOTALL).findall(data)
if not matches and not '<title>503 Backend fetch failed</title>' in data: #error
if not matches and not '<title>503 Backend fetch failed</title>' in data and not 'No se han encontrado resultados' in data: #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

View File

@@ -25,6 +25,7 @@ list_quality = []
list_servers = ['torrent']
host = 'http://estrenosby.net/' # 'http://estrenosli.org/'
host_alt = 'http://estrenoske.net/'
channel = "estrenosgo"
color1, color2, color3 = ['0xFF58D3F7', '0xFF2E64FE', '0xFF0404B4']
@@ -320,7 +321,8 @@ def listado(item):
patron_serie = '<div id="where_i_am">.*?<a href="[^"]+">.*?<\/a>.*?<a href="([^"]+)">'
url = scrapertools.find_single_match(data_serie, patron_serie) #buscamos la url de la serie completa
if url:
url = host + url
if host not in url and host_alt not in url:
url = host + url
extra = 'series' #es una serie completa
title_lista += [cat_sec] #la añadimos a la lista de series completas procesadas
title = cat_sec #salvamos el título de la serie completa
@@ -361,7 +363,10 @@ def listado(item):
quality_alt = cat_sec.lower().strip()
item_local.extra = extra #guardamos el extra procesado
item_local.url = url #guardamos la url final
item_local.thumbnail = host[:-1] + scrapedthumbnail #guardamos el thumb
if host not in scrapedthumbnail and host_alt not in scrapedthumbnail:
item_local.thumbnail = host[:-1] + scrapedthumbnail #guardamos el thumb
else:
item_local.thumbnail = scrapedthumbnail #guardamos el thumb sin Host
item_local.context = "['buscar_trailer']"
item_local.contentType = "movie" #por defecto, son películas
@@ -743,7 +748,7 @@ def findvideos(item):
#Ahora tratamos los enlaces .torrent
itemlist_alt = [] #Usamos una lista intermedia para poder ordenar los episodios
if matches_torrent:
for scrapedurl, scrapedquality, scrapedlang in matches_torrent: #leemos los torrents con la diferentes calidades
for scrapedurl, scrapedquality, scrapedlang in matches_torrent: #leemos los torrents con la diferentes calidades
#Generamos una copia de Item para trabajar sobre ella
item_local = item.clone()
@@ -772,7 +777,7 @@ def findvideos(item):
patron = '<div class="linksDescarga"><span class="titulo">Descargar Torrent: <\/span><br><a href="([^"]+)" class="TTlink">&raquo;\s?(.*?)\s?&laquo;<\/a>'
matches = re.compile(patron, re.DOTALL).findall(data)
else:
matches = item.emergency_urls[2][0] #Guardamos los matches de Directos, si los hay
matches = item.emergency_urls[2][0] #Guardamos los matches de Directos, si los hay
del item.emergency_urls[2][0] #Una vez tratado lo limpiamos
data = 'xyz123' #iniciamos data para que no dé problemas
@@ -781,15 +786,20 @@ def findvideos(item):
if not data or not matches:
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / URL: " + item_local.url + " / DATA: " + data)
continue #si no hay más datos, algo no funciona, pasamos a Ver Online
continue #si no hay más datos, algo no funciona, pasamos a Ver Online
#logger.debug(patron)
#logger.debug(matches)
#logger.debug(data)
for scrapedtorrent, scrapedtitle in matches:
for scrapedtorrent_alt, scrapedtitle in matches:
if host not in scrapedtorrent_alt and host_alt not in scrapedtorrent_alt:
scrapedtorrent = host + scrapedtorrent_alt
else:
scrapedtorrent = scrapedtorrent_alt
if item.videolibray_emergency_urls:
item.emergency_urls[0].append(host + scrapedtorrent)
item.emergency_urls[0].append(scrapedtorrent)
else:
item_local = item_local.clone()
quality = item_local.quality
@@ -829,19 +839,19 @@ def findvideos(item):
quality = '[%s] %s' % (qualityscraped, item_local.quality)
#Ahora pintamos el link del Torrent
item_local.url = host + scrapedtorrent
item_local.url = scrapedtorrent
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
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
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
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
if item.armagedon: #Si es catastrófico, lo marcamos
quality = '[/COLOR][COLOR hotpink][E] [COLOR limegreen]%s' % quality
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (quality, str(item_local.language))

View File

@@ -498,6 +498,7 @@ def findvideos(item):
return item #Devolvemos el Item de la llamada
else:
return itemlist #salimos
data = unicode(data, "utf-8", errors="replace").encode("utf-8")
data = scrapertools.find_single_match(data, 'div id="Tokyo" [^>]+>(.*?)</div>') #Seleccionamos la zona de links

View File

@@ -5,9 +5,10 @@ import sys
import urllib
import urlparse
import time
import traceback
from channelselector import get_thumb
from core import httptools
from core import httptools, proxytools
from core import scrapertools
from core import servertools
from core.item import Item
@@ -26,7 +27,7 @@ list_servers = ['torrent']
channel = "mejortorrent"
host = 'http://www.mejortorrent.tv/'
host = 'http://www.mejortorrent.tv'
host_sufix = '.tv'
#host = config.get_setting('domain_name', channel)
@@ -61,7 +62,7 @@ def mainlist(item):
thumbnail=thumb_pelis_hd))
itemlist.append(Item(channel=item.channel, title="Películas Listado Alfabetico", action="alfabeto",
url= host + "/peliculas-buscador.html" +
"?campo=letra&valor&valor2=Acci%%F3n&valor3=%s&valor4=3&submit=Buscar", extra="peliculas",
"?campo=letra&valor=&valor2=Acci%%F3n&valor3=%s&valor4=3&submit=Buscar", extra="peliculas",
thumbnail=thumb_pelis))
itemlist.append(Item(channel=item.channel, title="Series", action="listado", extra="series", tipo=False,
url= host + "/torrents-de-series.html", thumbnail=thumb_series))
@@ -102,7 +103,7 @@ def alfabeto(item):
url= host + "/secciones.php?sec=descargas&ap=series_hd&func=mostrar&letra=."))
for letra in ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']:
itemlist.append(Item(channel=item.channel, action="listado", title=letra, extra="series", tipo=True,
url= host + "/secciones.php?sec=descargas&ap=series_hd&func=mostrar&letra=" + letra.lower()))
url= host + "/secciones.php?sec=descargas&ap=series_hd&func=mostrar&letra=" + letra))
elif item.extra == "series" or item.extra == "documentales":
itemlist.append(Item(channel=item.channel, action="listado", title="Todas", extra=item.extra, tipo=True, url= host + "/" + item.extra + "-letra-..html"))
@@ -112,7 +113,7 @@ def alfabeto(item):
elif item.extra == "peliculas":
itemlist.append(Item(channel=item.channel, action="listado", title="Todas", extra=item.extra, tipo=True, url=item.url % "."))
for letra in ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']:
itemlist.append(Item(channel=item.channel, action="listado", title=letra, extra=item.extra, tipo=True, url=item.url % letra.lower()))
itemlist.append(Item(channel=item.channel, action="listado", title=letra, extra=item.extra, tipo=True, url=item.url % letra))
return itemlist
@@ -128,13 +129,15 @@ def listado(item):
del item.totalItems
try:
# La url de Películas por orden Alfabético tiene un formato distinto
data = ''
# La url de Películas por orden Alfabético tiene un formato distinto
if item.extra == "peliculas" and item.tipo:
url = item.url.split("?")
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(url[0], post=url[1]).data)
else:
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url).data)
except:
logger.error(traceback.format_exc())
logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. 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
@@ -145,35 +148,35 @@ def listado(item):
# En este canal las url's y los títulos tienen diferente formato dependiendo del contenido
if item.extra == "peliculas" and item.tipo: #Desde Lista Alfabética
patron = "<a href='(/peli-descargar-torrent[^']+)'()"
patron = "<a href='((?:[^']+)?/peli-descargar-torrent[^']+)'()"
patron_enlace = "/peli-descargar-torrent-\d+-(.*?)\.html"
patron_title = "<a href='/peli-descargar-torrent[^']+'[^>]+>([^>]+)</a>(\s*<b>([^>]+)</b>)?"
patron_title = "<a href='(?:[^']+)?/peli-descargar-torrent[^']+'[^>]+>([^>]+)</a>(\s*<b>([^>]+)</b>)?"
item.action = "findvideos"
item.contentType = "movie"
pag = False #No hay paginación
elif item.extra == "peliculas" and not item.tipo: #Desde Menú principal
patron = '<a href="(/peli-descargar-torrent[^"]+)">?'
patron = '<a href="((?:[^"]+)?/peli-descargar-torrent[^"]+)">?'
patron += '<img src="([^"]+)"[^<]+</a>'
patron_enlace = "/peli-descargar-torrent-\d+-(.*?)\.html"
patron_title = '<a href="/peli-descargar-torrent[^"]+">([^<]+)</a>(\s*<b>([^>]+)</b>)?'
patron_title = '<a href="(?:[^"]+)?/peli-descargar-torrent[^"]+">([^<]+)</a>(\s*<b>([^>]+)</b>)?'
item.action = "findvideos"
item.contentType = "movie"
pag = True #Sí hay paginación
cnt_tot = 25 # Poner el num. máximo de items por página. Parece que hay 50
elif item.extra == "series" and item.tipo:
patron = "<a href='(/serie-descargar-torrent[^']+)'>()"
patron = "<a href='((?:[^']+)?/serie-descargar-torrent[^']+)'>()"
patron_enlace = "\/serie-descargar-torrent*.-\d+-?\d+-(.*?)\.html"
patron_title = "<a href='\/serie-descargar-torrent[^']+'>([^<]+)<\/a>(\s*<b>([^>]+)<\/b>)?"
patron_title = "<a href='(?:[^']+)?\/serie-descargar-torrent[^']+'>([^<]+)<\/a>(\s*<b>([^>]+)<\/b>)?"
patron_title_ep = "\/serie-descargar-torrent*.-\d+-?\d+-(.*?)-\d+x\d+.*?\.html"
patron_title_se = "\/serie-descargar-torrent*.-\d+-?\d+-(.*?)-\d+-Temp.*?\.html"
item.action = "episodios"
item.contentType = "season"
pag = False
elif item.extra == "series" and not item.tipo:
patron = '<a href="(\/serie-[^a_z]{0,10}descargar-torrent[^"]+)">?'
patron = '<a href="((?:[^"]+)?\/serie-[^a_z]{0,10}descargar-torrent[^"]+)">?'
patron += '<img src="([^"]+)"[^<]+</a>'
patron_enlace = "\/serie-[^a_z]{0,10}descargar-torrent*.-\d+-?\d+-(.*?)\.html"
patron_title = '<a href="/serie-[^a_z]{0,10}descargar-torrent[^"]+">([^<]+)</a>(\s*<b>([^>]+)</b>)?'
patron_title = '<a href="(?:[^"]+)?/serie-[^a_z]{0,10}descargar-torrent[^"]+">([^<]+)</a>(\s*<b>([^>]+)</b>)?'
patron_title_ep = "\/serie-[^a_z]{0,10}descargar-torrent*.-\d+-?\d+-(.*?)-\d+x\d+.*?\.html"
patron_title_se = "\/serie-[^a_z]{0,10}descargar-torrent*.-\d+-?\d+-(.*?)-\d+-Temp.*?\.html"
item.action = "episodios"
@@ -181,19 +184,19 @@ def listado(item):
pag = True
cnt_tot = 10 # Se reduce el numero de items por página porque es un proceso pesado
elif item.extra == "documentales" and item.tipo:
patron = "<a href='(/doc-descargar-torrent[^']+)'>()"
patron = "<a href='((?:[^']+)?/doc-descargar-torrent[^']+)'>()"
patron_enlace = "\/doc-descargar-torrent*.-\d+-?\d+-(.*?)\.html"
patron_title = "<a href='\/doc-descargar-torrent[^']+'>([^<]+)<\/a>(\s*<b>([^>]+)<\/b>)?"
patron_title = "<a href='(?:[^']+)?\/doc-descargar-torrent[^']+'>([^<]+)<\/a>(\s*<b>([^>]+)<\/b>)?"
patron_title_ep = "\/doc-descargar-torrent*.-\d+-?\d+-(.*?)-\d+x\d+.*?\.html"
patron_title_se = "\/doc-descargar-torrent*.-\d+-?\d+-(.*?)-\d+-Temp.*?\.html"
item.action = "episodios"
item.contentType = "tvshow"
pag = False
else:
patron = '<a href="(/doc-descargar-torrent[^"]+)">?'
patron = '<a href="((?:[^"]+)?/doc-descargar-torrent[^"]+)">?'
patron += '<img src="([^"]+)"[^<]+</a>'
patron_enlace = "/doc-descargar-torrent-\d+-\d+-(.*?)\.html"
patron_title = '<a href="/doc-descargar-torrent[^"]+">([^<]+)</a>(\s*<b>([^>]+)</b>)?'
patron_title = '<a href="(?:[^"]+)?/doc-descargar-torrent[^"]+">([^<]+)</a>(\s*<b>([^>]+)</b>)?'
patron_title_ep = "\/doc-descargar-torrent*.-\d+-?\d+-(.*?)-\d+x\d+.*?\.html"
patron_title_se = "\/doc-descargar-torrent*.-\d+-?\d+-(.*?)-\d+-Temp.*?\.html"
item.action = "episodios"
@@ -237,10 +240,13 @@ def listado(item):
url_last_page = re.sub(r"\d+$", "9999", url_next_page)
data_last = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(url_last_page).data)
patron_last_page = "<span class='nopaginar'>(\d+)<\/span>"
if item.extra == "documentales":
item.last_page = int(scrapertools.find_single_match(data_last, patron_last_page))
else:
item.last_page = int(scrapertools.find_single_match(data_last, patron_last_page)) * (len(matches) / cnt_tot)
try:
if item.extra == "documentales":
item.last_page = int(scrapertools.find_single_match(data_last, patron_last_page))
else:
item.last_page = int(scrapertools.find_single_match(data_last, patron_last_page)) * (len(matches) / cnt_tot)
except:
item.last_page = 1
if matches_cnt > cnt_tot and item.extra == "documentales" and pag:
item.next_page = ''
@@ -295,10 +301,10 @@ def listado(item):
item_local.title = ''
item_local.context = "['buscar_trailer']"
item_local.title = scrapertools.get_match(scrapedurl, patron_enlace)
item_local.title = scrapertools.find_single_match(scrapedurl, patron_enlace)
item_local.title = item_local.title.replace("-", " ")
item_local.url = verificar_url(urlparse.urljoin(item_local.url, scrapedurl))
item_local.thumbnail = verificar_url(host + urllib.quote(scrapedthumbnail))
item_local.url = verificar_url(urlparse.urljoin(item_local.url, scrapedurl)).replace(' ', '%20')
item_local.thumbnail = verificar_url(urlparse.urljoin(host, scrapedthumbnail)).replace(' ', '%20')
item_local.contentThumbnail = item_local.thumbnail
item_local.infoLabels['year'] = '-' # Al no saber el año, le ponemos "-" y TmDB lo calcula automáticamente
@@ -429,7 +435,7 @@ def listado(item):
if info != "" and not item_local.quality:
item_local.quality = info
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 "(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 "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:
@@ -515,22 +521,22 @@ def listado_busqueda(item):
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
# busca series y Novedades
patron = "<a href='(\/serie-descargar-torrent[^']+)'[^>]+>(.*?)<\/a>"
patron = "<a href='((?:[^']+)?\/serie-descargar-torrent[^']+)'[^>]+>(.*?)<\/a>"
patron += ".*?<span style='color:\w+;'>([^']+)<\/span>"
patron_enlace = "\/serie-descargar-torrents-\d+-\d+-(.*?)\.html"
matches = scrapertools.find_multiple_matches(data, patron)
# busca pelis y Novedades
patron = "<a href='(\/peli-descargar-torrent[^']+)'[^>]+>(.*?)<\/a>"
patron = "<a href='((?:[^']+)?\/peli-descargar-torrent[^']+)'[^>]+>(.*?)<\/a>"
patron += ".*?<span style='color:\w+;'>([^']+)<\/a>"
matches += re.compile(patron, re.DOTALL).findall(data) #Busquedas
patron = "<a href='(\/peli-descargar-torrent[^']+)'[^>]+>(.*?)<\/a>"
patron = "<a href='((?:[^']+)?\/peli-descargar-torrent[^']+)'[^>]+>(.*?)<\/a>"
patron += ".*?<span style='color:\w+;'>([^']+)<\/span>"
patron_enlace = "\/peli-descargar-torrent-\d+(.*?)\.html"
matches += re.compile(patron, re.DOTALL).findall(data) #Novedades
# busca docu
patron = "<a href='(\/doc-descargar-torrent[^']+)' .*?"
patron = "<a href='((?:[^']+)?\/doc-descargar-torrent[^']+)' .*?"
patron += "<font Color='\w+'>(.*?)<\/a>.*?"
patron += "<td align='right' width='20%'>(.*?)<\/td>"
patron_enlace = "\/doc-descargar-torrent-\d+-\d+-(.*?)\.html"
@@ -661,7 +667,7 @@ def listado_busqueda(item):
item_local.quality = scrapertools.remove_htmltags(scrapedinfo).decode('iso-8859-1').encode('utf8')
item_local.quality = item_local.quality.replace("(", "").replace(")", "").replace("[", "").replace("]", "").replace("Documental", "").replace("documental", "")
item_local.url = verificar_url(urlparse.urljoin(item.url, scrapedurl))
item_local.url = verificar_url(urlparse.urljoin(item.url, scrapedurl)).replace(' ', '%20')
#Preparamos la información básica para TMDB
if "/serie-" in scrapedurl or "/doc-" in scrapedurl:
@@ -686,7 +692,7 @@ def listado_busqueda(item):
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 "(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 "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:
@@ -777,10 +783,10 @@ def findvideos(item):
if item.post: #Puede traer datos para una llamada "post". De momento usado para documentales, pero podrían ser series
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url, post=item.post).data)
data = data.replace('"', "'")
patron = ">Pincha.*?<a href='(.*?\/uploads\/torrents\/\w+\/.*?\.torrent)'"
patron = ">Pincha.*?<a href='((?:[^']+)?\/uploads\/torrents\/\w+\/.*?\.torrent)'"
else:
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url).data)
patron = "<a href='(secciones.php\?sec\=descargas&ap=contar&tabla=[^']+)'"
patron = "<a href='((?:[^']+)?secciones.php\?sec\=descargas&ap=contar&tabla=[^']+)'"
except:
pass
@@ -795,7 +801,7 @@ def findvideos(item):
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
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
if not item.armagedon: #Si es un proceso normal, seguimos
matches = re.compile(patron, re.DOTALL).findall(data)
@@ -852,13 +858,12 @@ def findvideos(item):
else:
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
#logger.debug(torrent_data)
if not item.armagedon:
item_local.url = scrapertools.get_match(torrent_data, ">Pincha.*?<a href='(.*?\/uploads\/torrents\/\w+\/.*?\.torrent)'")
item_local.url = scrapertools.find_single_match(torrent_data, ">Pincha.*?<a href='((?:[^']+)?\/uploads\/torrents\/\w+\/.*?\.torrent)'")
item_local.url = verificar_url(urlparse.urljoin(url, item_local.url))
elif not item.armagedon:
item_local.url = url # Ya teníamos el link desde el primer nivel (documentales)
item_local.url = url # Ya teníamos el link desde el primer nivel (documentales)
item_local.url = item_local.url.replace(" ", "%20")
if item.armagedon and item.emergency_urls and not item.videolibray_emergency_urls:
@@ -956,7 +961,7 @@ def episodios(item):
# Selecciona en tramo que nos interesa
data = scrapertools.find_single_match(data_alt,
"(<form name='episodios' action='secciones.php\?sec=descargas\&ap=contar_varios' method='post'>.*?)</form>")
"(<form name='episodios' action='(?:[^']+)?secciones.php\?sec=descargas\&ap=contar_varios' method='post'>.*?)</form>")
# Prepara el patrón de búsqueda de: URL, título, fechas y dos valores mas sin uso
if '/serie' in item.url:
@@ -974,7 +979,7 @@ def episodios(item):
item, itemlist = generictools.post_tmdb_episodios(item, itemlist) #Llamamos al método para el pintado del error
return itemlist #Salimos
logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data_alt)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log'))
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
@@ -1054,8 +1059,8 @@ def episodios(item):
def verificar_url(url):
if '.com' in url or '.net' in url or '.org' in url:
url = url.replace('.com', '.tv').replace('.net', '.tv').replace('.org', '.tv')
if '.com' in url or '.net' in url or '.org' in url or '.tv' in url:
url = url.replace('.com', host_sufix).replace('.net', host_sufix).replace('.org', host_sufix).replace('.tv', host_sufix)
url = url.replace('torrents/tmp/torrent.php?table=peliculas/&name=', 'torrents/peliculas/')
url = url.replace('torrents/tmp/torrent.php?table=series/&name=', 'torrents/series/')
url = url.replace('torrents/tmp/torrent.php?table=documentales/&name=', 'torrents/documentales/')

View File

@@ -25,7 +25,8 @@ list_quality = []
list_servers = ['torrent']
channel = "mejortorrent1"
host = config.get_setting('domain_name', channel)
#host = config.get_setting('domain_name', channel)
host = "https://mejortorrent1.net/"
categoria = channel.capitalize()
__modo_grafico__ = config.get_setting('modo_grafico', channel)
@@ -889,7 +890,6 @@ def findvideos(item):
torrent_data = httptools.downloadpage(url, post=post, headers=headers, follow_redirects=False)
except: #error
pass
else:
#Viene de SERIES y DOCUMENTALES. Generamos una copia de Item para trabajar sobre ella
@@ -901,7 +901,7 @@ def findvideos(item):
except:
pass
if not torrent_data and not ('location' in torrent_data.headers or 'zip' in torrent_data.headers['content-type']):
if not torrent_data and not ('location' in torrent_data.headers or 'zip' in torrent_data.headers):
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
@@ -1003,7 +1003,7 @@ def findvideos(item):
if config.get_setting('filter_languages', channel) > 0 and len(itemlist_t) > 0: #Si no hay entradas filtradas ...
thumb_separador = get_thumb("next.png") #... pintamos todo con aviso
itemlist.append(Item(channel=item.channel, url=host, title="[COLOR red][B]NO hay elementos con el idioma seleccionado[/B][/COLOR]", thumbnail=thumb_separador))
itemlist.extend(itemlist_t) #Pintar pantalla con todo si no hay filtrado
itemlist.extend(itemlist_t) #Pintar pantalla con todo si no hay filtrado
# Requerido para AutoPlay
autoplay.start(itemlist, item) #Lanzamos Autoplay

View File

@@ -82,6 +82,13 @@ __modo_grafico__ = config.get_setting('modo_grafico', channel_py)
modo_ultima_temp = config.get_setting('seleccionar_ult_temporadda_activa', channel_py) #Actualización sólo últ. Temporada?
timeout = config.get_setting('clonenewpct1_timeout_downloadpage', channel_py) #Timeout downloadpage
if timeout == 0: timeout = None
try:
from core import proxytools
if proxytools.channel_proxy_list(host): #Si usa un proxy, ...
timeout = timeout * 2 #Duplicamos en timeout
except:
pass
fecha_rango = config.get_setting('clonenewpct1_rango_fechas_novedades', channel_py) #Rango fechas para Novedades
if fecha_rango == 0: fecha_rango = 'Hoy'
elif fecha_rango == 1: fecha_rango = 'Ayer'
@@ -173,7 +180,7 @@ def submenu(item):
except:
pass
patron = '<li><a\s*class="[^"]+"\s*href="http.*:[^"]+"><i\s*class=.*><\/i>.*Inicio<\/a><\/li>(.+)<\/ul>\s*<\/nav>'
patron = '<li><a\s*class="[^"]+"\s*href="[^"]+"><i\s*class="[^"]+".*?><\/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
@@ -183,9 +190,12 @@ def submenu(item):
itemlist.append(item.clone(action='', title="[COLOR yellow]" + clone_inter.capitalize() + ': [/COLOR]' + intervenido_judicial + '. Reportar el problema en el foro', thumbnail=thumb_intervenido))
return itemlist #Salimos
logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url + data)
try:
logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data)
except:
logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: (probablemente bloqueada por antivirus)")
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú
item, data = generictools.fail_over_newpct1(item, patron)
item, data = generictools.fail_over_newpct1(item, patron, timeout=timeout)
if not data: #Si no ha logrado encontrar nada, salimos
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.category + '[/COLOR]: Ningún canal NewPct1 activo'))
@@ -203,9 +213,12 @@ def submenu(item):
if "pelisyseries.com" in item.channel_host and item.extra == "varios": #compatibilidad con mispelisy.series.com
data = '<li><a href="' + item.channel_host + 'varios/" title="Documentales">Documentales</a></li>'
else:
data_menu = scrapertools.get_match(data, patron) #Seleccionamos el trozo que nos interesa
data_menu = scrapertools.find_single_match(data, patron) #Seleccionamos el trozo que nos interesa
if not data_menu:
logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
try:
logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
except:
logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: (probablemente bloqueada por antivirus)")
itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: SUBMENU: Ha cambiado la estructura de la Web. Reportar el error con el log'))
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
@@ -302,7 +315,7 @@ def submenu_novedades(item):
logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url + data)
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú
item, data = generictools.fail_over_newpct1(item, patron)
item, data = generictools.fail_over_newpct1(item, patron, timeout=timeout)
if not data: #Si no ha logrado encontrar nada, salimos
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.category + '[/COLOR]: Ningún canal NewPct1 activo'))
@@ -315,7 +328,7 @@ def submenu_novedades(item):
if item.url_alt: del item.url_alt
del item.channel_alt
data = scrapertools.get_match(data, patron) #Seleccionamos el trozo que nos interesa
data = scrapertools.find_single_match(data, patron) #Seleccionamos el trozo que nos interesa
data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8")
data = data.replace("'", '"').replace('/series"', '/series/"') #Compatibilidad con mispelisy.series.com
@@ -392,7 +405,7 @@ def alfabeto(item):
logger.error("ERROR 01: ALFABETO: La Web no responde o ha cambiado de URL: " + item.url + data)
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú
item, data = generictools.fail_over_newpct1(item, patron)
item, data = generictools.fail_over_newpct1(item, patron, timeout=timeout)
if not data: #Si no ha logrado encontrar nada, salimos
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.category + '[/COLOR]: Ningún canal NewPct1 activo'))
@@ -405,7 +418,7 @@ def alfabeto(item):
if item.url_alt: del item.url_alt
del item.channel_alt
data = scrapertools.get_match(data, patron)
data = scrapertools.find_single_match(data, patron)
patron = '<a href="([^"]+)"[^>]+>([^>]+)</a>'
@@ -454,7 +467,7 @@ def listado(item):
logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data)
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú
item, data = generictools.fail_over_newpct1(item, patron)
item, data = generictools.fail_over_newpct1(item, patron, timeout=timeout)
if not data: #Si no ha logrado encontrar nada, salimos
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo'))
@@ -479,7 +492,7 @@ def listado(item):
#Selecciona el tramo de la página con el listado de contenidos
patron = '<ul class="' + clase + '">(.*?)</ul>'
if data:
fichas = scrapertools.get_match(data, patron)
fichas = scrapertools.find_single_match(data, patron)
if not fichas and not '<h3><strong>( 0 ) Resultados encontrados </strong>' in data: #error
logger.error("ERROR 02: LISTADO: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: LISTADO: Ha cambiado la estructura de la Web. Reportar el error con el log'))
@@ -659,7 +672,7 @@ def listado(item):
title = title.replace("Ver online Serie", "").replace("Ver online ", "").replace("Descarga Serie HD ", "").replace("Descargar Serie HD ", "").replace("Descarga Serie ", "").replace("Descargar Serie ", "").replace("Ver en linea ", "").replace("Ver en linea", "").replace("en Full HD", "").replace("en hd ", "").replace("en HD ", "").replace("MicroHD", "").replace("HD ", "").replace("(Proper)", "").replace("HDTV", "").replace("RatDVD", "").replace("DVDRiP", "").replace("DVDRIP", "").replace("DVDRip", "").replace("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVBRIP", "").replace("DVB", "").replace("LINE", "").replace("calidad", " ").replace("- ES ", "").replace("ES ", "").replace("COMPLETA", "").replace("Serie Animada", " ").replace("(", "-").replace(")", "-").replace(".", " ").strip()
title = title.replace("Descargar torrent ", "").replace("Descarga Gratis", "").replace("Descarga gratis", "").replace("Descargar Gratis", "").replace("Descargar gratis", "").replace("en gratis", "").replace("gratis gratis", "").replace("Gratisgratis", "").replace("Descargar Estreno ", "").replace("Descargar Estrenos ", "").replace("Pelicula en latino ", "").replace("Descargar Pelicula ", "").replace("Descargar pelicula ", "").replace("Descargar Peliculas ", "").replace("Descargar peliculas ", "").replace("Descargar Todas ", "").replace("Descargar Otras ", "").replace("Descargar ", "").replace("Descarga ", "").replace("Descargar ", "").replace("Decargar ", "").replace("Bajar ", "").replace("HDRIP ", "").replace("HDRiP ", "").replace("HDRip ", "").replace("RIP ", "").replace("Rip", "").replace("RiP", "").replace("XviD", "").replace("AC3 5.1", "").replace("AC3", "").replace("1080p ", "").replace("720p ", "").replace("DVD-Screener ", "").replace("TS-Screener ", "").replace("Screener ", "").replace("BdRemux ", "").replace("BR ", "").replace("4K UHDrip", "").replace("BDremux", "").replace("FULL UHD4K", "").replace("4KULTRA", "").replace("FULLBluRay", "").replace("FullBluRay", "").replace("en BluRay", "").replace("BluRay en", "").replace("Bluray en", "").replace("BluRay", "").replace("Bonus Disc", "").replace("de Cine ", "").replace("TeleCine ", "").replace("latino", "").replace("Latino", "").replace("argentina", "").replace("Argentina", "").replace("++Sub", "").replace("+-+Sub", "").strip()
title = title.replace("Descargar torrent ", "").replace("Descarga Gratis", "").replace("Descarga gratis", "").replace("Descargar Gratis", "").replace("Descargar gratis", "").replace("en gratis", "").replace("gratis gratis", "").replace("Gratisgratis", "").replace("Descargar Estreno ", "").replace("Descargar Estrenos ", "").replace("Pelicula en latino ", "").replace("Descargar Pelicula ", "").replace("Descargar pelicula ", "").replace("Descargar Peliculas ", "").replace("Descargar peliculas ", "").replace("Descargar Todas ", "").replace("Descargar Otras ", "").replace("Descargar ", "").replace("Descarga ", "").replace("Descargar ", "").replace("Decargar ", "").replace("Bajar ", "").replace("HDRIP ", "").replace("HDRiP ", "").replace("HDRip ", "").replace("RIP ", "").replace("Rip", "").replace("RiP", "").replace("XviD", "").replace("AC3 5.1", "").replace("AC3", "").replace("1080p ", "").replace("720p ", "").replace("DVD-Screener ", "").replace("TS-Screener ", "").replace("Screener ", "").replace("BdRemux ", "").replace("BR ", "").replace("4K UHDrip", "").replace("BDremux", "").replace("FULL UHD4K", "").replace("4KULTRA", "").replace("FULLBluRay", "").replace("FullBluRay", "").replace("en BluRay", "").replace("BluRay en", "").replace("Bluray en", "").replace("BluRay", "").replace("Bonus Disc", "").replace("de Cine ", "").replace("TeleCine ", "").replace("latino", "").replace("Latino", "").replace("argentina", "").replace("Argentina", "").replace("++Sub", "").replace("+-+Sub", "").replace("Directors Cut", "").strip()
title = re.sub(r'\(\d{4}\)$', '', title)
if re.sub(r'\d{4}$', '', title).strip():
@@ -815,7 +828,7 @@ def listado_busqueda(item):
logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + item.post + " / DATA: " + data)
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú
item, data = generictools.fail_over_newpct1(item, pattern)
item, data = generictools.fail_over_newpct1(item, pattern, timeout=timeout_search)
if not data: #Si no ha logrado encontrar nada, salimos
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo'))
@@ -855,7 +868,7 @@ def listado_busqueda(item):
else:
pattern = '<ul class="%s">(.*?)</ul>' % item.pattern
data_alt = data
data = scrapertools.get_match(data, pattern)
data = scrapertools.find_single_match(data, pattern)
if item.extra == "novedades":
pattern = '<a href="(?P<scrapedurl>[^"]+)"\s?' #url
pattern += 'title="(?P<scrapedtitle>[^"]+)"[^>]*>' #título
@@ -997,7 +1010,7 @@ def listado_busqueda(item):
if item_local.category == 'Mispelisyseries': #Esta web no gestiona bien el cambio de episodio a Serie
pattern = 'class="btn-torrent">.*?window.location.href = "([^"]+)";' #Patron para .torrent
#Como no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el cambio de episodio por serie
item_local, data_serie = generictools.fail_over_newpct1(item_local, pattern)
item_local, data_serie = generictools.fail_over_newpct1(item_local, pattern, timeout=timeout_search)
else:
try:
data_serie = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item_local.url, timeout=timeout).data)
@@ -1008,7 +1021,7 @@ def listado_busqueda(item):
if not data_serie or (not scrapertools.find_single_match(data_serie, pattern) and not '<h3><strong>( 0 ) Resultados encontrados </strong>' in data and not '<ul class="noticias-series"></ul></form></div><!-- end .page-box -->' in data):
logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item_local.url + " / DATA: " + data_serie)
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el cambio de episodio por serie
item_local, data_serie = generictools.fail_over_newpct1(item_local, pattern)
item_local, data_serie = generictools.fail_over_newpct1(item_local, pattern, timeout=timeout)
if not data_serie: #Si no ha logrado encontrar nada, salimos
title_subs += ["ERR"]
@@ -1147,7 +1160,7 @@ def listado_busqueda(item):
title = title.replace("Ver online Serie", "").replace("Ver online ", "").replace("Descarga Serie HD ", "").replace("Descargar Serie HD ", "").replace("Descarga Serie ", "").replace("Descargar Serie ", "").replace("Ver en linea ", "").replace("Ver en linea", "").replace("en Full HD", "").replace("en hd ", "").replace("en HD ", "").replace("MicroHD", "").replace("HD ", "").replace("(Proper)", "").replace("HDTV", "").replace("RatDVD", "").replace("DVDRiP", "").replace("DVDRIP", "").replace("DVDRip", "").replace("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVBRIP", "").replace("DVB", "").replace("LINE", "").replace("calidad", " ").replace("- ES ", "").replace("ES ", "").replace("COMPLETA", "").replace("Serie Animada", " ").replace("(", "-").replace(")", "-").replace(".", " ").strip()
title = title.replace("Descargar torrent ", "").replace("Descarga Gratis", "").replace("Descarga gratis", "").replace("Descargar Gratis", "").replace("Descargar gratis", "").replace("en gratis", "").replace("gratis gratis", "").replace("Gratisgratis", "").replace("Descargar Estreno ", "").replace("Descargar Estrenos ", "").replace("Pelicula en latino ", "").replace("Descargar Pelicula ", "").replace("Descargar pelicula ", "").replace("Descargar Peliculas ", "").replace("Descargar peliculas ", "").replace("Descargar Todas ", "").replace("Descargar Otras ", "").replace("Descargar ", "").replace("Descarga ", "").replace("Descargar ", "").replace("Decargar ", "").replace("Bajar ", "").replace("HDRIP ", "").replace("HDRiP ", "").replace("HDRip ", "").replace("RIP ", "").replace("Rip", "").replace("RiP", "").replace("XviD", "").replace("AC3 5.1", "").replace("AC3", "").replace("1080p ", "").replace("720p ", "").replace("DVD-Screener ", "").replace("TS-Screener ", "").replace("Screener ", "").replace("BdRemux ", "").replace("BR ", "").replace("4K UHDrip", "").replace("BDremux", "").replace("FULL UHD4K", "").replace("4KULTRA", "").replace("FULLBluRay", "").replace("FullBluRay", "").replace("en BluRay", "").replace("BluRay en", "").replace("Bluray en", "").replace("BluRay", "").replace("Bonus Disc", "").replace("de Cine ", "").replace("TeleCine ", "").replace("latino", "").replace("Latino", "").replace("argentina", "").replace("Argentina", "").replace("++Sub", "").replace("+-+Sub", "").strip()
title = title.replace("Descargar torrent ", "").replace("Descarga Gratis", "").replace("Descarga gratis", "").replace("Descargar Gratis", "").replace("Descargar gratis", "").replace("en gratis", "").replace("gratis gratis", "").replace("Gratisgratis", "").replace("Descargar Estreno ", "").replace("Descargar Estrenos ", "").replace("Pelicula en latino ", "").replace("Descargar Pelicula ", "").replace("Descargar pelicula ", "").replace("Descargar Peliculas ", "").replace("Descargar peliculas ", "").replace("Descargar Todas ", "").replace("Descargar Otras ", "").replace("Descargar ", "").replace("Descarga ", "").replace("Descargar ", "").replace("Decargar ", "").replace("Bajar ", "").replace("HDRIP ", "").replace("HDRiP ", "").replace("HDRip ", "").replace("RIP ", "").replace("Rip", "").replace("RiP", "").replace("XviD", "").replace("AC3 5.1", "").replace("AC3", "").replace("1080p ", "").replace("720p ", "").replace("DVD-Screener ", "").replace("TS-Screener ", "").replace("Screener ", "").replace("BdRemux ", "").replace("BR ", "").replace("4K UHDrip", "").replace("BDremux", "").replace("FULL UHD4K", "").replace("4KULTRA", "").replace("FULLBluRay", "").replace("FullBluRay", "").replace("en BluRay", "").replace("BluRay en", "").replace("Bluray en", "").replace("BluRay", "").replace("Bonus Disc", "").replace("de Cine ", "").replace("TeleCine ", "").replace("latino", "").replace("Latino", "").replace("argentina", "").replace("Argentina", "").replace("++Sub", "").replace("+-+Sub", "").replace("Directors Cut", "").strip()
title = re.sub(r'\(\d{4}\)$', '', title)
if re.sub(r'\d{4}$', '', title).strip():
@@ -1329,7 +1342,7 @@ def findvideos(item):
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
verify_fo = True #Verificamos si el clone a usar está activo
item, data = generictools.fail_over_newpct1(item, verify_fo)
item, data = generictools.fail_over_newpct1(item, verify_fo, timeout=timeout)
# Cualquiera de las tres opciones son válidas
# item.url = item.url.replace(".com/",".com/ver-online/")
@@ -1450,7 +1463,7 @@ def findvideos(item):
except: #La web no responde. Probemos las urls de emergencia
pass
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";' #Patron para .torrent
patron = 'class="btn-torrent">.*?window.location.href = (?:parseURL\()?"(.*?)"\)?;' #Patron para .torrent
patron_mult = 'torrent:check:status|' + patron + '|<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"'
if not scrapertools.find_single_match(data, patron):
patron_alt = '<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"' #Patron para .torrent (planetatorrent)
@@ -1461,7 +1474,7 @@ def findvideos(item):
url_torr = scrapertools.find_single_match(item.channel_host, '(\w+:)//') + url_torr
#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(url_torr): # Si no hay datos o url, error
if not data or not scrapertools.find_single_match(data, patron) or not videolibrarytools.verify_url_torrent(url_torr, timeout=timeout): # 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
@@ -1479,7 +1492,7 @@ def findvideos(item):
data = 'xyz123' #Para que no haga más preguntas
else:
#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)
item, data = generictools.fail_over_newpct1(item, patron_mult, timeout=timeout)
if not data: #Si no ha logrado encontrar nada, verificamos si hay servidores
cnt_servidores = 0
@@ -1500,7 +1513,7 @@ def findvideos(item):
cnt_servidores += 1
if cnt_servidores == 0:
item, data_servidores = generictools.fail_over_newpct1(item, patron) #intentamos recuperar servidores
item, data_servidores = generictools.fail_over_newpct1(item, patron, timeout=timeout) #intentamos recuperar servidores
#Miramos si ha servidores
if not data_servidores: #Si no ha logrado encontrar nada nos vamos
@@ -1518,7 +1531,7 @@ def findvideos(item):
data = data.replace("$!", "#!").replace("'", "\"").replace("ñ", "ñ").replace("//pictures", "/pictures")
# patrón para la url torrent
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";' #Patron para .torrent
patron = 'class="btn-torrent">.*?window.location.href = (?:parseURL\()?"(.*?)"\)?;' #Patron para .torrent
if not scrapertools.find_single_match(data, patron):
patron = '<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"' #Patron para .torrent (planetatorrent)
url_torr = scrapertools.find_single_match(data, patron)
@@ -1533,7 +1546,7 @@ def findvideos(item):
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 and not item.videolibray_emergency_urls:
size = generictools.get_torrent_size(url_torr) #Buscamos el tamaño en el .torrent
size = generictools.get_torrent_size(url_torr, timeout=timeout) #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
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
@@ -1877,7 +1890,7 @@ def episodios(item):
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
verify_fo = True #Verificamos si el clone a usar está activo
item, data = generictools.fail_over_newpct1(item, verify_fo)
item, data = generictools.fail_over_newpct1(item, verify_fo, timeout=timeout)
#Limpiamos num. Temporada y Episodio que ha podido quedar por Novedades
season_display = 0
@@ -1931,7 +1944,7 @@ def episodios(item):
patron = '<ul class="%s">(.*?)</ul>' % "buscar-list" # item.pattern
data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url, timeout=timeout).data)
if data: data_alt = scrapertools.get_match(data, patron)
if data: data_alt = scrapertools.find_single_match(data, patron)
except: #Algún error de proceso
pass
@@ -1951,7 +1964,7 @@ def episodios(item):
logger.error(pattern + data)
#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, pattern)
item, data = generictools.fail_over_newpct1(item, patron, pattern, timeout=timeout)
if not data: #No se ha encontrado ningún canal activo para este vídeo
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo'))
@@ -1997,7 +2010,7 @@ def episodios(item):
data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8")
data = data.replace("chapters", "buscar-list") #Compatibilidad con mispelisy.series.com
pattern = '<ul class="%s">(.*?)</ul>' % "buscar-list" # item.pattern
data_sector = scrapertools.get_match(data, pattern)
data_sector = scrapertools.find_single_match(data, pattern)
if not data_sector:
raise
data = data_sector

View File

@@ -135,7 +135,7 @@ def categorias(item):
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
data = scrapertools.find_single_match(data, patron)
patron = '<li><a href="genero/([^"]+)">(.*?)<'
patron = '<li><a href="\/?genero\/([^"]+)">(.*?)<\/a><\/li>'
matches = re.compile(patron, re.DOTALL).findall(data)
if not matches:

View File

@@ -99,7 +99,7 @@ load_cookies()
def downloadpage(url, post=None, headers=None, timeout=None, follow_redirects=True, cookies=True, replace_headers=False,
add_referer=False, only_headers=False, bypass_cloudflare=True, count_retries=0, random_headers=False, ignore_response_code=False, alfa_s=False):
add_referer=False, only_headers=False, bypass_cloudflare=True, count_retries=0, count_retries_tot=5, random_headers=False, ignore_response_code=False, alfa_s=False, proxy=True, proxy_web=False, forced_proxy=None, proxy_retries=1):
"""
Abre una url y retorna los datos obtenidos
@@ -160,169 +160,263 @@ def downloadpage(url, post=None, headers=None, timeout=None, follow_redirects=Tr
url = urllib.quote(url, safe="%/:=&?~#+!$,;'@()*[]")
# Limitar tiempo de descarga si no se ha pasado timeout y hay un valor establecido en la variable global
if timeout is None and HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT is not None: timeout = HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT
if timeout == 0: timeout = None
#Si la descarga requiere que se haga a través de un servicio Proxy o ProxyWeb, se prepara la url
proxy_retries_counter = 0
url_save = url
post_save = post
while proxy_retries_counter <= proxy_retries:
# Handlers init
handlers = [urllib2.HTTPHandler(debuglevel=False)]
proxy_retries_counter += 1
proxy_stat = ''
proxy_addr = ''
proxy_CF_addr = ''
proxy_web_name = ''
proxy_log = ''
import proxytools
try:
if (proxy or proxy_web) and (forced_proxy or proxytools.channel_proxy_list(url, forced_proxy=forced_proxy)):
proxy_addr, proxy_CF_addr, proxy_web_name, proxy_log = proxytools.get_proxy_addr(url, post=post, forced_proxy=forced_proxy)
if proxy and proxy_addr:
handlers.append(urllib2.ProxyHandler(proxy_addr))
proxy_stat = ', Proxy Direct ' + proxy_log
elif proxy and proxy_CF_addr:
handlers.append(urllib2.ProxyHandler(proxy_CF_addr))
proxy_stat = ', Proxy CF ' + proxy_log
elif proxy and not proxy_addr and not proxy_CF_addr:
proxy = False
if not proxy_web_name:
proxy_addr, proxy_CF_addr, proxy_web_name, proxy_log = proxytools.get_proxy_addr(url, forced_proxy='Total')
if proxy_web_name:
proxy_web = True
else:
proxy_web = False
if proxy_addr:
proxy = True
handlers.append(urllib2.ProxyHandler(proxy_addr))
proxy_stat = ', Proxy Direct ' + proxy_log
if not alfa_s:
logger.info("----------------------------------------------")
logger.info("downloadpage Alfa: %s" %__version)
logger.info("----------------------------------------------")
logger.info("Timeout: %s" % timeout)
logger.info("URL: " + url)
logger.info("Dominio: " + urlparse.urlparse(url)[1])
if post:
logger.info("Peticion: POST")
else:
logger.info("Peticion: GET")
logger.info("Usar Cookies: %s" % cookies)
logger.info("Descargar Pagina: %s" % (not only_headers))
logger.info("Fichero de Cookies: " + ficherocookies)
if proxy_web and proxy_web_name:
if post: proxy_log = '(POST) ' + proxy_log
url, post, headers_proxy, proxy_web_name = proxytools.set_proxy_web(url, proxy_web_name, post=post)
if proxy_web_name:
proxy_stat = ', Proxy Web ' + proxy_log
if headers_proxy:
request_headers.update(dict(headers_proxy))
if proxy_web and not proxy_web_name:
proxy_web = False
proxy_addr, proxy_CF_addr, proxy_web_name, proxy_log = proxytools.get_proxy_addr(url, forced_proxy='Total')
if proxy_CF_addr:
proxy = True
handlers.append(urllib2.ProxyHandler(proxy_CF_addr))
proxy_stat = ', Proxy CF ' + proxy_log
elif proxy_addr:
proxy = True
handlers.append(urllib2.ProxyHandler(proxy_addr))
proxy_stat = ', Proxy Direct ' + proxy_log
except:
import traceback
logger.error(traceback.format_exc())
proxy = ''
proxy_web = ''
proxy_stat = ''
proxy_addr = ''
proxy_CF_addr = ''
proxy_web_name = ''
proxy_log = ''
url = url_save
# Limitar tiempo de descarga si no se ha pasado timeout y hay un valor establecido en la variable global
if timeout is None and HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT is not None: timeout = HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT
if timeout == 0: timeout = None
if not alfa_s:
logger.info("----------------------------------------------")
logger.info("downloadpage Alfa: %s" %__version)
logger.info("----------------------------------------------")
logger.info("Timeout: %s" % timeout)
logger.info("URL: " + url)
logger.info("Dominio: " + urlparse.urlparse(url)[1])
if post:
logger.info("Peticion: POST" + proxy_stat)
else:
logger.info("Peticion: GET" + proxy_stat)
logger.info("Usar Cookies: %s" % cookies)
logger.info("Descargar Pagina: %s" % (not only_headers))
logger.info("Fichero de Cookies: " + ficherocookies)
logger.info("Headers:")
for header in request_headers:
logger.info("- %s: %s" % (header, request_headers[header]))
# Handlers
handlers = [urllib2.HTTPHandler(debuglevel=False)]
# Handlers
if not follow_redirects:
handlers.append(NoRedirectHandler())
if not follow_redirects:
handlers.append(NoRedirectHandler())
if cookies:
handlers.append(urllib2.HTTPCookieProcessor(cj))
if cookies:
handlers.append(urllib2.HTTPCookieProcessor(cj))
opener = urllib2.build_opener(*handlers)
opener = urllib2.build_opener(*handlers)
if not alfa_s:
logger.info("Realizando Peticion")
# Contador
inicio = time.time()
req = urllib2.Request(url, post, request_headers)
try:
if urllib2.__version__ == "2.4":
import socket
deftimeout = socket.getdefaulttimeout()
if timeout is not None:
socket.setdefaulttimeout(timeout)
handle = opener.open(req)
socket.setdefaulttimeout(deftimeout)
else:
handle = opener.open(req, timeout=timeout)
except urllib2.HTTPError, handle:
response["sucess"] = False
response["code"] = handle.code
response["error"] = handle.__dict__.get("reason", str(handle))
response["headers"] = handle.headers.dict
if not only_headers:
response["data"] = handle.read()
else:
response["data"] = ""
response["time"] = time.time() - inicio
response["url"] = handle.geturl()
except Exception, e:
response["sucess"] = False
response["code"] = e.__dict__.get("errno", e.__dict__.get("code", str(e)))
response["error"] = e.__dict__.get("reason", str(e))
response["headers"] = {}
response["data"] = ""
response["time"] = time.time() - inicio
response["url"] = url
else:
response["sucess"] = True
response["code"] = handle.code
response["error"] = None
response["headers"] = handle.headers.dict
if not only_headers:
response["data"] = handle.read()
else:
response["data"] = ""
response["time"] = time.time() - inicio
response["url"] = handle.geturl()
if not alfa_s:
logger.info("Terminado en %.2f segundos" % (response["time"]))
logger.info("Response sucess: %s" % (response["sucess"]))
logger.info("Response code: %s" % (response["code"]))
logger.info("Response error: %s" % (response["error"]))
logger.info("Response data length: %s" % (len(response["data"])))
logger.info("Response headers:")
server_cloudflare = ""
for header in response["headers"]:
if not alfa_s:
logger.info("- %s: %s" % (header, response["headers"][header]))
if "cloudflare" in response["headers"][header]:
server_cloudflare = "cloudflare"
logger.info("Realizando Peticion")
is_channel = inspect.getmodule(inspect.currentframe().f_back)
# error 4xx o 5xx se lanza excepcion (menos para servidores)
# response["code"] = 400 # linea de código para probar
is_channel = str(is_channel).replace("/servers/","\\servers\\") # Para sistemas operativos diferente a Windows la ruta cambia
if type(response["code"]) == int and "\\servers\\" not in str(is_channel) and not ignore_response_code:
if response["code"] > 399 and (server_cloudflare == "cloudflare" and response["code"] != 503):
raise WebErrorException(urlparse.urlparse(url)[1])
# Contador
inicio = time.time()
if cookies:
save_cookies()
req = urllib2.Request(url, post, request_headers)
if not alfa_s:
logger.info("Encoding: %s" % (response["headers"].get('content-encoding')))
if response["headers"].get('content-encoding') == 'gzip':
if not alfa_s:
logger.info("Descomprimiendo...")
data_alt = response["data"]
try:
response["data"] = gzip.GzipFile(fileobj=StringIO(response["data"])).read()
if urllib2.__version__ == "2.4":
import socket
deftimeout = socket.getdefaulttimeout()
if timeout is not None:
socket.setdefaulttimeout(timeout)
handle = opener.open(req)
socket.setdefaulttimeout(deftimeout)
else:
handle = opener.open(req, timeout=timeout)
except urllib2.HTTPError, handle:
response["sucess"] = False
response["code"] = handle.code
response["error"] = handle.__dict__.get("reason", str(handle))
response["headers"] = handle.headers.dict
if not only_headers:
response["data"] = handle.read()
else:
response["data"] = ""
response["time"] = time.time() - inicio
response["url"] = handle.geturl()
except Exception, e:
response["sucess"] = False
response["code"] = e.__dict__.get("errno", e.__dict__.get("code", str(e)))
response["error"] = e.__dict__.get("reason", str(e))
response["headers"] = {}
response["data"] = ""
response["time"] = time.time() - inicio
response["url"] = url
else:
response["sucess"] = True
response["code"] = handle.code
response["error"] = None
response["headers"] = handle.headers.dict
if not only_headers:
response["data"] = handle.read()
else:
response["data"] = ""
response["time"] = time.time() - inicio
response["url"] = handle.geturl()
if not alfa_s:
logger.info("Terminado en %.2f segundos" % (response["time"]))
logger.info("Response sucess: %s" % (response["sucess"]))
logger.info("Response code: %s" % (response["code"]))
logger.info("Response error: %s" % (response["error"]))
logger.info("Response data length: %s" % (len(response["data"])))
logger.info("Response headers:")
server_cloudflare = ""
for header in response["headers"]:
if not alfa_s:
logger.info("Descomprimido")
except:
logger.info("- %s: %s" % (header, response["headers"][header]))
if "cloudflare" in response["headers"][header]:
server_cloudflare = "cloudflare"
is_channel = inspect.getmodule(inspect.currentframe().f_back)
# error 4xx o 5xx se lanza excepcion (menos para servidores)
# response["code"] = 400 # linea de código para probar
is_channel = str(is_channel).replace("/servers/","\\servers\\") # Para sistemas operativos diferente a Windows la ruta cambia
if type(response["code"]) == int and "\\servers\\" not in str(is_channel) and not ignore_response_code and not proxy_stat:
if response["code"] > 399 and (server_cloudflare == "cloudflare" and response["code"] != 503):
raise WebErrorException(urlparse.urlparse(url)[1])
if cookies:
save_cookies()
if not alfa_s:
logger.info("Encoding: %s" % (response["headers"].get('content-encoding')))
if response["headers"].get('content-encoding') == 'gzip':
if not alfa_s:
logger.info("No se ha podido descomprimir con gzip. Intentando con zlib")
response["data"] = data_alt
logger.info("Descomprimiendo...")
data_alt = response["data"]
try:
import zlib
response["data"] = zlib.decompressobj(16 + zlib.MAX_WBITS).decompress(response["data"])
response["data"] = gzip.GzipFile(fileobj=StringIO(response["data"])).read()
if not alfa_s:
logger.info("Descomprimido")
except:
if not alfa_s:
logger.info("No se ha podido descomprimir con zlib")
logger.info("No se ha podido descomprimir con gzip. Intentando con zlib")
response["data"] = data_alt
try:
import zlib
response["data"] = zlib.decompressobj(16 + zlib.MAX_WBITS).decompress(response["data"])
except:
if not alfa_s:
logger.info("No se ha podido descomprimir con zlib")
response["data"] = data_alt
# Anti Cloudflare
if bypass_cloudflare and count_retries < 5:
cf = Cloudflare(response)
if cf.is_cloudflare:
count_retries += 1
if not alfa_s:
logger.info("cloudflare detectado, esperando %s segundos..." % cf.wait_time)
auth_url = cf.get_url()
if not alfa_s:
logger.info("Autorizando... intento %d url: %s" % (count_retries, auth_url))
if downloadpage(auth_url, headers=request_headers, replace_headers=True, count_retries=count_retries).sucess:
# Anti Cloudflare
if bypass_cloudflare and count_retries < count_retries_tot:
cf = Cloudflare(response)
if cf.is_cloudflare:
count_retries += 1
if not alfa_s:
logger.info("Autorización correcta, descargando página")
resp = downloadpage(url=response["url"], post=post, headers=headers, timeout=timeout,
follow_redirects=follow_redirects,
cookies=cookies, replace_headers=replace_headers, add_referer=add_referer)
response["sucess"] = resp.sucess
response["code"] = resp.code
response["error"] = resp.error
response["headers"] = resp.headers
response["data"] = resp.data
response["time"] = resp.time
response["url"] = resp.url
logger.info("cloudflare detectado, esperando %s segundos..." % cf.wait_time)
auth_url = cf.get_url()
if not alfa_s:
logger.info("Autorizando... intento %d url: %s" % (count_retries, auth_url))
tt = downloadpage(auth_url, headers=request_headers, replace_headers=True, count_retries=count_retries, ignore_response_code=True, count_retries_tot=count_retries_tot, proxy=proxy, proxy_web=proxy_web)
if tt.code == 403:
tt = downloadpage(url, headers=request_headers, replace_headers=True, count_retries=count_retries, ignore_response_code=True, count_retries_tot=count_retries_tot, proxy=proxy, proxy_web=proxy_web)
if tt.sucess:
if not alfa_s:
logger.info("Autorización correcta, descargando página")
resp = downloadpage(url=response["url"], post=post, headers=headers, timeout=timeout,
follow_redirects=follow_redirects, count_retries=count_retries,
cookies=cookies, replace_headers=replace_headers, add_referer=add_referer, proxy=proxy, proxy_web=proxy_web, count_retries_tot=count_retries_tot)
response["sucess"] = resp.sucess
response["code"] = resp.code
response["error"] = resp.error
response["headers"] = resp.headers
response["data"] = resp.data
response["time"] = resp.time
response["url"] = resp.url
else:
if not alfa_s:
logger.info("No se ha podido autorizar")
# Si hay errores usando un Proxy, se refrescan el Proxy y se reintenta el número de veces indicado en proxy_retries
try:
if ', Proxy Web' in proxy_stat:
response["data"] = proxytools.restore_after_proxy_web(response["data"], proxy_web_name, url_save)
if response["data"] == 'ERROR':
response['sucess'] = False
if proxy_stat and response['sucess'] == False and proxy_retries_counter <= proxy_retries and count_retries_tot > 1:
if ', Proxy Direct' in proxy_stat:
proxytools.get_proxy_list_method(proxy_init='ProxyDirect')
elif ', Proxy CF' in proxy_stat:
proxytools.get_proxy_list_method(proxy_init='ProxyCF')
url = url_save
elif ', Proxy Web' in proxy_stat:
proxytools.get_proxy_list_method(proxy_init='ProxyWeb')
url = url_save
post = post_save
else:
if not alfa_s:
logger.info("No se ha podido autorizar")
break
except:
import traceback
logger.error(traceback.format_exc())
break
return type('HTTPResponse', (), response)
def random_useragent():
"""
Based on code from https://github.com/theriley106/RandomHeaders

File diff suppressed because one or more lines are too long

View File

@@ -29,8 +29,8 @@ from lib import jsunpack
channel_py = "newpct1"
intervenido_judicial = 'Dominio intervenido por la Autoridad Judicial'
intervenido_policia = '<!--CATEGORY:Judicial_Policia_Nacional'
intervenido_guardia = '<!--CATEGORY:Judicial_Guardia_Civil'
intervenido_policia = 'Judicial_Policia_Nacional'
intervenido_guardia = 'Judicial_Guardia_Civil'
intervenido_sucuri = 'Access Denied - Sucuri Website Firewall'
@@ -1222,7 +1222,7 @@ def post_tmdb_findvideos(item, itemlist):
return (item, itemlist)
def get_torrent_size(url, referer=None, post=None, data_torrent=False):
def get_torrent_size(url, referer=None, post=None, data_torrent=False, timeout=5):
logger.info()
from core import videolibrarytools
@@ -1316,7 +1316,7 @@ def get_torrent_size(url, referer=None, post=None, 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, referer=referer, post=post, timeout=2, lookup=True, data_torrent=True)
torrents_path, torrent_file = videolibrarytools.caching_torrents(url, referer=referer, post=post, timeout=timeout, lookup=True, data_torrent=True)
if not torrent_file:
if data_torrent:
return (size, torrent)

View File

@@ -5,14 +5,28 @@
import datetime, imp, math, threading, traceback
from platformcode import config
try:
import xbmc, os
librerias = xbmc.translatePath(os.path.join(config.get_runtime_path(), 'lib'))
sys.path.append(librerias)
except:
import os
librerias = os.path.join(config.get_runtime_path(), 'lib')
sys.path.append(librerias)
from core import channeltools, filetools, videolibrarytools
from platformcode import config, logger
from platformcode import logger
from platformcode import platformtools
from channels import videolibrary
from lib import generictools
def update(path, p_dialog, i, t, serie, overwrite):
logger.info("Actualizando " + path)
insertados_total = 0
@@ -332,11 +346,14 @@ if __name__ == "__main__":
# Verificar quick-fixes al abrirse Kodi, y dejarlo corriendo como Thread
from platformcode import updater
updater.check_addon_init()
# Copia Custom code a las carpetas de Alfa desde la zona de Userdata
from platformcode import custom_code
custom_code.init()
# Identifica la dirección Proxy y la lista de alternativas
from core import proxytools
proxytools.get_proxy_list()
if not config.get_setting("update", "videolibrary") == 2:
check_for_update(overwrite=False)