NewPct1: implantación de apartado de Novedades
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
"id": "clonenewpct1_channels_list",
|
||||
"type": "text",
|
||||
"label": "Lista de clones de NewPct1 y orden de uso",
|
||||
"default": "('1', 'torrentrapid', 'http://torrentrapid.com/', 'movie, tvshow, season, episode', ''), ('1', 'torrentlocura', 'http://torrentlocura.com/', 'movie, tvshow, season, episode', ''), ('1', 'tumejortorrent', 'http://tumejortorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'tvsinpagar', 'http://www.tvsinpagar.com/', 'tvshow, season, episode', ''), ('1', 'descargas2020', 'http://descargas2020.com/', 'movie, tvshow, season, episode', ''), ('1', 'mispelisyseries', 'http://mispelisyseries.com/', 'movie', 'search')",
|
||||
"default": "('1', 'torrentrapid', 'http://torrentrapid.com/', 'movie, tvshow, season, episode', 'serie_episodios'), ('1', 'torrentlocura', 'http://torrentlocura.com/', 'movie, tvshow, season, episode', ''), ('1', 'tumejortorrent', 'http://tumejortorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'tvsinpagar', 'http://www.tvsinpagar.com/', 'tvshow, season, episode', ''), ('1', 'descargas2020', 'http://descargas2020.com/', 'movie, tvshow, season, episode', ''), ('1', 'mispelisyseries', 'http://mispelisyseries.com/', 'movie', 'search, listado_busqueda')",
|
||||
"enabled": true,
|
||||
"visible": false
|
||||
},
|
||||
@@ -560,6 +560,33 @@
|
||||
"9",
|
||||
"10"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "clonenewpct1_rango_fechas_novedades",
|
||||
"type": "list",
|
||||
"label": "Rango de fechas para búsquedas en Novedades",
|
||||
"default": 2,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": [
|
||||
"Hoy",
|
||||
"Ayer",
|
||||
"Semana",
|
||||
"Mes",
|
||||
"Siempre"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "clonenewpct1_serie_episodio_novedades",
|
||||
"type": "list",
|
||||
"label": "Ver en Novedades las series como episodios sueltos o serie completa",
|
||||
"default": 1,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": [
|
||||
"Episodios sueltos",
|
||||
"Serie completa"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -11,6 +11,7 @@ from channelselector import get_thumb
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from core import servertools
|
||||
from core import channeltools
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
from core import tmdb
|
||||
@@ -19,7 +20,12 @@ from lib import generictools
|
||||
channel_py = 'newpct1'
|
||||
|
||||
#Código para permitir usar un único canal para todas las webs clones de NewPct1
|
||||
clone_list = config.get_setting('clonenewpct1_channels_list', channel_py) #Carga lista de clones
|
||||
#Cargamos en .json del canal para ver las listas de valores en settings
|
||||
clone_list = channeltools.get_channel_json(channel_py)
|
||||
for settings in clone_list['settings']: #Se recorren todos los settings
|
||||
if settings['id'] == "clonenewpct1_channels_list": #Encontramos en setting
|
||||
clone_list = settings['default'] #Carga lista de clones
|
||||
break
|
||||
clone_list = ast.literal_eval(clone_list) #la convierte en array
|
||||
host_index = 0
|
||||
host_index = config.get_setting('clonenewpct1_channel_default', channel_py) #Clone por defecto
|
||||
@@ -39,6 +45,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
|
||||
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'
|
||||
elif fecha_rango == 2: fecha_rango = 'Semana'
|
||||
elif fecha_rango == 3: fecha_rango = 'Mes'
|
||||
elif fecha_rango == 4: fecha_rango = 'Siempre'
|
||||
episodio_serie = config.get_setting('clonenewpct1_serie_episodio_novedades', channel_py) #Episodio o serie para Novedades
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
@@ -60,6 +73,8 @@ def mainlist(item):
|
||||
thumb_buscar = get_thumb("search.png")
|
||||
thumb_settings = get_thumb("setting_0.png")
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="submenu_novedades", title="Novedades", url=item.channel_host + "ultimas-descargas/", extra="novedades", thumbnail=thumb_pelis, category=item.category, channel_host=item.channel_host))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="submenu", title="Películas", url=item.channel_host,
|
||||
extra="peliculas", thumbnail=thumb_pelis, category=item.category, channel_host=item.channel_host))
|
||||
|
||||
@@ -88,6 +103,7 @@ def settingCanal(item):
|
||||
|
||||
def submenu(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
|
||||
data = ''
|
||||
@@ -148,6 +164,82 @@ def submenu(item):
|
||||
return itemlist
|
||||
|
||||
|
||||
def submenu_novedades(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
itemlist_alt = []
|
||||
|
||||
data = ''
|
||||
timeout_search=timeout * 2 #Más tiempo para Novedades, que es una búsqueda
|
||||
|
||||
#Establecer los valores del .json por si se entra directamente desde un favorito
|
||||
item.channel_host = host
|
||||
item.url = host + "ultimas-descargas/"
|
||||
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
item.extra = "novedades"
|
||||
|
||||
try:
|
||||
data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url, timeout=timeout_search).data)
|
||||
except:
|
||||
pass
|
||||
|
||||
patron = '<div class="content">.*?<ul class="noticias'
|
||||
#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):
|
||||
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)
|
||||
|
||||
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'))
|
||||
itemlist.append(item.clone(action='', title=item.category + ': ERROR 01: SUBMENU: 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
|
||||
elif item.channel_alt: #Si ha habido fail-over, lo comento
|
||||
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.category + '[/COLOR] [ALT ] en uso'))
|
||||
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel_alt.capitalize() + '[/COLOR] inaccesible'))
|
||||
|
||||
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 = unicode(data, "iso-8859-1", errors="replace").encode("utf-8")
|
||||
data = data.replace("'", '"').replace('/series"', '/series/"') #Compatibilidad con mispelisy.series.com
|
||||
|
||||
patron = '<option value="([^"]+)".*?>(.*?)<\/option>'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
itemlist.append(item.clone(action='', title="[COLOR yellow]Ver lo Último de:[/COLOR]"))
|
||||
for value, title in matches:
|
||||
if not value.isdigit():
|
||||
if title not in "Mes":
|
||||
item.post = "date=%s" % value
|
||||
itemlist.append(item.clone(action="listado_busqueda", title=title, url=item.url, post=item.post))
|
||||
|
||||
itemlist.append(item.clone(action='', title="[COLOR yellow]Lo Último en la Categoría:[/COLOR]"))
|
||||
for value, title in matches:
|
||||
if value.isdigit():
|
||||
if title not in "Juegos, Software, Musica, Deportes":
|
||||
|
||||
#tratamos de poner al principio las categorías más relevantes
|
||||
if value == '1027': title = "01" + title #Pelis HD
|
||||
elif value == '757': title = "02" + title #Pelis Castellano
|
||||
elif value == '1527': title = "03" + title #Pelis Latino
|
||||
elif value == '1469': title = "04" + title #Series HD
|
||||
elif value == '767': title = "05" + title #Series
|
||||
else: title = "99" + title #Resto
|
||||
|
||||
item.post = "categoryIDR=%s&date=%s" % (value, fecha_rango)
|
||||
itemlist_alt.append(item.clone(action="listado_busqueda", title=title, url=item.url, post=item.post))
|
||||
|
||||
itemlist_alt = sorted(itemlist_alt, key=lambda it: it.title) #clasificamos
|
||||
for item_local in itemlist_alt:
|
||||
item_local.title = re.sub(r'^\d{2}', '', item_local.title) #Borramos la secuencia
|
||||
itemlist.append(item_local.clone())
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def alfabeto(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
@@ -483,15 +575,17 @@ def listado_busqueda(item):
|
||||
|
||||
#Renombramos el canal al nombre de clone elegido. Actualizados URL
|
||||
host = scrapertools.find_single_match(item.url, '(http.?\:\/\/(?:www.)?\w+\.\w+\/)')
|
||||
#item.channel = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/')
|
||||
if item.category and item.category != "newest":
|
||||
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
item.channel_host = host
|
||||
item.category_new = ''
|
||||
if item.category:
|
||||
item.category_new = item.category
|
||||
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
|
||||
itemlist = []
|
||||
cnt_tot = 40 # Poner el num. máximo de items por página. Dejamos que la web lo controle
|
||||
cnt_title = 0 # Contador de líneas insertadas en Itemlist
|
||||
cnt_pag = 0 # Contador de líneas leídas de Matches
|
||||
timeout_search = timeout * 2 # Timeout un poco más largo para las búsquedas
|
||||
timeout_search = timeout * 2 # Timeout un poco más largo para las búsquedas
|
||||
if timeout_search < 5:
|
||||
timeout_search = 5 # Timeout un poco más largo para las búsquedas
|
||||
data = ''
|
||||
@@ -527,7 +621,10 @@ def listado_busqueda(item):
|
||||
pass
|
||||
|
||||
cnt_next += 1
|
||||
pattern = '<ul class="%s">(.*?)</ul>' % item.pattern #seleccionamos el bloque que nos interesa
|
||||
if item.extra == "novedades":
|
||||
pattern = '<div class="content">.*?<ul class="noticias(.*?)<\/div><!-- end .content -->' #seleccionamos el bloque que nos interesa
|
||||
else:
|
||||
pattern = '<ul class="%s">(.*?)</ul>' % item.pattern #seleccionamos el bloque que nos interesa
|
||||
if not data or (not scrapertools.find_single_match(data, pattern) and not '<h3><strong>( 0 ) Resultados encontrados </strong>' in data):
|
||||
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ú
|
||||
@@ -543,7 +640,11 @@ def listado_busqueda(item):
|
||||
#Obtiene la dirección de la próxima página, si la hay
|
||||
try:
|
||||
post_actual = item.post #Guardamos el post actual por si hay overflow de Itemlist y hay que hechar marcha atrás
|
||||
get, post, total_pag = scrapertools.find_single_match(data, '<ul class="pagination">.*?<a\s*href="([^"]+)"(?:\s*onClick=".*?\(\'([^"]+)\'\);">Next<\/a>.*?onClick=".*?\(\'([^"]+)\'\);">Last<\/a>)')
|
||||
|
||||
if item.extra == "novedades":
|
||||
get, post, total_pag = scrapertools.find_single_match(data, '<ul class="pagination">.*?<a\s*href="([^"]+pg\/)(\d+)">Next<\/a>.*?<a\s*href="[^"]+pg\/(\d+)">Last<\/a>')
|
||||
else:
|
||||
get, post, total_pag = scrapertools.find_single_match(data, '<ul class="pagination">.*?<a\s*href="([^"]+)"(?:\s*onClick=".*?\(\'([^"]+)\'\);">Next<\/a>.*?onClick=".*?\(\'([^"]+)\'\);">Last<\/a>)')
|
||||
except:
|
||||
post = False
|
||||
cnt_next = 99 #No hay más páginas. Salir del bucle después de procesar ésta
|
||||
@@ -556,17 +657,29 @@ def listado_busqueda(item):
|
||||
post_num = int(post)-1 #Guardo página actual
|
||||
|
||||
# Preparamos un patron que pretence recoger todos los datos significativos del video
|
||||
pattern = '<ul class="%s">(.*?)</ul>' % item.pattern #seleccionamos el bloque que nos interesa
|
||||
if item.extra == "novedades":
|
||||
pattern = '<div class="content">.*?<ul class="noticias(.*?)<\/div><!-- end .content -->' #seleccionamos el bloque que nos interesa
|
||||
else:
|
||||
pattern = '<ul class="%s">(.*?)</ul>' % item.pattern #seleccionamos el bloque que nos interesa
|
||||
data_alt = data
|
||||
data = scrapertools.get_match(data, pattern)
|
||||
pattern = '<li[^>]*><a href="(?P<scrapedurl>[^"]+).*?' #url
|
||||
pattern += 'title="(?P<scrapedtitle>[^"]+).*?' #título
|
||||
pattern += '<img.*?src="(?P<scrapedthumbnail>[^"]+)?".*?' #thumb
|
||||
pattern += '<h2.*?(?P<calidad>\[.*?)?<\/h2.*?' #calidad
|
||||
pattern += '<span.*?>\d+-\d+-(?P<year>\d{4})?<\/span>*.?' #año
|
||||
pattern += '<span.*?>(?P<size>\d+[\.|\s].*?[GB|MB])?<\/span>' #tamaño (significativo para peliculas)
|
||||
if item.extra == "novedades":
|
||||
pattern = '<a href="(?P<scrapedurl>[^"]+)"\s?' #url
|
||||
pattern += 'title="(?P<scrapedtitle>[^"]+)"[^>]*>' #título
|
||||
pattern += '<img[^>]*src="(?P<scrapedthumbnail>[^"]+)"?.*?' #thumb
|
||||
pattern += '<\/h2><\/a><span.*?">(?P<calidad>.*?)?' #calidad
|
||||
pattern += '<(?P<year>.*?)?' #año
|
||||
pattern += '>Tama.*?\s(?P<size>\d+[.|\s].*?[GB|MB])?\s?<\/strong>' #tamaño (significativo para peliculas)
|
||||
else:
|
||||
pattern = '<li[^>]*><a href="(?P<scrapedurl>[^"]+).*?' #url
|
||||
pattern += 'title="(?P<scrapedtitle>[^"]+).*?' #título
|
||||
pattern += '<img.*?src="(?P<scrapedthumbnail>[^"]+)?".*?' #thumb
|
||||
pattern += '<h2.*?(?P<calidad>\[.*?)?<\/h2.*?' #calidad
|
||||
pattern += '<span.*?>\d+-\d+-(?P<year>\d{4})?<\/span>*.?' #año
|
||||
pattern += '<span.*?>(?P<size>\d+[\.|\s].*?[GB|MB])?<\/span>' #tamaño (significativo para peliculas)
|
||||
|
||||
matches_alt = re.compile(pattern, re.DOTALL).findall(data)
|
||||
if not matches_alt and not '<h3><strong>( 0 ) Resultados encontrados </strong>' in data_alt: #error
|
||||
if not matches_alt and not '<h3><strong>( 0 ) Resultados encontrados </strong>' in data_alt and not '<ul class="noticias-series"></ul></form></div><!-- end .page-box -->' in data_alt: #error
|
||||
logger.error("ERROR 02: LISTADO_BUSQUEDA: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / DATA: " + data_alt)
|
||||
itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: LISTADO_BUSQUEDA: Ha cambiado la estructura de la Web. Reportar el error con el log'))
|
||||
item, itemlist = generictools.post_tmdb_listado(item, itemlist) #Pintamos los datos de fail-over, si los hay
|
||||
@@ -648,8 +761,8 @@ def listado_busqueda(item):
|
||||
|
||||
#Creamos una copia de Item para cada contenido
|
||||
item_local = item.clone()
|
||||
if item_local.category:
|
||||
del item_local.category
|
||||
if item_local.category_new:
|
||||
del item_local.category_new
|
||||
if item_local.tipo:
|
||||
del item_local.tipo
|
||||
if item_local.totalItems:
|
||||
@@ -666,17 +779,71 @@ def listado_busqueda(item):
|
||||
del item_local.folder
|
||||
item_local.title = ''
|
||||
item_local.context = "['buscar_trailer']"
|
||||
item_local.contentType = ""
|
||||
|
||||
title_subs = []
|
||||
|
||||
#Si son episodios sueltos de Series que vienen de Novedades, se busca la url de la Serie
|
||||
if item.extra == "novedades" and "/serie" in scrapedurl and episodio_serie == 1:
|
||||
item_local.url = scrapedurl
|
||||
item_local.extra2 = 'serie_episodios' #Creamos acción temporal excluyente para otros clones
|
||||
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)
|
||||
else:
|
||||
try:
|
||||
data_serie = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item_local.url, timeout=timeout).data)
|
||||
except:
|
||||
pass
|
||||
|
||||
pattern = 'class="btn-torrent">.*?window.location.href = "(.*?)";' #Patron para .torrent
|
||||
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)
|
||||
|
||||
if not data_serie: #Si no ha logrado encontrar nada, salimos
|
||||
title_subs += ["ERR"]
|
||||
|
||||
elif item_local.channel_alt: #Si ha habido fail-over, lo comento
|
||||
scrapedurl = scrapedurl.replace(item_local.channel_alt, item_local.category.lower())
|
||||
title_subs += ["ALT"]
|
||||
|
||||
try:
|
||||
pattern = '<div class="content">.*?<h1>.*?<a href="([^"]+)"' #Patron para Serie completa
|
||||
item_local.url = scrapertools.find_single_match(data_serie, pattern)
|
||||
if (item.post and '775' in item.post and 'vo/' not in item_local.url) or 'vo/' in scrapedurl: #Son series VO mal formadas?
|
||||
item_local.url = item_local.url.replace('/series/', '/series-vo/')
|
||||
#item_local.url = re.sub(r'\/\d+$', '/', item_local.url) #Quitamos el ID de la serie por compatib.
|
||||
if item_local.url:
|
||||
title_subs += ["Episodio %sx%s" % (scrapertools.find_single_match(scrapedurl, '\/temp.*?-(\d+)\/cap.*?-(\d+)\/'))]
|
||||
scrapedurl = item_local.url
|
||||
except:
|
||||
pass
|
||||
|
||||
if item.extra == "novedades" and "/serie" in scrapedurl:
|
||||
if not item_local.url or episodio_serie == 0:
|
||||
item_local.url = scrapedurl
|
||||
if scrapertools.find_single_match(scrapedurl, '\/temp.*?-(\d+)\/cap.*?-(\d+)\/'):
|
||||
title_subs += ["Episodio %sx%s" % (scrapertools.find_single_match(scrapedurl, '\/temp.*?-(\d+)\/cap.*?-(\d+)\/'))]
|
||||
else:
|
||||
title_subs += ["Episodio 1x01"]
|
||||
|
||||
#Establecemos los valores básicos en función del tipo de contenido
|
||||
if (".com/serie" in scrapedurl or "/serie" in scrapedurl or "-serie" in scrapedurl) and not "/miniseries" in scrapedurl: #Series
|
||||
if (".com/serie" in scrapedurl or "/serie" in scrapedurl or "-serie" in scrapedurl) and not "/miniseries" in scrapedurl and (not "/capitulo" in scrapedurl or "pelisyseries.com" in item_local.channel_host): #Series
|
||||
item_local.action = "episodios"
|
||||
item_local.contentType = "tvshow"
|
||||
item_local.extra = "series"
|
||||
elif "varios/" in scrapedurl or "/miniseries" in scrapedurl: #Documentales y varios
|
||||
elif "varios/" in scrapedurl or "/miniseries" in scrapedurl: #Documentales y varios
|
||||
item_local.action = "findvideos"
|
||||
item_local.contentType = "movie"
|
||||
item_local.extra = "varios"
|
||||
else: #Películas
|
||||
elif "/capitulo" in scrapedurl: #Documentales y varios
|
||||
item_local.action = "findvideos"
|
||||
item_local.contentType = "episode"
|
||||
item_local.extra = "series"
|
||||
else: #Películas
|
||||
item_local.action = "findvideos"
|
||||
item_local.contentType = "movie"
|
||||
item_local.extra = "peliculas"
|
||||
@@ -686,8 +853,7 @@ def listado_busqueda(item):
|
||||
title = title.replace("á", "a").replace("é", "e").replace("í", "i").replace("ó", "o").replace("ú", "u").replace("ü", "u").replace("�", "ñ").replace("ñ", "ñ")
|
||||
|
||||
item_local.quality = scrapertools.htmlclean(calidad)
|
||||
title_subs = []
|
||||
|
||||
|
||||
#Determinamos y marcamos idiomas distintos del castellano
|
||||
item_local.language = []
|
||||
if "[vos" in title.lower() or "v.o.s" in title.lower() or "vo" in title.lower() or ".com/pelicula/" in scrapedurl or ".com/series-vo" in scrapedurl or "-vo/" in scrapedurl or "vos" in calidad.lower() or "vose" in calidad.lower() or "v.o.s" in calidad.lower() or "sub" in calidad.lower() or ".com/peliculas-vo" in item.url:
|
||||
@@ -822,6 +988,11 @@ def listado_busqueda(item):
|
||||
item_local.contentThumbnail = scrapedthumbnail
|
||||
|
||||
#Guardamos el año que puede venir en la url, por si luego no hay resultados desde TMDB
|
||||
try:
|
||||
year = int(year)
|
||||
except:
|
||||
year = ""
|
||||
year = str(year)
|
||||
if year >= "1900" and year <= "2040" and year != "2020":
|
||||
title_subs += [year]
|
||||
item_local.infoLabels['year'] = '-'
|
||||
@@ -830,11 +1001,11 @@ def listado_busqueda(item):
|
||||
item_local.title_subs = title_subs
|
||||
|
||||
# Codigo para rescatar lo que se pueda en pelisy.series.com de Series para la Videoteca. la URL apunta al capítulo y no a la Serie. Nombre de Serie frecuentemente en blanco. Se obtiene de Thumb, así como el id de la serie
|
||||
if ("/serie" in item_local.url or "-serie" in item_local.url) and "pelisyseries.com" in host:
|
||||
if ("/serie" in item_local.url or "-serie" in item_local.url) and "pelisyseries.com" in item_local.channel_host:
|
||||
#Extraer la calidad de la serie basados en la info de la url
|
||||
if "seriehd" in url:
|
||||
if "seriehd" in item_local.url:
|
||||
calidad_mps = "series-hd/"
|
||||
elif "serievo" in url or "serie-vo" in url:
|
||||
elif "serievo" in item_local.url or "serie-vo" in item_local.url:
|
||||
calidad_mps = "series-vo/"
|
||||
else:
|
||||
calidad_mps = "series/"
|
||||
@@ -847,7 +1018,7 @@ def listado_busqueda(item):
|
||||
|
||||
#Extraer el ID de la serie desde Thumbs (4 dígitos). Si no hay, nulo
|
||||
if "/0_" not in scrapedthumbnail and not "no_image" in scrapedthumbnail:
|
||||
serieid = scrapertools.find_single_match(scrapedthumbnail, r'.*?\/\w\/(?P<serieid>\d+).*?.*')
|
||||
serieid = scrapertools.find_single_match(scrapedthumbnail, r'\/\w\/(?P<serieid>\d+)')
|
||||
if len(serieid) > 5:
|
||||
serieid = ""
|
||||
else:
|
||||
@@ -879,13 +1050,14 @@ def listado_busqueda(item):
|
||||
|
||||
#logger.debug("url: " + item_local.url + " / title o/n: " + item_local.title + " / " + real_title_mps + " / calidad_mps : " + calidad_mps + " / contentType : " + item_local.contentType)
|
||||
|
||||
item_local.title = real_title_mps #Esperemos que el nuevo título esté bien
|
||||
item_local.title = real_title_mps.replace('-', ' ').title().strip() #Esperemos que el nuevo título esté bien
|
||||
item_local.contentSerieName = item_local.title
|
||||
|
||||
#Agrega el item local a la lista itemlist
|
||||
itemlist.append(item_local.clone())
|
||||
|
||||
if not item.category: #Si este campo no existe es que viene de la primera pasada de una búsqueda global
|
||||
return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo
|
||||
if not item.category_new: #Si este campo no existe es que viene de la primera pasada de una búsqueda global
|
||||
return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo
|
||||
|
||||
#Pasamos a TMDB la lista completa Itemlist
|
||||
tmdb.set_infoLabels(itemlist, __modo_grafico__)
|
||||
@@ -901,12 +1073,11 @@ def listado_busqueda(item):
|
||||
return itemlist
|
||||
|
||||
def findvideos(item):
|
||||
from core import channeltools
|
||||
logger.info()
|
||||
|
||||
#Renombramos el canal al nombre de clone elegido. Actualizados URL
|
||||
host = scrapertools.find_single_match(item.url, '(http.?\:\/\/(?:www.)?\w+\.\w+\/)')
|
||||
#item.channel = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/')
|
||||
item.channel_host = host
|
||||
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
|
||||
itemlist = []
|
||||
@@ -1266,10 +1437,16 @@ def episodios(item):
|
||||
|
||||
#Renombramos el canal al nombre de clone elegido. Actualizados URL
|
||||
host = scrapertools.find_single_match(item.url, '(http.?\:\/\/(?:www.)?\w+\.\w+\/)')
|
||||
#item.channel = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/')
|
||||
item.channel_host = host
|
||||
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
|
||||
itemlist = []
|
||||
|
||||
#Limpiamos num. Temporada y Episodio que ha podido quedar por Novedades
|
||||
if item.contentSeason:
|
||||
del item.infoLabels['season']
|
||||
if item.contentEpisodeNumber:
|
||||
del item.infoLabels['episode']
|
||||
|
||||
# Obtener la información actualizada de la Serie. TMDB es imprescindible para Videoteca
|
||||
if not item.infoLabels['tmdb_id']:
|
||||
@@ -1287,10 +1464,14 @@ def episodios(item):
|
||||
max_temp = max(y)
|
||||
|
||||
data = ''
|
||||
data_alt = ''
|
||||
try:
|
||||
if "pelisyseries.com" in item.url:
|
||||
patron = '<ul class="%s">(.*?)</ul>' % "chapters" # item.pattern
|
||||
else:
|
||||
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)
|
||||
patron = '<ul class="%s">(.*?)</ul>' % "buscar-list" # item.pattern
|
||||
data_alt = ''
|
||||
if data: data_alt = scrapertools.get_match(data, patron)
|
||||
except: #Algún error de proceso
|
||||
pass
|
||||
@@ -1303,6 +1484,7 @@ def episodios(item):
|
||||
#Verificamos si se ha cargado una página, y si además tiene la estructura correcta
|
||||
if not data_alt or not scrapertools.find_single_match(data_alt, pattern):
|
||||
logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea: " + item.url)
|
||||
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)
|
||||
@@ -1472,9 +1654,10 @@ def episodios(item):
|
||||
item_local.infoLabels['episodio_titulo'] = match['lang']
|
||||
item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo']
|
||||
|
||||
item_local.contentEpisodeNumber = match['episode']
|
||||
|
||||
if match['episode'] == 0: match['episode'] = 1 #Evitar errores en Videoteca
|
||||
item_local.contentEpisodeNumber = match['episode']
|
||||
|
||||
if match["episode2"]: #Hay episodio dos? es una entrada múltiple?
|
||||
item_local.title = "%sx%s al %s -" % (str(match["season"]), str(match["episode"]).zfill(2), str(match["episode2"]).zfill(2)) #Creamos un título con el rango de episodios
|
||||
else: #Si es un solo episodio, se formatea ya
|
||||
@@ -1543,6 +1726,7 @@ def search(item, texto):
|
||||
# texto = texto.replace(" ", "+")
|
||||
|
||||
try:
|
||||
item.url = host + "buscar"
|
||||
item.post = "q=%s" % texto
|
||||
item.pattern = "buscar-list"
|
||||
itemlist = listado_busqueda(item)
|
||||
@@ -1563,51 +1747,57 @@ def newest(categoria):
|
||||
|
||||
item.title = "newest"
|
||||
item.category = "newest"
|
||||
item.action = "listado"
|
||||
item.channel = scrapertools.find_single_match(host, r'(\w+)\.com\/')
|
||||
item.channel = channel_py
|
||||
|
||||
try:
|
||||
if categoria == 'peliculas':
|
||||
item.url = host+'peliculas/'
|
||||
item.url = host + 'ultimas-descargas/'
|
||||
value = 757
|
||||
item.post = "categoryIDR=%s&date=%s" % (value, fecha_rango)
|
||||
item.extra = "novedades"
|
||||
item.action = "listado_busqueda"
|
||||
itemlist = listado_busqueda(item)
|
||||
|
||||
elif categoria == 'series':
|
||||
item.url = host + 'ultimas-descargas/'
|
||||
value = 767
|
||||
item.post = "categoryIDR=%s&date=%s" % (value, fecha_rango)
|
||||
item.extra = "novedades"
|
||||
item.action = "listado_busqueda"
|
||||
itemlist = listado_busqueda(item)
|
||||
|
||||
elif categoria == '4k':
|
||||
item.url = host + 'ultimas-descargas/'
|
||||
value = 1027
|
||||
item.post = "categoryIDR=%s&date=%s" % (value, fecha_rango)
|
||||
item.extra = "novedades"
|
||||
item.action = "listado_busqueda"
|
||||
itemlist = listado_busqueda(item)
|
||||
|
||||
elif categoria == 'anime':
|
||||
item.url = host + 'anime/'
|
||||
item.extra = "peliculas"
|
||||
item.action = "listado"
|
||||
itemlist = listado(item)
|
||||
if ">> Página siguiente" in itemlist[-1].title:
|
||||
itemlist.pop()
|
||||
|
||||
if categoria == 'series':
|
||||
item.url = host+'series/'
|
||||
item.extra = "series"
|
||||
itemlist.extend(listado(item))
|
||||
if ">> Página siguiente" in itemlist[-1].title:
|
||||
itemlist.pop()
|
||||
|
||||
if categoria == '4k':
|
||||
item.url = host+'peliculas-hd/4kultrahd/'
|
||||
item.extra = "peliculas"
|
||||
itemlist.extend(listado(item))
|
||||
if ">> Página siguiente" in itemlist[-1].title:
|
||||
itemlist.pop()
|
||||
|
||||
if categoria == 'anime':
|
||||
item.url = host+'anime/'
|
||||
item.extra = "peliculas"
|
||||
itemlist.extend(listado(item))
|
||||
if ">> Página siguiente" in itemlist[-1].title:
|
||||
itemlist.pop()
|
||||
|
||||
if categoria == 'documentales':
|
||||
item.url = host+'documentales/'
|
||||
item.extra = "varios"
|
||||
itemlist.extend(listado(item))
|
||||
if ">> Página siguiente" in itemlist[-1].title:
|
||||
itemlist.pop()
|
||||
elif categoria == 'documentales':
|
||||
item.url = host + 'ultimas-descargas/'
|
||||
value = 780
|
||||
item.post = "categoryIDR=%s&date=%s" % (value, fecha_rango)
|
||||
item.extra = "novedades"
|
||||
item.action = "listado_busqueda"
|
||||
itemlist = listado_busqueda(item)
|
||||
|
||||
if categoria == 'latino':
|
||||
item.url = host+'peliculas-latino/'
|
||||
item.extra = "peliculas"
|
||||
itemlist.extend(listado(item))
|
||||
if ">> Página siguiente" in itemlist[-1].title:
|
||||
itemlist.pop()
|
||||
elif categoria == 'latino':
|
||||
item.url = host + 'ultimas-descargas/'
|
||||
value = 1527
|
||||
item.post = "categoryIDR=%s&date=%s" % (value, fecha_rango)
|
||||
item.extra = "novedades"
|
||||
item.action = "listado_busqueda"
|
||||
itemlist = listado_busqueda(item)
|
||||
|
||||
if ">> Página siguiente" in itemlist[-1].title or "Pagina siguiente >>" in itemlist[-1].title:
|
||||
itemlist.pop()
|
||||
|
||||
# Se captura la excepción, para no interrumpir al canal novedades si un canal falla
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user