Actualizaciones

-Correcciones en los idiomas
-gamovideo: Mejora para obtener los enlaces
-thevid: Corrección para obtener los enlaces
This commit is contained in:
Intel1
2019-02-20 14:16:04 -05:00
parent dcf99d1c3d
commit 75baffaf0e
10 changed files with 70 additions and 109 deletions
+47 -34
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, 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): add_referer=False, only_headers=False, bypass_cloudflare=True, count_retries=0, random_headers=False, ignore_response_code=False, alfa_s=False):
""" """
Abre una url y retorna los datos obtenidos Abre una url y retorna los datos obtenidos
@@ -164,22 +164,23 @@ def downloadpage(url, post=None, headers=None, timeout=None, follow_redirects=Tr
if timeout is None and HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT is not None: timeout = HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT if timeout is None and HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT is not None: timeout = HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT
if timeout == 0: timeout = None if timeout == 0: timeout = None
logger.info("----------------------------------------------") if not alfa_s:
logger.info("downloadpage Alfa: %s" %__version) logger.info("----------------------------------------------")
logger.info("----------------------------------------------") logger.info("downloadpage Alfa: %s" %__version)
logger.info("Timeout: %s" % timeout) logger.info("----------------------------------------------")
logger.info("URL: " + url) logger.info("Timeout: %s" % timeout)
logger.info("Dominio: " + urlparse.urlparse(url)[1]) logger.info("URL: " + url)
if post: logger.info("Dominio: " + urlparse.urlparse(url)[1])
logger.info("Peticion: POST") if post:
else: logger.info("Peticion: POST")
logger.info("Peticion: GET") else:
logger.info("Usar Cookies: %s" % cookies) logger.info("Peticion: GET")
logger.info("Descargar Pagina: %s" % (not only_headers)) logger.info("Usar Cookies: %s" % cookies)
logger.info("Fichero de Cookies: " + ficherocookies) logger.info("Descargar Pagina: %s" % (not only_headers))
logger.info("Headers:") logger.info("Fichero de Cookies: " + ficherocookies)
for header in request_headers: logger.info("Headers:")
logger.info("- %s: %s" % (header, request_headers[header])) for header in request_headers:
logger.info("- %s: %s" % (header, request_headers[header]))
# Handlers # Handlers
handlers = [urllib2.HTTPHandler(debuglevel=False)] handlers = [urllib2.HTTPHandler(debuglevel=False)]
@@ -192,7 +193,8 @@ def downloadpage(url, post=None, headers=None, timeout=None, follow_redirects=Tr
opener = urllib2.build_opener(*handlers) opener = urllib2.build_opener(*handlers)
logger.info("Realizando Peticion") if not alfa_s:
logger.info("Realizando Peticion")
# Contador # Contador
inicio = time.time() inicio = time.time()
@@ -243,15 +245,17 @@ def downloadpage(url, post=None, headers=None, timeout=None, follow_redirects=Tr
response["time"] = time.time() - inicio response["time"] = time.time() - inicio
response["url"] = handle.geturl() response["url"] = handle.geturl()
logger.info("Terminado en %.2f segundos" % (response["time"])) if not alfa_s:
logger.info("Response sucess: %s" % (response["sucess"])) logger.info("Terminado en %.2f segundos" % (response["time"]))
logger.info("Response code: %s" % (response["code"])) logger.info("Response sucess: %s" % (response["sucess"]))
logger.info("Response error: %s" % (response["error"])) logger.info("Response code: %s" % (response["code"]))
logger.info("Response data length: %s" % (len(response["data"]))) logger.info("Response error: %s" % (response["error"]))
logger.info("Response headers:") logger.info("Response data length: %s" % (len(response["data"])))
logger.info("Response headers:")
server_cloudflare = "" server_cloudflare = ""
for header in response["headers"]: for header in response["headers"]:
logger.info("- %s: %s" % (header, response["headers"][header])) if not alfa_s:
logger.info("- %s: %s" % (header, response["headers"][header]))
if "cloudflare" in response["headers"][header]: if "cloudflare" in response["headers"][header]:
server_cloudflare = "cloudflare" server_cloudflare = "cloudflare"
@@ -266,22 +270,27 @@ def downloadpage(url, post=None, headers=None, timeout=None, follow_redirects=Tr
if cookies: if cookies:
save_cookies() save_cookies()
logger.info("Encoding: %s" % (response["headers"].get('content-encoding'))) if not alfa_s:
logger.info("Encoding: %s" % (response["headers"].get('content-encoding')))
if response["headers"].get('content-encoding') == 'gzip': if response["headers"].get('content-encoding') == 'gzip':
logger.info("Descomprimiendo...") if not alfa_s:
logger.info("Descomprimiendo...")
data_alt = response["data"] data_alt = response["data"]
try: try:
response["data"] = gzip.GzipFile(fileobj=StringIO(response["data"])).read() response["data"] = gzip.GzipFile(fileobj=StringIO(response["data"])).read()
logger.info("Descomprimido") if not alfa_s:
logger.info("Descomprimido")
except: except:
logger.info("No se ha podido descomprimir con gzip. Intentando con zlib") if not alfa_s:
logger.info("No se ha podido descomprimir con gzip. Intentando con zlib")
response["data"] = data_alt response["data"] = data_alt
try: try:
import zlib import zlib
response["data"] = zlib.decompressobj(16 + zlib.MAX_WBITS).decompress(response["data"]) response["data"] = zlib.decompressobj(16 + zlib.MAX_WBITS).decompress(response["data"])
except: except:
logger.info("No se ha podido descomprimir con zlib") if not alfa_s:
logger.info("No se ha podido descomprimir con zlib")
response["data"] = data_alt response["data"] = data_alt
# Anti Cloudflare # Anti Cloudflare
@@ -289,11 +298,14 @@ def downloadpage(url, post=None, headers=None, timeout=None, follow_redirects=Tr
cf = Cloudflare(response) cf = Cloudflare(response)
if cf.is_cloudflare: if cf.is_cloudflare:
count_retries += 1 count_retries += 1
logger.info("cloudflare detectado, esperando %s segundos..." % cf.wait_time) if not alfa_s:
logger.info("cloudflare detectado, esperando %s segundos..." % cf.wait_time)
auth_url = cf.get_url() auth_url = cf.get_url()
logger.info("Autorizando... intento %d url: %s" % (count_retries, auth_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: if downloadpage(auth_url, headers=request_headers, replace_headers=True, count_retries=count_retries).sucess:
logger.info("Autorización correcta, descargando página") if not alfa_s:
logger.info("Autorización correcta, descargando página")
resp = downloadpage(url=response["url"], post=post, headers=headers, timeout=timeout, resp = downloadpage(url=response["url"], post=post, headers=headers, timeout=timeout,
follow_redirects=follow_redirects, follow_redirects=follow_redirects,
cookies=cookies, replace_headers=replace_headers, add_referer=add_referer) cookies=cookies, replace_headers=replace_headers, add_referer=add_referer)
@@ -305,7 +317,8 @@ def downloadpage(url, post=None, headers=None, timeout=None, follow_redirects=Tr
response["time"] = resp.time response["time"] = resp.time
response["url"] = resp.url response["url"] = resp.url
else: else:
logger.info("No se ha podido autorizar") if not alfa_s:
logger.info("No se ha podido autorizar")
return type('HTTPResponse', (), response) return type('HTTPResponse', (), response)
+1 -1
View File
@@ -151,7 +151,7 @@ def cuadro_completar(item):
'default': mediatype_default, 'default': mediatype_default,
'enabled': True, 'enabled': True,
'visible': True, 'visible': True,
'lvalues': [config.get_localized_string(60244), config.get_localized_string(60245)] 'lvalues': [config.get_localized_string(60244), config.get_localized_string(70136)]
}] }]
for i, c in enumerate(controls): for i, c in enumerate(controls):
+2 -2
View File
@@ -455,7 +455,7 @@ def find_and_set_infoLabels(item):
title = item.contentTitle title = item.contentTitle
else: else:
tipo_busqueda = "tv" tipo_busqueda = "tv"
tipo_contenido = config.get_localized_string(70529) tipo_contenido = config.get_localized_string(60245)
title = item.contentSerieName title = item.contentSerieName
# Si el titulo incluye el (año) se lo quitamos # Si el titulo incluye el (año) se lo quitamos
@@ -478,7 +478,7 @@ def find_and_set_infoLabels(item):
if len(results) > 1: if len(results) > 1:
from platformcode import platformtools from platformcode import platformtools
tmdb_result = platformtools.show_video_info(results, item=item, tmdb_result = platformtools.show_video_info(results, item=item,
caption="[%s]: Selecciona la %s correcta" % (title, tipo_contenido)) caption=config.get_localized_string(60247) %(title, tipo_contenido))
elif len(results) > 0: elif len(results) > 0:
tmdb_result = results[0] tmdb_result = results[0]
@@ -1046,7 +1046,7 @@ msgid "Movie"
msgstr "" msgstr ""
msgctxt "#60245" msgctxt "#60245"
msgid "Series" msgid "tv show"
msgstr "" msgstr ""
msgctxt "#60246" msgctxt "#60246"
@@ -1249,10 +1249,6 @@ msgctxt "#60297"
msgid "Find %s possible matches" msgid "Find %s possible matches"
msgstr "" msgstr ""
msgctxt "#60298"
msgid "[%s]: Select the correct TV series"
msgstr ""
msgctxt "#60299" msgctxt "#60299"
msgid "Not found in the language '%s'" msgid "Not found in the language '%s'"
msgstr "" msgstr ""
@@ -4267,10 +4263,6 @@ msgctxt "#70392"
msgid "Rate with a [COLOR %s]%s[/ COLOR]" msgid "Rate with a [COLOR %s]%s[/ COLOR]"
msgstr "" msgstr ""
msgctxt "#70393"
msgid "[%s]: Select the correct %s "
msgstr ""
msgctxt "#70394" msgctxt "#70394"
msgid "Action" msgid "Action"
msgstr "" msgstr ""
@@ -4811,10 +4803,6 @@ msgctxt "#70528"
msgid "Default folder" msgid "Default folder"
msgstr "" msgstr ""
msgctxt "#70529"
msgid "Repeated link"
msgstr ""
msgctxt "#70530" msgctxt "#70530"
msgid "You already have this link in the folder" msgid "You already have this link in the folder"
msgstr "" msgstr ""
@@ -1034,8 +1034,8 @@ msgid "Movie"
msgstr "Film" msgstr "Film"
msgctxt "#60245" msgctxt "#60245"
msgid "Series" msgid "tv show"
msgstr "Serie" msgstr "serie"
msgctxt "#60246" msgctxt "#60246"
msgid "Full information" msgid "Full information"
@@ -1237,10 +1237,6 @@ msgctxt "#60297"
msgid "Find %s possible matches" msgid "Find %s possible matches"
msgstr "Trovate %s possibili corrispondenze" msgstr "Trovate %s possibili corrispondenze"
msgctxt "#60298"
msgid "[%s]: Select the correct TV series"
msgstr "[%s]: Seleziona la serie corretta"
msgctxt "#60299" msgctxt "#60299"
msgid "Not found in the language '%s'" msgid "Not found in the language '%s'"
msgstr "Non trovato nella lingua '%s'" msgstr "Non trovato nella lingua '%s'"
@@ -4247,10 +4243,6 @@ msgctxt "#70392"
msgid "Rate with a [COLOR %s]%s[/ COLOR]" msgid "Rate with a [COLOR %s]%s[/ COLOR]"
msgstr "Dai un punteggio con un [COLOR %s]%s[/COLOR]" msgstr "Dai un punteggio con un [COLOR %s]%s[/COLOR]"
msgctxt "#70393"
msgid "[%s]: Select the correct %s "
msgstr "[%s]: Seleziona il %s corretto"
msgctxt "#70394" msgctxt "#70394"
msgid "Action" msgid "Action"
msgstr "Azione" msgstr "Azione"
@@ -4799,10 +4791,6 @@ msgctxt "#70528"
msgid "Default folder" msgid "Default folder"
msgstr "Cartella di Default" msgstr "Cartella di Default"
msgctxt "#70529"
msgid "Repeated link"
msgstr "Link ripetuto"
msgctxt "#70530" msgctxt "#70530"
msgid "You already have this link in the folder" msgid "You already have this link in the folder"
msgstr "C'è già un link nella cartella" msgstr "C'è già un link nella cartella"
@@ -1046,8 +1046,8 @@ msgid "Movie"
msgstr "Película" msgstr "Película"
msgctxt "#60245" msgctxt "#60245"
msgid "Series" msgid "tv show"
msgstr "Serie" msgstr "serie"
msgctxt "#60246" msgctxt "#60246"
msgid "Full information" msgid "Full information"
@@ -1249,10 +1249,6 @@ msgctxt "#60297"
msgid "Find %s possible matches" msgid "Find %s possible matches"
msgstr "Encontrados %s posibles coincidencias" msgstr "Encontrados %s posibles coincidencias"
msgctxt "#60298"
msgid "[%s]: Select the correct TV series"
msgstr "[%s]: Selecciona la serie correcta"
msgctxt "#60299" msgctxt "#60299"
msgid "Not found in the language '%s'" msgid "Not found in the language '%s'"
msgstr "No se ha encontrado en idioma '%s'" msgstr "No se ha encontrado en idioma '%s'"
@@ -4263,10 +4259,6 @@ msgctxt "#70392"
msgid "Rate with a [COLOR %s]%s[/ COLOR]" msgid "Rate with a [COLOR %s]%s[/ COLOR]"
msgstr "Puntuar con un [COLOR %s]%s[/COLOR]" msgstr "Puntuar con un [COLOR %s]%s[/COLOR]"
msgctxt "#70393"
msgid "[%s]: Select the correct %s "
msgstr "[%s]: Selecciona la %s correcta"
msgctxt "#70394" msgctxt "#70394"
msgid "Action" msgid "Action"
msgstr "Accion" msgstr "Accion"
@@ -4811,10 +4803,6 @@ msgctxt "#70528"
msgid "Default folder" msgid "Default folder"
msgstr "Carpeta por defecto" msgstr "Carpeta por defecto"
msgctxt "#70529"
msgid "Repeated link"
msgstr "Enlace repetido"
msgctxt "#70530" msgctxt "#70530"
msgid "You already have this link in the folder" msgid "You already have this link in the folder"
msgstr "Ya tienes este enlace en la carpeta" msgstr "Ya tienes este enlace en la carpeta"
@@ -1046,8 +1046,8 @@ msgid "Movie"
msgstr "Película" msgstr "Película"
msgctxt "#60245" msgctxt "#60245"
msgid "Series" msgid "tv show"
msgstr "Serie" msgstr "serie"
msgctxt "#60246" msgctxt "#60246"
msgid "Full information" msgid "Full information"
@@ -1249,10 +1249,6 @@ msgctxt "#60297"
msgid "Find %s possible matches" msgid "Find %s possible matches"
msgstr "Encontrados %s posibles coincidencias" msgstr "Encontrados %s posibles coincidencias"
msgctxt "#60298"
msgid "[%s]: Select the correct TV series"
msgstr "[%s]: Selecciona la serie correcta"
msgctxt "#60299" msgctxt "#60299"
msgid "Not found in the language '%s'" msgid "Not found in the language '%s'"
msgstr "No se ha encontrado en idioma '%s'" msgstr "No se ha encontrado en idioma '%s'"
@@ -4263,10 +4259,6 @@ msgctxt "#70392"
msgid "Rate with a [COLOR %s]%s[/ COLOR]" msgid "Rate with a [COLOR %s]%s[/ COLOR]"
msgstr "Puntuar con un [COLOR %s]%s[/COLOR]" msgstr "Puntuar con un [COLOR %s]%s[/COLOR]"
msgctxt "#70393"
msgid "[%s]: Select the correct %s "
msgstr "[%s]: Selecciona la %s correcta"
msgctxt "#70394" msgctxt "#70394"
msgid "Action" msgid "Action"
msgstr "Accion" msgstr "Accion"
@@ -4811,10 +4803,6 @@ msgctxt "#70528"
msgid "Default folder" msgid "Default folder"
msgstr "Carpeta por defecto" msgstr "Carpeta por defecto"
msgctxt "#70529"
msgid "Repeated link"
msgstr "Enlace repetido"
msgctxt "#70530" msgctxt "#70530"
msgid "You already have this link in the folder" msgid "You already have this link in the folder"
msgstr "Ya tienes este enlace en la carpeta" msgstr "Ya tienes este enlace en la carpeta"
@@ -1046,8 +1046,8 @@ msgid "Movie"
msgstr "Película" msgstr "Película"
msgctxt "#60245" msgctxt "#60245"
msgid "Series" msgid "tv show"
msgstr "Serie" msgstr "serie"
msgctxt "#60246" msgctxt "#60246"
msgid "Full information" msgid "Full information"
@@ -1249,10 +1249,6 @@ msgctxt "#60297"
msgid "Find %s possible matches" msgid "Find %s possible matches"
msgstr "Encontrados %s posibles coincidencias" msgstr "Encontrados %s posibles coincidencias"
msgctxt "#60298"
msgid "[%s]: Select the correct TV series"
msgstr "[%s]: Selecciona la serie correcta"
msgctxt "#60299" msgctxt "#60299"
msgid "Not found in the language '%s'" msgid "Not found in the language '%s'"
msgstr "No se ha encontrado en idioma '%s'" msgstr "No se ha encontrado en idioma '%s'"
@@ -4263,10 +4259,6 @@ msgctxt "#70392"
msgid "Rate with a [COLOR %s]%s[/ COLOR]" msgid "Rate with a [COLOR %s]%s[/ COLOR]"
msgstr "Puntuar con un [COLOR %s]%s[/COLOR]" msgstr "Puntuar con un [COLOR %s]%s[/COLOR]"
msgctxt "#70393"
msgid "[%s]: Select the correct %s "
msgstr "[%s]: Selecciona la %s correcta"
msgctxt "#70394" msgctxt "#70394"
msgid "Action" msgid "Action"
msgstr "Accion" msgstr "Accion"
@@ -4811,10 +4803,6 @@ msgctxt "#70528"
msgid "Default folder" msgid "Default folder"
msgstr "Carpeta por defecto" msgstr "Carpeta por defecto"
msgctxt "#70529"
msgid "Repeated link"
msgstr "Enlace repetido"
msgctxt "#70530" msgctxt "#70530"
msgid "You already have this link in the folder" msgid "You already have this link in the folder"
msgstr "Ya tienes este enlace en la carpeta" msgstr "Ya tienes este enlace en la carpeta"
+10 -2
View File
@@ -7,10 +7,15 @@ from core import scrapertools
from lib import jsunpack from lib import jsunpack
from platformcode import logger from platformcode import logger
headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0"}
def test_video_exists(page_url): def test_video_exists(page_url):
logger.info("(page_url='%s')" % page_url) logger.info("(page_url='%s')" % page_url)
data = httptools.downloadpage(page_url).data data = httptools.downloadpage(page_url)
if data.code==404:
data = httptools.downloadpage(page_url, headers=headers, add_referer=True)
data = data.data
if "File was deleted" in data or "Not Found" in data or "File was locked by administrator" in data: if "File was deleted" in data or "Not Found" in data or "File was locked by administrator" in data:
return False, "[Gamovideo] El archivo no existe o ha sido borrado" return False, "[Gamovideo] El archivo no existe o ha sido borrado"
@@ -23,7 +28,10 @@ def test_video_exists(page_url):
def get_video_url(page_url, premium=False, user="", password="", video_password=""): def get_video_url(page_url, premium=False, user="", password="", video_password=""):
logger.info("(page_url='%s')" % page_url) logger.info("(page_url='%s')" % page_url)
data = httptools.downloadpage(page_url).data data = httptools.downloadpage(page_url)
if data.code==404:
data = httptools.downloadpage(page_url, headers=headers, add_referer=True)
data = data.data
packer = scrapertools.find_single_match(data, packer = scrapertools.find_single_match(data,
"<script type='text/javascript'>(eval.function.p,a,c,k,e,d..*?)</script>") "<script type='text/javascript'>(eval.function.p,a,c,k,e,d..*?)</script>")
if packer != "": if packer != "":
+1 -1
View File
@@ -25,7 +25,7 @@ def get_video_url(page_url, user="", password="", video_password=""):
unpacked = jsunpack.unpack(pack) unpacked = jsunpack.unpack(pack)
logger.info("Intel11 %s" %unpacked) logger.info("Intel11 %s" %unpacked)
if "ldaa" in unpacked: if "ldaa" in unpacked:
videos = scrapertools.find_multiple_matches(unpacked, 'lda.="([^"]+)') videos = scrapertools.find_multiple_matches(unpacked, '(?is)lda.="([^"]+)')
video_urls = [] video_urls = []
for video in videos: for video in videos:
if not video.startswith("//"): if not video.startswith("//"):