Merge remote-tracking branch 'alfa-addon/master'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<addon id="plugin.video.alfa" name="Alfa" version="2.7.1" provider-name="Alfa Addon">
|
||||
<addon id="plugin.video.alfa" name="Alfa" version="2.7.2" provider-name="Alfa Addon">
|
||||
<requires>
|
||||
<import addon="xbmc.python" version="2.1.0"/>
|
||||
<import addon="script.module.libtorrent" optional="true"/>
|
||||
@@ -19,15 +19,17 @@
|
||||
</assets>
|
||||
<news>[B]Estos son los cambios para esta versión:[/B]
|
||||
[COLOR green][B]Canales agregados y arreglos[/B][/COLOR]
|
||||
¤ cuevana3 ¤ clipwatching
|
||||
¤ estrenosgo ¤ datoporn
|
||||
¤ elitetorrent ¤ mejortorrent1
|
||||
¤ newpct1 ¤ seriespapaya
|
||||
¤ cinetux ¤ pelisplusco
|
||||
|
||||
¤ allcalidad ¤ jkanime
|
||||
¤ miradetodo ¤ asialiveaction
|
||||
¤ pedropolis ¤ cinemahd
|
||||
¤ inkapelis ¤ pelisplusco
|
||||
¤ pelisr ¤ vepelis
|
||||
¤ ver-peliculas ¤ divxtotal
|
||||
¤ estrenosgo ¤ newpct1
|
||||
¤ pelispedia
|
||||
¤ arreglos internos
|
||||
|
||||
¤ Agradecimientos a @angedam y @alaquepasa por colaborar en ésta versión
|
||||
¤ Agradecimientos a @angedam por colaborar en ésta versión
|
||||
|
||||
</news>
|
||||
<description lang="es">Navega con Kodi por páginas web para ver sus videos de manera fácil.</description>
|
||||
|
||||
463
plugin.video.alfa/channels/alfavorites.py
Normal file
463
plugin.video.alfa/channels/alfavorites.py
Normal file
@@ -0,0 +1,463 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# ------------------------------------------------------------
|
||||
# Alfa favoritos (Mis enlaces)
|
||||
# ============================
|
||||
# - Lista de enlaces guardados como favoritos, solamente en Alfa, no Kodi.
|
||||
# - Los enlaces se organizan en carpetas que puede definir el usuario.
|
||||
# - Se utiliza un sólo fichero para guardar todas las carpetas y enlaces: user_favorites.json
|
||||
# - Se puede copiar user_favorites.json a otros dispositivos ya que la única dependencia local es el thumbnail asociado a los enlaces,
|
||||
# pero se detecta por código y se ajusta al dispositivo actual.
|
||||
|
||||
# Requerimientos en otros módulos para ejecutar este canal:
|
||||
# - Añadir un enlace a este canal en channelselector.py
|
||||
# - Modificar platformtools.py para controlar el menú contextual y añadir "Guardar enlace" en set_context_commands
|
||||
# ------------------------------------------------------------
|
||||
|
||||
import os, re
|
||||
|
||||
from core import filetools
|
||||
from core import jsontools
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
from platformcode import platformtools
|
||||
|
||||
|
||||
# Clase para cargar y guardar en el fichero de Alfavoritos
|
||||
# --------------------------------------------------------
|
||||
class AlfavoritesData:
|
||||
|
||||
def __init__(self):
|
||||
self.user_favorites_file = os.path.join(config.get_data_path(), 'user_favorites.json')
|
||||
|
||||
if not os.path.exists(self.user_favorites_file):
|
||||
self.user_favorites = []
|
||||
else:
|
||||
try:
|
||||
self.user_favorites = jsontools.load(filetools.read(self.user_favorites_file))
|
||||
except:
|
||||
self.user_favorites = []
|
||||
|
||||
if len(self.user_favorites) == 0:
|
||||
self.user_favorites.append({ 'title': 'Carpeta por defecto', 'items': [] })
|
||||
self.save()
|
||||
|
||||
def save(self):
|
||||
filetools.write(self.user_favorites_file, jsontools.dump(self.user_favorites))
|
||||
|
||||
|
||||
# ============================
|
||||
# Añadir desde menú contextual
|
||||
# ============================
|
||||
|
||||
def addFavourite(item):
|
||||
logger.info()
|
||||
alfav = AlfavoritesData()
|
||||
|
||||
# Si se llega aquí mediante el menú contextual, hay que recuperar los parámetros action y channel
|
||||
if item.from_action:
|
||||
item.__dict__["action"] = item.__dict__.pop("from_action")
|
||||
if item.from_channel:
|
||||
item.__dict__["channel"] = item.__dict__.pop("from_channel")
|
||||
|
||||
# Limpiar título y quitar color
|
||||
item.title = re.sub(r'\[COLOR [^\]]*\]', '', item.title.replace('[/COLOR]', '')).strip()
|
||||
if item.text_color:
|
||||
item.__dict__.pop("text_color")
|
||||
|
||||
# Diálogo para escoger/crear carpeta
|
||||
i_perfil = _selecciona_perfil(alfav, 'Guardar enlace en:')
|
||||
if i_perfil == -1: return False
|
||||
|
||||
# Detectar que el mismo enlace no exista ya en la carpeta
|
||||
campos = ['channel','action','url','extra'] # si todos estos campos coinciden se considera que el enlace ya existe
|
||||
for enlace in alfav.user_favorites[i_perfil]['items']:
|
||||
it = Item().fromurl(enlace)
|
||||
repe = True
|
||||
for prop in campos:
|
||||
if prop in it.__dict__ and prop in item.__dict__ and it.__dict__[prop] != item.__dict__[prop]:
|
||||
repe = False
|
||||
break
|
||||
if repe:
|
||||
platformtools.dialog_notification('Enlace repetido', 'Ya tienes este enlace en la carpeta')
|
||||
return False
|
||||
|
||||
# Guardar
|
||||
alfav.user_favorites[i_perfil]['items'].append(item.tourl())
|
||||
alfav.save()
|
||||
|
||||
platformtools.dialog_notification('Guardado enlace', 'Carpeta: %s' % alfav.user_favorites[i_perfil]['title'])
|
||||
|
||||
return True
|
||||
|
||||
|
||||
# ====================
|
||||
# NAVEGACIÓN
|
||||
# ====================
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
alfav = AlfavoritesData()
|
||||
|
||||
itemlist = []
|
||||
last_i = len(alfav.user_favorites) - 1
|
||||
|
||||
for i_perfil, perfil in enumerate(alfav.user_favorites):
|
||||
context = []
|
||||
|
||||
context.append({'title': 'Cambiar nombre de la carpeta', 'channel': item.channel, 'action': 'editar_perfil_titulo',
|
||||
'i_perfil': i_perfil})
|
||||
context.append({'title': 'Eliminar la carpeta', 'channel': item.channel, 'action': 'eliminar_perfil',
|
||||
'i_perfil': i_perfil})
|
||||
|
||||
if i_perfil > 0:
|
||||
context.append({'title': 'Mover arriba del todo', 'channel': item.channel, 'action': 'mover_perfil',
|
||||
'i_perfil': i_perfil, 'direccion': 'top'})
|
||||
context.append({'title': 'Mover hacia arriba', 'channel': item.channel, 'action': 'mover_perfil',
|
||||
'i_perfil': i_perfil, 'direccion': 'arriba'})
|
||||
if i_perfil < last_i:
|
||||
context.append({'title': 'Mover hacia abajo', 'channel': item.channel, 'action': 'mover_perfil',
|
||||
'i_perfil': i_perfil, 'direccion': 'abajo'})
|
||||
context.append({'title': 'Mover abajo del todo', 'channel': item.channel, 'action': 'mover_perfil',
|
||||
'i_perfil': i_perfil, 'direccion': 'bottom'})
|
||||
|
||||
plot = '%d enlaces en la carpeta' % len(perfil['items'])
|
||||
itemlist.append(Item(channel=item.channel, action='mostrar_perfil', title=perfil['title'], plot=plot, i_perfil=i_perfil, context=context))
|
||||
|
||||
plot = '* Crea diferentes carpetas para guardar tus enlaces favoritos dentro de Alfa.[CR]'
|
||||
plot += '* Para añadir enlaces a las carpetas accede al menú contextual desde cualquier punto de Alfa.[CR]'
|
||||
plot += '* Los enlaces pueden ser canales, secciones dentro de los canales, búsquedas, e incluso películas y series aunque para esto último es preferible utilizar la videoteca.'
|
||||
itemlist.append(item.clone(action='crear_perfil', title='Crear nueva carpeta ...', plot=plot, folder=False))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def mostrar_perfil(item):
|
||||
logger.info()
|
||||
alfav = AlfavoritesData()
|
||||
|
||||
itemlist = []
|
||||
|
||||
i_perfil = item.i_perfil
|
||||
if not alfav.user_favorites[i_perfil]: return itemlist
|
||||
last_i = len(alfav.user_favorites[i_perfil]['items']) - 1
|
||||
|
||||
ruta_runtime = config.get_runtime_path()
|
||||
|
||||
for i_enlace, enlace in enumerate(alfav.user_favorites[i_perfil]['items']):
|
||||
context = []
|
||||
|
||||
if i_enlace > 0:
|
||||
context.append({'title': 'Mover arriba del todo', 'channel': item.channel, 'action': 'mover_enlace',
|
||||
'i_enlace': i_enlace, 'i_perfil': i_perfil, 'direccion': 'top'})
|
||||
context.append({'title': 'Mover hacia arriba', 'channel': item.channel, 'action': 'mover_enlace',
|
||||
'i_enlace': i_enlace, 'i_perfil': i_perfil, 'direccion': 'arriba'})
|
||||
if i_enlace < last_i:
|
||||
context.append({'title': 'Mover hacia abajo', 'channel': item.channel, 'action': 'mover_enlace',
|
||||
'i_enlace': i_enlace, 'i_perfil': i_perfil, 'direccion': 'abajo'})
|
||||
context.append({'title': 'Mover abajo del todo', 'channel': item.channel, 'action': 'mover_enlace',
|
||||
'i_enlace': i_enlace, 'i_perfil': i_perfil, 'direccion': 'bottom'})
|
||||
|
||||
if len(alfav.user_favorites) > 1: # si se tiene más de una carpeta permitir mover entre ellas
|
||||
context.append({'title': 'Mover a otra carpeta', 'channel': item.channel, 'action': 'editar_enlace_carpeta',
|
||||
'i_enlace': i_enlace, 'i_perfil': i_perfil})
|
||||
|
||||
context.append({'title': 'Cambiar título', 'channel': item.channel, 'action': 'editar_enlace_titulo',
|
||||
'i_enlace': i_enlace, 'i_perfil': i_perfil})
|
||||
|
||||
context.append({'title': 'Cambiar color', 'channel': item.channel, 'action': 'editar_enlace_color',
|
||||
'i_enlace': i_enlace, 'i_perfil': i_perfil})
|
||||
|
||||
context.append({'title': 'Cambiar thumbnail', 'channel': item.channel, 'action': 'editar_enlace_thumbnail',
|
||||
'i_enlace': i_enlace, 'i_perfil': i_perfil})
|
||||
|
||||
context.append({'title': 'Eliminar enlace', 'channel': item.channel, 'action': 'eliminar_enlace',
|
||||
'i_enlace': i_enlace, 'i_perfil': i_perfil})
|
||||
|
||||
it = Item().fromurl(enlace)
|
||||
it.context = context
|
||||
it.plot = '[COLOR blue]Canal: ' + it.channel + '[/COLOR][CR]' + it.plot
|
||||
|
||||
# Si no es una url, ni tiene la ruta del sistema, convertir el path ya que se habrá copiado de otro dispositivo.
|
||||
# Sería más óptimo que la conversión se hiciera con un menú de importar, pero de momento se controla en run-time.
|
||||
if it.thumbnail and '://' not in it.thumbnail and not it.thumbnail.startswith(ruta_runtime):
|
||||
ruta, fichero = filetools.split(it.thumbnail)
|
||||
if ruta == '' and fichero == it.thumbnail: # en linux el split con un path de windows no separa correctamente
|
||||
ruta, fichero = filetools.split(it.thumbnail.replace('\\','/'))
|
||||
if 'channels' in ruta and 'thumb' in ruta:
|
||||
it.thumbnail = filetools.join(ruta_runtime, 'resources', 'media', 'channels', 'thumb', fichero)
|
||||
elif 'themes' in ruta and 'default' in ruta:
|
||||
it.thumbnail = filetools.join(ruta_runtime, 'resources', 'media', 'themes', 'default', fichero)
|
||||
|
||||
itemlist.append(it)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
# Rutinas internas compartidas
|
||||
# ----------------------------
|
||||
|
||||
# Diálogo para seleccionar/crear una carpeta. Devuelve índice de la carpeta en user_favorites (-1 si cancel)
|
||||
def _selecciona_perfil(alfav, titulo='Seleccionar carpeta', i_actual=-1):
|
||||
acciones = [(perfil['title'] if i_p != i_actual else '[I][COLOR pink]%s[/COLOR][/I]' % perfil['title']) for i_p, perfil in enumerate(alfav.user_favorites)]
|
||||
acciones.append('Crear nueva carpeta')
|
||||
|
||||
i_perfil = -1
|
||||
while i_perfil == -1: # repetir hasta seleccionar una carpeta o cancelar
|
||||
ret = platformtools.dialog_select(titulo, acciones)
|
||||
if ret == -1: return -1 # pedido cancel
|
||||
if ret < len(alfav.user_favorites):
|
||||
i_perfil = ret
|
||||
else: # crear nueva carpeta
|
||||
if _crea_perfil(alfav):
|
||||
i_perfil = len(alfav.user_favorites) - 1
|
||||
|
||||
return i_perfil
|
||||
|
||||
|
||||
# Diálogo para crear una carpeta
|
||||
def _crea_perfil(alfav):
|
||||
titulo = platformtools.dialog_input(default='', heading='Nombre de la carpeta')
|
||||
if titulo is None or titulo == '':
|
||||
return False
|
||||
|
||||
alfav.user_favorites.append({'title': titulo, 'items': []})
|
||||
alfav.save()
|
||||
|
||||
return True
|
||||
|
||||
|
||||
# Gestión de perfiles y enlaces
|
||||
# -----------------------------
|
||||
|
||||
def crear_perfil(item):
|
||||
logger.info()
|
||||
alfav = AlfavoritesData()
|
||||
|
||||
if not _crea_perfil(alfav): return False
|
||||
|
||||
platformtools.itemlist_refresh()
|
||||
return True
|
||||
|
||||
|
||||
def editar_perfil_titulo(item):
|
||||
logger.info()
|
||||
alfav = AlfavoritesData()
|
||||
|
||||
if not alfav.user_favorites[item.i_perfil]: return False
|
||||
|
||||
titulo = platformtools.dialog_input(default=alfav.user_favorites[item.i_perfil]['title'], heading='Nombre de la carpeta')
|
||||
if titulo is None or titulo == '' or titulo == alfav.user_favorites[item.i_perfil]['title']:
|
||||
return False
|
||||
|
||||
alfav.user_favorites[item.i_perfil]['title'] = titulo
|
||||
alfav.save()
|
||||
|
||||
platformtools.itemlist_refresh()
|
||||
return True
|
||||
|
||||
|
||||
def eliminar_perfil(item):
|
||||
logger.info()
|
||||
alfav = AlfavoritesData()
|
||||
|
||||
if not alfav.user_favorites[item.i_perfil]: return False
|
||||
|
||||
# Pedir confirmación
|
||||
if not platformtools.dialog_yesno('Eliminar carpeta', '¿Borrar la carpeta y los enlaces que contiene?'): return False
|
||||
|
||||
del alfav.user_favorites[item.i_perfil]
|
||||
alfav.save()
|
||||
|
||||
platformtools.itemlist_refresh()
|
||||
return True
|
||||
|
||||
|
||||
def editar_enlace_titulo(item):
|
||||
logger.info()
|
||||
alfav = AlfavoritesData()
|
||||
|
||||
if not alfav.user_favorites[item.i_perfil]: return False
|
||||
if not alfav.user_favorites[item.i_perfil]['items'][item.i_enlace]: return False
|
||||
|
||||
it = Item().fromurl(alfav.user_favorites[item.i_perfil]['items'][item.i_enlace])
|
||||
|
||||
titulo = platformtools.dialog_input(default=it.title, heading='Cambiar título del enlace')
|
||||
if titulo is None or titulo == '' or titulo == it.title:
|
||||
return False
|
||||
|
||||
it.title = titulo
|
||||
|
||||
alfav.user_favorites[item.i_perfil]['items'][item.i_enlace] = it.tourl()
|
||||
alfav.save()
|
||||
|
||||
platformtools.itemlist_refresh()
|
||||
return True
|
||||
|
||||
|
||||
def editar_enlace_color(item):
|
||||
logger.info()
|
||||
alfav = AlfavoritesData()
|
||||
|
||||
if not alfav.user_favorites[item.i_perfil]: return False
|
||||
if not alfav.user_favorites[item.i_perfil]['items'][item.i_enlace]: return False
|
||||
|
||||
it = Item().fromurl(alfav.user_favorites[item.i_perfil]['items'][item.i_enlace])
|
||||
|
||||
colores = ['green','yellow','red','blue','white','orange','lime','aqua','pink','violet','purple','tomato','olive','antiquewhite','gold']
|
||||
opciones = ['[COLOR %s]%s[/COLOR]' % (col, col) for col in colores]
|
||||
|
||||
ret = platformtools.dialog_select('Seleccionar color:', opciones)
|
||||
|
||||
if ret == -1: return False # pedido cancel
|
||||
it.text_color = colores[ret]
|
||||
|
||||
alfav.user_favorites[item.i_perfil]['items'][item.i_enlace] = it.tourl()
|
||||
alfav.save()
|
||||
|
||||
platformtools.itemlist_refresh()
|
||||
return True
|
||||
|
||||
|
||||
def editar_enlace_thumbnail(item):
|
||||
logger.info()
|
||||
alfav = AlfavoritesData()
|
||||
|
||||
if not alfav.user_favorites[item.i_perfil]: return False
|
||||
if not alfav.user_favorites[item.i_perfil]['items'][item.i_enlace]: return False
|
||||
|
||||
it = Item().fromurl(alfav.user_favorites[item.i_perfil]['items'][item.i_enlace])
|
||||
|
||||
# A partir de Kodi 17 se puede usar xbmcgui.Dialog().select con thumbnails (ListItem & useDetails=True)
|
||||
is_kodi17 = (config.get_platform(True)['num_version'] >= 17.0)
|
||||
if is_kodi17:
|
||||
import xbmcgui
|
||||
|
||||
# Diálogo para escoger thumbnail (el del canal o iconos predefinidos)
|
||||
opciones = []
|
||||
ids = []
|
||||
try:
|
||||
from core import channeltools
|
||||
channel_parameters = channeltools.get_channel_parameters(it.channel)
|
||||
if channel_parameters['thumbnail'] != '':
|
||||
nombre = 'Canal %s' % it.channel
|
||||
if is_kodi17:
|
||||
it_thumb = xbmcgui.ListItem(nombre)
|
||||
it_thumb.setArt({ 'thumb': channel_parameters['thumbnail'] })
|
||||
opciones.append(it_thumb)
|
||||
else:
|
||||
opciones.append(nombre)
|
||||
ids.append(channel_parameters['thumbnail'])
|
||||
except:
|
||||
pass
|
||||
|
||||
resource_path = os.path.join(config.get_runtime_path(), 'resources', 'media', 'themes', 'default')
|
||||
for f in sorted(os.listdir(resource_path)):
|
||||
if f.startswith('thumb_') and not f.startswith('thumb_intervenido') and f != 'thumb_back.png':
|
||||
nombre = f.replace('thumb_', '').replace('_', ' ').replace('.png', '')
|
||||
if is_kodi17:
|
||||
it_thumb = xbmcgui.ListItem(nombre)
|
||||
it_thumb.setArt({ 'thumb': os.path.join(resource_path, f) })
|
||||
opciones.append(it_thumb)
|
||||
else:
|
||||
opciones.append(nombre)
|
||||
ids.append(os.path.join(resource_path, f))
|
||||
|
||||
if is_kodi17:
|
||||
ret = xbmcgui.Dialog().select('Seleccionar thumbnail:', opciones, useDetails=True)
|
||||
else:
|
||||
ret = platformtools.dialog_select('Seleccionar thumbnail:', opciones)
|
||||
|
||||
if ret == -1: return False # pedido cancel
|
||||
|
||||
it.thumbnail = ids[ret]
|
||||
|
||||
alfav.user_favorites[item.i_perfil]['items'][item.i_enlace] = it.tourl()
|
||||
alfav.save()
|
||||
|
||||
platformtools.itemlist_refresh()
|
||||
return True
|
||||
|
||||
|
||||
def editar_enlace_carpeta(item):
|
||||
logger.info()
|
||||
alfav = AlfavoritesData()
|
||||
|
||||
if not alfav.user_favorites[item.i_perfil]: return False
|
||||
if not alfav.user_favorites[item.i_perfil]['items'][item.i_enlace]: return False
|
||||
|
||||
# Diálogo para escoger/crear carpeta
|
||||
i_perfil = _selecciona_perfil(alfav, 'Mover enlace a:', item.i_perfil)
|
||||
if i_perfil == -1 or i_perfil == item.i_perfil: return False
|
||||
|
||||
alfav.user_favorites[i_perfil]['items'].append(alfav.user_favorites[item.i_perfil]['items'][item.i_enlace])
|
||||
del alfav.user_favorites[item.i_perfil]['items'][item.i_enlace]
|
||||
alfav.save()
|
||||
|
||||
platformtools.itemlist_refresh()
|
||||
return True
|
||||
|
||||
|
||||
def eliminar_enlace(item):
|
||||
logger.info()
|
||||
alfav = AlfavoritesData()
|
||||
|
||||
if not alfav.user_favorites[item.i_perfil]: return False
|
||||
if not alfav.user_favorites[item.i_perfil]['items'][item.i_enlace]: return False
|
||||
|
||||
del alfav.user_favorites[item.i_perfil]['items'][item.i_enlace]
|
||||
alfav.save()
|
||||
|
||||
platformtools.itemlist_refresh()
|
||||
return True
|
||||
|
||||
|
||||
# Mover perfiles y enlaces (arriba, abajo, top, bottom)
|
||||
# ------------------------
|
||||
def mover_perfil(item):
|
||||
logger.info()
|
||||
alfav = AlfavoritesData()
|
||||
|
||||
alfav.user_favorites = _mover_item(alfav.user_favorites, item.i_perfil, item.direccion)
|
||||
alfav.save()
|
||||
|
||||
platformtools.itemlist_refresh()
|
||||
return True
|
||||
|
||||
def mover_enlace(item):
|
||||
logger.info()
|
||||
alfav = AlfavoritesData()
|
||||
|
||||
if not alfav.user_favorites[item.i_perfil]: return False
|
||||
alfav.user_favorites[item.i_perfil]['items'] = _mover_item(alfav.user_favorites[item.i_perfil]['items'], item.i_enlace, item.direccion)
|
||||
alfav.save()
|
||||
|
||||
platformtools.itemlist_refresh()
|
||||
return True
|
||||
|
||||
|
||||
# Mueve un item determinado (numérico) de una lista (arriba, abajo, top, bottom) y devuelve la lista modificada
|
||||
def _mover_item(lista, i_selected, direccion):
|
||||
last_i = len(lista) - 1
|
||||
if i_selected > last_i or i_selected < 0: return lista # índice inexistente en lista
|
||||
|
||||
if direccion == 'arriba':
|
||||
if i_selected == 0: # Ya está arriba de todo
|
||||
return lista
|
||||
lista.insert(i_selected - 1, lista.pop(i_selected))
|
||||
|
||||
elif direccion == 'abajo':
|
||||
if i_selected == last_i: # Ya está abajo de todo
|
||||
return lista
|
||||
lista.insert(i_selected + 1, lista.pop(i_selected))
|
||||
|
||||
elif direccion == 'top':
|
||||
if i_selected == 0: # Ya está arriba de todo
|
||||
return lista
|
||||
lista.insert(0, lista.pop(i_selected))
|
||||
|
||||
elif direccion == 'bottom':
|
||||
if i_selected == last_i: # Ya está abajo de todo
|
||||
return lista
|
||||
lista.insert(last_i, lista.pop(i_selected))
|
||||
|
||||
return lista
|
||||
@@ -98,20 +98,15 @@ def peliculas(item):
|
||||
data = httptools.downloadpage(item.url).data
|
||||
patron = '(?s)short_overlay.*?<a href="([^"]+)'
|
||||
patron += '.*?img.*?src="([^"]+)'
|
||||
patron += '.*?title="(.*?)"'
|
||||
patron += '.*?(Idioma.*?)post-ratings'
|
||||
|
||||
patron += '.*?title="([^"]+).*?'
|
||||
patron += 'data-postid="([^"]+)'
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for url, thumbnail, titulo, varios in matches:
|
||||
idioma = scrapertools.find_single_match(varios, '(?s)Idioma.*?kinopoisk">([^<]+)')
|
||||
number_idioma = scrapertools.find_single_match(idioma, '[0-9]')
|
||||
mtitulo = titulo
|
||||
if number_idioma != "":
|
||||
idioma = ""
|
||||
else:
|
||||
mtitulo += " (" + idioma + ")"
|
||||
year = scrapertools.find_single_match(varios, 'Año.*?kinopoisk">([^<]+)')
|
||||
year = scrapertools.find_single_match(year, '[0-9]{4}')
|
||||
for url, thumbnail, titulo, datapostid in matches:
|
||||
post = 'action=get_movie_details&postID=%s' %datapostid
|
||||
data1 = httptools.downloadpage(host + "wp-admin/admin-ajax.php", post=post).data
|
||||
idioma = "Latino"
|
||||
mtitulo = titulo + " (" + idioma + ")"
|
||||
year = scrapertools.find_single_match(data1, "Año:.*?(\d{4})")
|
||||
if year:
|
||||
mtitulo += " (" + year + ")"
|
||||
item.infoLabels['year'] = int(year)
|
||||
@@ -121,7 +116,6 @@ def peliculas(item):
|
||||
fulltitle = titulo,
|
||||
thumbnail = thumbnail,
|
||||
url = url,
|
||||
contentTitle = titulo,
|
||||
contentType="movie",
|
||||
language = idioma
|
||||
))
|
||||
@@ -142,10 +136,13 @@ def findvideos(item):
|
||||
contentTitle = scrapertools.find_single_match(data, 'orig_title.*?>([^<]+)<').strip()
|
||||
if contentTitle != "":
|
||||
item.contentTitle = contentTitle
|
||||
patron = '(?s)fmi(.*?)thead'
|
||||
bloque = scrapertools.find_single_match(data, patron)
|
||||
match = scrapertools.find_multiple_matches(bloque, '(?is)(?:iframe|script) .*?src="([^"]+)')
|
||||
for url in match:
|
||||
bloque = scrapertools.find_single_match(data, '(?s)<div class="bottomPlayer">(.*?)<script>')
|
||||
match = scrapertools.find_multiple_matches(bloque, '(?is)data-Url="([^"]+).*?data-postId="([^"]+)')
|
||||
for dataurl, datapostid in match:
|
||||
page_url = host + "wp-admin/admin-ajax.php"
|
||||
post = "action=get_more_top_news&postID=%s&dataurl=%s" %(datapostid, dataurl)
|
||||
data = httptools.downloadpage(page_url, post=post).data
|
||||
url = scrapertools.find_single_match(data, '(?i)src="([^"]+)')
|
||||
titulo = "Ver en: %s"
|
||||
text_color = "white"
|
||||
if "goo.gl" in url:
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
import re
|
||||
import urlparse
|
||||
|
||||
from channels import autoplay
|
||||
from channels import filtertools
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from core import servertools
|
||||
@@ -12,27 +14,25 @@ from platformcode import config, logger
|
||||
|
||||
host = "http://www.asialiveaction.com"
|
||||
|
||||
IDIOMAS = {'Japones': 'Japones'}
|
||||
list_language = IDIOMAS.values()
|
||||
list_quality = []
|
||||
list_servers = ['gvideo', 'openload','streamango']
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
|
||||
autoplay.init(item.channel, list_servers, list_quality)
|
||||
itemlist = list()
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="lista", title="Peliculas",
|
||||
url=urlparse.urljoin(host, "p/peliculas.html"), type='pl', first=0))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="lista", title="Series",
|
||||
url=urlparse.urljoin(host, "p/series.html"), type='sr', first=0))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="category", title="Géneros", url=host, cat='genre'))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="category", title="Calidad", url=host, cat='quality'))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="category", title="Orden Alfabético", url=host, cat='abc'))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="category", title="Año de Estreno", url=host, cat='year'))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title="Buscar", action="search", url=host+"/search?q="))
|
||||
autoplay.show_option(item.channel, itemlist)
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ def category(item):
|
||||
itemlist = list()
|
||||
data = httptools.downloadpage(host).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
|
||||
if item.cat == 'abc':
|
||||
data = scrapertools.find_single_match(data, '<span>Orden Alfabético</span>.*?</ul>')
|
||||
elif item.cat == 'genre':
|
||||
@@ -50,31 +49,23 @@ def category(item):
|
||||
data = scrapertools.find_single_match(data, '<span>Año</span>.*?</ul>')
|
||||
elif item.cat == 'quality':
|
||||
data = scrapertools.find_single_match(data, '<span>Calidad</span>.*?</ul>')
|
||||
|
||||
patron = "<li>([^<]+)<a href='([^']+)'>"
|
||||
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
for scrapedtitle, scrapedurl in matches:
|
||||
if scrapedtitle != 'Próximas Películas':
|
||||
itemlist.append(item.clone(action='lista', title=scrapedtitle, url=host+scrapedurl, type='cat', first=0))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def search_results(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
|
||||
patron = '<span class=.post-labels.>([^<]+)</span>.*?class="poster-bg" src="([^"]+)"/>.*?<h4>.*?'
|
||||
patron +=">(\d{4})</a>.*?<h6>([^<]+)<a href='([^']+)"
|
||||
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
|
||||
for scrapedtype, scrapedthumbnail, scrapedyear, scrapedtitle ,scrapedurl in matches:
|
||||
|
||||
title="%s [%s]" % (scrapedtitle,scrapedyear)
|
||||
new_item= Item(channel=item.channel, title=title, url=scrapedurl, thumbnail=scrapedthumbnail)
|
||||
if scrapedtype.strip() == 'Serie':
|
||||
@@ -85,12 +76,10 @@ def search_results(item):
|
||||
new_item.contentTitle = scrapedtitle
|
||||
new_item.action = 'findvideos'
|
||||
new_item.type = 'pl'
|
||||
|
||||
|
||||
itemlist.append(new_item)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def search(item, texto):
|
||||
logger.info()
|
||||
texto = texto.replace(" ", "+")
|
||||
@@ -98,57 +87,49 @@ def search(item, texto):
|
||||
if texto != '':
|
||||
return search_results(item)
|
||||
|
||||
|
||||
def episodios(item):
|
||||
logger.info()
|
||||
itemlist = list()
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
patron ='<div id="ep(\d+)" class="eps"> <section class="section-post online"><div class="player">.*?'
|
||||
patron += 'src="([^"]+)"/><a href="([^"]+)" target='
|
||||
|
||||
matches = re.compile(patron,re.DOTALL).findall(data)
|
||||
|
||||
data = data.replace('"ep0','"epp"')
|
||||
patron = '(?is)<div id="ep(\d+)".*?'
|
||||
patron += 'src="([^"]+)".*?'
|
||||
patron += 'href="([^"]+)" target="_blank"'
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for scrapedepi, scrapedthumbnail, scrapedurl in matches:
|
||||
url = scrapedurl
|
||||
title="1x%s - %s" % (scrapedepi, item.contentSerieName)
|
||||
itemlist.append(item.clone(action='findvideos', title=title, url=url, thumbnail=scrapedthumbnail, type=item.type,
|
||||
infoLabels=item.infoLabels))
|
||||
|
||||
if config.get_videolibrary_support() and len(itemlist) > 0:
|
||||
itemlist.append(Item(channel=item.channel, title="[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]",
|
||||
url=item.url, action="add_serie_to_library", extra="episodios",
|
||||
contentSerieName=item.contentSerieName))
|
||||
return itemlist
|
||||
|
||||
|
||||
def lista(item):
|
||||
logger.info()
|
||||
next = True
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
data = scrapertools.find_single_match(data, "itemprop='headline'>.*?</h2>.*?</ul>")
|
||||
|
||||
patron = '<span class="([^"]+)">.*?<figure class="poster-bg"><header><span>(\d{4})</span></header><img src="([^"]+)" />'
|
||||
patron += '<footer>(.*?)</footer></figure><h6>([^<]+)</h6><a href="([^"]+)"></a>'
|
||||
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
|
||||
first = int(item.first)
|
||||
last = first + 19
|
||||
if last > len(matches):
|
||||
last = len(matches)
|
||||
next = False
|
||||
|
||||
|
||||
for scrapedtype, scrapedyear, scrapedthumbnail, scrapedquality, scrapedtitle ,scrapedurl in matches[first:last]:
|
||||
patron_quality="<span>(.+?)</span>"
|
||||
quality = scrapertools.find_multiple_matches(scrapedquality, patron_quality)
|
||||
qual=""
|
||||
|
||||
for calidad in quality:
|
||||
qual=qual+"["+calidad+"] "
|
||||
|
||||
title="%s [%s] %s" % (scrapedtitle,scrapedyear,qual)
|
||||
new_item= Item(channel=item.channel, title=title, url=host+scrapedurl, thumbnail=scrapedthumbnail,
|
||||
type=scrapedtype, infoLabels={'year':scrapedyear})
|
||||
@@ -158,34 +139,26 @@ def lista(item):
|
||||
else:
|
||||
new_item.contentTitle = scrapedtitle
|
||||
new_item.action = 'findvideos'
|
||||
|
||||
if scrapedtype == item.type or item.type == 'cat':
|
||||
itemlist.append(new_item)
|
||||
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
|
||||
#pagination
|
||||
|
||||
url_next_page = item.url
|
||||
first = last
|
||||
|
||||
if next:
|
||||
itemlist.append(item.clone(title="Siguiente >>", url=url_next_page, action='lista', first=first))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
dl_links = []
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
|
||||
### obtiene los gvideo
|
||||
patron = 'class="Button Sm fa fa-download mg"></a><a target="_blank" rel="nofollow" href="([^"]+)"'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for dl_url in matches:
|
||||
g_data = httptools.downloadpage(dl_url).data
|
||||
video_id = scrapertools.find_single_match(g_data, 'jfk-button jfk-button-action" href="([^"]+)">')
|
||||
@@ -194,22 +167,26 @@ def findvideos(item):
|
||||
g_data = httptools.downloadpage(g_url, follow_redirects=False, only_headers=True).headers
|
||||
url = g_data['location']
|
||||
dl_links.append(Item(channel=item.channel, title='%s', url=url, action='play', infoLabels=item.infoLabels))
|
||||
|
||||
if item.type == 'pl':
|
||||
new_url = scrapertools.find_single_match(data, '<div class="player">.*?<a href="([^"]+)" target')
|
||||
|
||||
data = httptools.downloadpage(new_url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
|
||||
patron = '<li class="btn.*?" data-video="([^"]+)">'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for video_id in matches:
|
||||
url_data = httptools.downloadpage('https://tinyurl.com/%s' % video_id, follow_redirects=False)
|
||||
url = url_data.headers['location']
|
||||
itemlist.append(Item(channel=item.channel, title = '%s', url=url, action='play', infoLabels=item.infoLabels))
|
||||
|
||||
patron = '<iframe src="([^"]+)"'
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for url in matches:
|
||||
itemlist.append(item.clone(title = '%s', url=url, action='play'))
|
||||
itemlist.extend(dl_links)
|
||||
|
||||
itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server.capitalize())
|
||||
# Requerido para FilterTools
|
||||
itemlist = filtertools.get_links(itemlist, item, list_language)
|
||||
|
||||
return itemlist
|
||||
# Requerido para AutoPlay
|
||||
|
||||
autoplay.start(itemlist, item)
|
||||
return itemlist
|
||||
|
||||
@@ -56,8 +56,7 @@ def show_option(channel, itemlist, text_color='yellow', thumbnail=None, fanart=N
|
||||
if fanart == None:
|
||||
fanart = 'https://s7.postimg.cc/65ooga04b/Auto_Play.png'
|
||||
|
||||
plot_autoplay = 'AutoPlay permite auto reproducir los enlaces directamente, basándose en la configuracion de tus ' \
|
||||
'servidores y calidades favoritas. '
|
||||
plot_autoplay = config.get_localized_string(60399)
|
||||
itemlist.append(
|
||||
Item(channel=__channel__,
|
||||
title=config.get_localized_string(60071),
|
||||
@@ -703,18 +702,17 @@ def play_multi_channel(item, itemlist):
|
||||
channel_videos = []
|
||||
video_dict = dict()
|
||||
set_status(True)
|
||||
|
||||
for video_item in itemlist:
|
||||
if video_item.contentChannel != actual_channel:
|
||||
actual_channel = video_item.contentChannel
|
||||
else:
|
||||
elif is_active(actual_channel):
|
||||
channel_videos.append(video_item)
|
||||
video_dict[actual_channel] = channel_videos
|
||||
|
||||
for channel, videos in video_dict.items():
|
||||
item.contentChannel = channel
|
||||
if not PLAYED:
|
||||
item.contentChannel = channel
|
||||
if is_active(channel):
|
||||
logger.debug('esta activo en %s' % channel)
|
||||
start(videos, item)
|
||||
start(videos, item)
|
||||
else:
|
||||
break
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
{
|
||||
"id": "cinefoxtv",
|
||||
"name": "CineFoxTV",
|
||||
"active": true,
|
||||
"adult": false,
|
||||
"language": ["lat"],
|
||||
"thumbnail": "https://s28.postimg.cc/lytn2q1tp/cinefoxtv.png",
|
||||
"banner": "cinefoxtv.png",
|
||||
"categories": [
|
||||
"movie"
|
||||
],
|
||||
"settings": [
|
||||
{
|
||||
"id": "include_in_global_search",
|
||||
"type": "bool",
|
||||
"label": "Incluir en busqueda global",
|
||||
"default": false,
|
||||
"enabled": false,
|
||||
"visible": false
|
||||
},
|
||||
{
|
||||
"id": "include_in_newest_latino",
|
||||
"type": "bool",
|
||||
"label": "Incluir en Novedades - Latino",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "include_in_newest_peliculas",
|
||||
"type": "bool",
|
||||
"label": "Incluir en Novedades - Peliculas",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "include_in_newest_infantiles",
|
||||
"type": "bool",
|
||||
"label": "Incluir en Novedades - Infantiles",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,209 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
import urlparse
|
||||
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from core import servertools
|
||||
from core import tmdb
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
from channelselector import get_thumb
|
||||
|
||||
host = 'http://verhdpelis.com/'
|
||||
headers = [['User-Agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0'],
|
||||
['Referer', host]]
|
||||
|
||||
global duplicado
|
||||
global itemlist
|
||||
global temp_list
|
||||
canal = 'cinefoxtv'
|
||||
|
||||
tgenero = {"Comedia": "https://s7.postimg.cc/ne9g9zgwb/comedia.png",
|
||||
"Suspenso": "https://s13.postimg.cc/wmw6vl1cn/suspenso.png",
|
||||
"Drama": "https://s16.postimg.cc/94sia332d/drama.png",
|
||||
"Acción": "https://s3.postimg.cc/y6o9puflv/accion.png",
|
||||
"Aventuras": "https://s10.postimg.cc/6su40czih/aventura.png",
|
||||
"Animacion": "https://s13.postimg.cc/5on877l87/animacion.png",
|
||||
"Ciencia Ficcion": "https://s9.postimg.cc/diu70s7j3/cienciaficcion.png",
|
||||
"Terror": "https://s7.postimg.cc/yi0gij3gb/terror.png",
|
||||
"Documentales": "https://s16.postimg.cc/7xjj4bmol/documental.png",
|
||||
"Musical": "https://s29.postimg.cc/bbxmdh9c7/musical.png",
|
||||
"Western": "https://s23.postimg.cc/lzyfbjzhn/western.png",
|
||||
"Belico": "https://s23.postimg.cc/71itp9hcr/belica.png",
|
||||
"Crimen": "https://s4.postimg.cc/6z27zhirx/crimen.png",
|
||||
"Biográfica": "https://s15.postimg.cc/5lrpbx323/biografia.png",
|
||||
"Deporte": "https://s13.postimg.cc/xuxf5h06v/deporte.png",
|
||||
"Fantástico": "https://s10.postimg.cc/pbkbs6j55/fantastico.png",
|
||||
"Estrenos": "https://s21.postimg.cc/fy69wzm93/estrenos.png",
|
||||
"Película 18+": "https://s15.postimg.cc/exz7kysjf/erotica.png",
|
||||
"Thriller": "https://s22.postimg.cc/5y9g0jsu9/thriller.png",
|
||||
"Familiar": "https://s7.postimg.cc/6s7vdhqrf/familiar.png",
|
||||
"Romanticas": "https://s21.postimg.cc/xfsj7ua0n/romantica.png",
|
||||
"Intriga": "https://s27.postimg.cc/v9og43u2b/intriga.png",
|
||||
"Infantil": "https://s23.postimg.cc/g5rmazozv/infantil.png"}
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
|
||||
itemlist.append(item.clone(title="Todas", action="lista", thumbnail=get_thumb('all', auto=True),
|
||||
fanart='https://s18.postimg.cc/fwvaeo6qh/todas.png', extra='peliculas/',
|
||||
url=host + 'page/1.html'))
|
||||
|
||||
itemlist.append(
|
||||
itemlist[-1].clone(title="Generos", action="generos", thumbnail=get_thumb('genres', auto=True),
|
||||
fanart='https://s3.postimg.cc/5s9jg2wtf/generos.png', url=host))
|
||||
|
||||
itemlist.append(
|
||||
itemlist[-1].clone(title="Mas Vistas", action="lista", thumbnail=get_thumb('more watched', auto=True),
|
||||
fanart='https://s9.postimg.cc/wmhzu9d7z/vistas.png',
|
||||
url=host + 'top-peliculas-online/1.html'))
|
||||
|
||||
itemlist.append(itemlist[-1].clone(title="Buscar", action="search", thumbnail=get_thumb('search', auto=True),
|
||||
fanart='https://s30.postimg.cc/pei7txpa9/buscar.png', url=host + 'search/'))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def lista(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
duplicado = []
|
||||
max_items = 24
|
||||
next_page_url = ''
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t| |<br>", "", data)
|
||||
data = scrapertools.decodeHtmlentities(data)
|
||||
patron = '"box_image_b.*?"><a href="([^"]+)" title=".*?><img src="([^"]+)" alt="(.*?)(\d{4}).*?"'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
if item.next_page != 'b':
|
||||
if len(matches) > max_items:
|
||||
next_page_url = item.url
|
||||
matches = matches[:max_items]
|
||||
next_page = 'b'
|
||||
else:
|
||||
matches = matches[max_items:]
|
||||
next_page = 'a'
|
||||
patron_next_page = '<a class="page dark gradient" href="([^"]+)">PROXIMO'
|
||||
matches_next_page = re.compile(patron_next_page, re.DOTALL).findall(data)
|
||||
if len(matches_next_page) > 0:
|
||||
next_page_url = urlparse.urljoin(item.url, matches_next_page[0])
|
||||
|
||||
for scrapedurl, scrapedthumbnail, scrapedtitle, scrapedyear in matches:
|
||||
|
||||
url = scrapedurl
|
||||
thumbnail = scrapedthumbnail
|
||||
contentTitle = re.sub(r"\(.*?\)|\/.*?|\(|\)|.*?\/|!", "", scrapedtitle)
|
||||
title = scrapertools.decodeHtmlentities(contentTitle) + '(' + scrapedyear + ')'
|
||||
fanart = ''
|
||||
plot = ''
|
||||
|
||||
if url not in duplicado:
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action='findvideos', title=title, url=url, thumbnail=thumbnail, plot=plot,
|
||||
fanart=fanart, contentTitle=contentTitle, infoLabels={'year': scrapedyear}))
|
||||
duplicado.append(url)
|
||||
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
if next_page_url != '':
|
||||
itemlist.append(Item(channel=item.channel, action="lista", title='Siguiente >>>', url=next_page_url,
|
||||
thumbnail='https://s16.postimg.cc/9okdu7hhx/siguiente.png', extra=item.extra,
|
||||
next_page=next_page))
|
||||
return itemlist
|
||||
|
||||
|
||||
def generos(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
patron = '<li><a href="([^"]+)"><i class="fa fa-caret-right"><\/i> <strong>Películas de (.*?)<\/strong><\/a><\/li>'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
url = scrapedurl
|
||||
if scrapedtitle in tgenero:
|
||||
thumbnail = tgenero[scrapedtitle]
|
||||
else:
|
||||
thumbnail = ''
|
||||
title = scrapedtitle
|
||||
fanart = ''
|
||||
plot = ''
|
||||
|
||||
if title != 'Series':
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action='lista', title=title, url=url, thumbnail=thumbnail, plot=plot,
|
||||
fanart=fanart))
|
||||
return itemlist
|
||||
|
||||
|
||||
def getinfo(page_url):
|
||||
logger.info()
|
||||
data = httptools.downloadpage(page_url).data
|
||||
plot = scrapertools.find_single_match(data, '<\/em>\.(?:\s*|.)(.*?)\s*<\/p>')
|
||||
info = plot
|
||||
|
||||
return info
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
info = getinfo(item.url)
|
||||
data = httptools.downloadpage(item.url, headers=headers).data
|
||||
patron = 'src="(.*?)" style="border:none;'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
for scrapedurl in matches:
|
||||
itemlist.extend(servertools.find_video_items(data=scrapedurl))
|
||||
|
||||
for videoitem in itemlist:
|
||||
videoitem.title = item.contentTitle
|
||||
videoitem.channel = item.channel
|
||||
videoitem.plot = info
|
||||
videoitem.action = "play"
|
||||
videoitem.folder = False
|
||||
videoitem.infoLabels=item.infoLabels
|
||||
|
||||
if config.get_videolibrary_support() and len(itemlist) > 0 and item.extra != 'findvideos':
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, title='[COLOR yellow]Añadir esta pelicula a la videoteca[/COLOR]', url=item.url,
|
||||
action="add_pelicula_to_library", extra="findvideos", contentTitle=item.contentTitle))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def search(item, texto):
|
||||
logger.info()
|
||||
texto = texto.replace(" ", "-")
|
||||
item.url = item.url + texto
|
||||
if texto != '':
|
||||
return lista(item)
|
||||
|
||||
|
||||
def newest(categoria):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
item = Item()
|
||||
# categoria='peliculas'
|
||||
try:
|
||||
if categoria in ['peliculas','latino']:
|
||||
item.url = host + 'page/1.html'
|
||||
elif categoria == 'infantiles':
|
||||
item.url = host + 'peliculas-de-genero/infantil/1.html'
|
||||
itemlist = lista(item)
|
||||
if itemlist[-1].title == 'Siguiente >>>':
|
||||
itemlist.pop()
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
logger.error("{0}".format(line))
|
||||
return []
|
||||
|
||||
return itemlist
|
||||
@@ -30,16 +30,16 @@ def mainlist(item):
|
||||
autoplay.init(item.channel, list_servers, list_quality)
|
||||
|
||||
itemlist = list()
|
||||
itemlist.append(item.clone(title="Ultimas", action="list_all", url=host, thumbnail=get_thumb('last', auto=True)))
|
||||
itemlist.append(item.clone(title="Generos", action="section", section='genre',
|
||||
itemlist.append(Item(channel=item.channel, title="Ultimas", action="list_all", url=host, thumbnail=get_thumb('last', auto=True)))
|
||||
itemlist.append(Item(channel=item.channel, title="Generos", action="section", section='genre',
|
||||
thumbnail=get_thumb('genres', auto=True)))
|
||||
itemlist.append(item.clone(title="Por Calidad", action="section", section='quality',
|
||||
itemlist.append(Item(channel=item.channel, title="Por Calidad", action="section", section='quality',
|
||||
thumbnail=get_thumb('quality', auto=True)))
|
||||
itemlist.append(item.clone(title="Por Año", action="section", section='year',
|
||||
itemlist.append(Item(channel=item.channel, title="Por Año", action="section", section='year',
|
||||
thumbnail=get_thumb('year', auto=True)))
|
||||
itemlist.append(item.clone(title="Alfabetico", action="section", section='alpha',
|
||||
itemlist.append(Item(channel=item.channel, title="Alfabetico", action="section", section='alpha',
|
||||
thumbnail=get_thumb('alphabet', auto=True)))
|
||||
itemlist.append(item.clone(title="Buscar", action="search", url=host+'?s=',
|
||||
itemlist.append(Item(channel=item.channel, title="Buscar", action="search", url=host+'?s=',
|
||||
thumbnail=get_thumb('search', auto=True)))
|
||||
|
||||
autoplay.show_option(item.channel, itemlist)
|
||||
@@ -85,7 +85,7 @@ def list_all(item):
|
||||
|
||||
title = '%s [%s]'%(contentTitle, year)
|
||||
thumbnail = 'http:'+scrapedthumbnail
|
||||
itemlist.append(item.clone(action='findvideos',
|
||||
itemlist.append(Item(channel=item.channel, action='findvideos',
|
||||
title=title,
|
||||
url=url,
|
||||
thumbnail=thumbnail,
|
||||
@@ -98,7 +98,7 @@ def list_all(item):
|
||||
|
||||
url_next_page = scrapertools.find_single_match(full_data,'<a class=next.*?href=(.*?)>')
|
||||
if url_next_page:
|
||||
itemlist.append(item.clone(title="Siguiente >>", url=url_next_page, action='list_all'))
|
||||
itemlist.append(Item(channel=item.channel, title="Siguiente >>", url=url_next_page, action='list_all'))
|
||||
return itemlist
|
||||
|
||||
def section(item):
|
||||
@@ -147,9 +147,10 @@ def findvideos(item):
|
||||
language = opt_data[0].strip()
|
||||
quality = opt_data[1].strip()
|
||||
if url != '' and 'youtube' not in url:
|
||||
itemlist.append(item.clone(title='%s', url=url, language=IDIOMAS[language], quality=quality, action='play'))
|
||||
itemlist.append(Item(channel=item.channel, title='%s', url=url, language=IDIOMAS[language], quality=quality,
|
||||
action='play'))
|
||||
elif 'youtube' in url:
|
||||
trailer = item.clone(title='Trailer', url=url, action='play', server='youtube')
|
||||
trailer = Item(channel=item.channel, title='Trailer', url=url, action='play', server='youtube')
|
||||
|
||||
itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % '%s [%s] [%s]'%(i.server.capitalize(),
|
||||
i.language, i.quality))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "crunchyroll",
|
||||
"name": "Crunchyroll",
|
||||
"language": ["cast", "lat"],
|
||||
"active": true,
|
||||
"active": false,
|
||||
"adult": false,
|
||||
"thumbnail": "http://i.imgur.com/O49fDS1.png",
|
||||
"categories": [
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "cuelgame",
|
||||
"name": "Cuelgame",
|
||||
"active": true,
|
||||
"active": false,
|
||||
"adult": false,
|
||||
"language": ["cast"],
|
||||
"thumbnail": "cuelgame.png",
|
||||
|
||||
68
plugin.video.alfa/channels/divxtotal.json
Normal file
68
plugin.video.alfa/channels/divxtotal.json
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"id": "divxtotal",
|
||||
"name": "Divxtotal",
|
||||
"active": true,
|
||||
"adult": false,
|
||||
"language": ["cast"],
|
||||
"thumbnail": "http://imgur.com/Madj03A.jpg",
|
||||
"categories": [
|
||||
"torrent",
|
||||
"movie",
|
||||
"tvshow"
|
||||
],
|
||||
"settings": [
|
||||
{
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"id": "include_in_global_search",
|
||||
"label": "Incluir en busqueda global",
|
||||
"type": "bool",
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"id": "modo_grafico",
|
||||
"label": "Buscar información extra (TMDB)",
|
||||
"type": "bool",
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "timeout_downloadpage",
|
||||
"type": "list",
|
||||
"label": "Timeout (segs.) en descarga de páginas o verificación de servidores",
|
||||
"default": 5,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": [
|
||||
"None",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9",
|
||||
"10"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "seleccionar_ult_temporadda_activa",
|
||||
"type": "bool",
|
||||
"label": "Seleccionar para Videoteca si estará activa solo la última Temporada",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "include_in_newest_peliculas",
|
||||
"type": "bool",
|
||||
"label": "Incluir en Novedades - Peliculas",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": false
|
||||
}
|
||||
]
|
||||
}
|
||||
780
plugin.video.alfa/channels/divxtotal.py
Normal file
780
plugin.video.alfa/channels/divxtotal.py
Normal file
@@ -0,0 +1,780 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
import sys
|
||||
import urllib
|
||||
import urlparse
|
||||
import time
|
||||
|
||||
from channelselector import get_thumb
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from core import servertools
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
from core import tmdb
|
||||
from lib import generictools
|
||||
|
||||
host = 'https://www.divxtotal3.net/'
|
||||
channel = 'divxtotal'
|
||||
categoria = channel.capitalize()
|
||||
color1, color2, color3 = ['0xFF58D3F7', '0xFF2E64FE', '0xFF0404B4']
|
||||
__modo_grafico__ = config.get_setting('modo_grafico', channel)
|
||||
modo_ultima_temp = config.get_setting('seleccionar_ult_temporadda_activa', channel) #Actualización sólo últ. Temporada?
|
||||
timeout = config.get_setting('timeout_downloadpage', channel)
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
thumb_cartelera = get_thumb("now_playing.png")
|
||||
thumb_pelis_hd = get_thumb("channels_movie_hd.png")
|
||||
thumb_series = get_thumb("channels_tvshow.png")
|
||||
thumb_buscar = get_thumb("search.png")
|
||||
thumb_separador = get_thumb("next.png")
|
||||
|
||||
item.url_plus = "peliculas/"
|
||||
itemlist.append(Item(channel=item.channel, title="Películas", action="categorias", url=host + item.url_plus, url_plus=item.url_plus, thumbnail=thumb_cartelera, extra="Películas"))
|
||||
item.url_plus = "peliculas-hd/"
|
||||
itemlist.append(Item(channel=item.channel, title="Películas HD", action="categorias", url=host + item.url_plus, url_plus=item.url_plus, thumbnail=thumb_pelis_hd, extra="Películas HD"))
|
||||
item.url_plus = "peliculas-dvdr/"
|
||||
itemlist.append(Item(channel=item.channel, title="Películas DVDR", action="categorias", url=host + item.url_plus, url_plus=item.url_plus, thumbnail=thumb_pelis_hd, extra="Películas DVDR"))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, url=host, title="", folder=False, thumbnail=thumb_separador))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, url=host, title="Series", action="submenu", thumbnail=thumb_series, extra="series"))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, url=host, title="", folder=False, thumbnail=thumb_separador))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title="Buscar...", action="search", url=host + "?s=%s", thumbnail=thumb_buscar, extra="search"))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def submenu(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
thumb_series = get_thumb("channels_tvshow.png")
|
||||
|
||||
if item.extra == "series":
|
||||
|
||||
item.url_plus = "serie/"
|
||||
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"))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def categorias(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
|
||||
if item.extra3:
|
||||
extra3 = item.extra3
|
||||
del item.extra3
|
||||
else:
|
||||
extra3 = False
|
||||
|
||||
data = ''
|
||||
try:
|
||||
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url, timeout=timeout).data)
|
||||
data = unicode(data, "utf-8", errors="replace").encode("utf-8")
|
||||
except:
|
||||
pass
|
||||
|
||||
patron = '<li><a class="alist" href="([^"]+)">(.*?)<\/a><\/li>'
|
||||
#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
|
||||
if item.intervencion: #Sí ha sido clausurada judicialmente
|
||||
for clone_inter, autoridad in item.intervencion:
|
||||
thumb_intervenido = get_thumb(autoridad)
|
||||
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)
|
||||
#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ú
|
||||
|
||||
if not data: #Si no ha logrado encontrar nada, salimos
|
||||
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
|
||||
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
if not matches:
|
||||
logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
|
||||
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
|
||||
|
||||
#logger.debug(item.url_plus)
|
||||
#logger.debug(matches)
|
||||
|
||||
#Insertamos las cabeceras para todas las peliculas de la Aalidad, por Año, Alfabético, por Género, y Otras Calidades
|
||||
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))
|
||||
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
if item.url_plus not in scrapedurl:
|
||||
continue
|
||||
if "Todas" in scrapedtitle:
|
||||
continue
|
||||
|
||||
title = scrapedtitle.strip()
|
||||
|
||||
#Preguntamos por las entradas que corresponden al "extra"
|
||||
if extra3 == 'now':
|
||||
if scrapedtitle.lower() in ['ac3 51', 'bluray rip', 'series', 'serie', 'subtitulada', 'vose', 'bdrip', 'dvdscreener', 'brscreener r6', 'brscreener', 'webscreener', 'dvd', 'hdrip', 'screener', 'screeer', 'webrip', 'brrip', 'dvb', 'dvdrip', 'dvdsc', 'dvdsc - r6', 'hdts', 'hdtv', 'kvcd', 'line', 'ppv', 'telesync', 'ts hq', 'ts hq proper', '480p', '720p', 'ac3', 'bluray', 'camrip', 'ddc', 'hdtv - screener', 'tc screener', 'ts screener', 'ts screener alto', 'ts screener medio', 'vhs screener']:
|
||||
itemlist.append(item.clone(action="listado", title=title, url=scrapedurl, extra2="categorias"))
|
||||
|
||||
elif scrapedtitle.lower() in ['ac3 51', 'bluray rip', 'series', 'serie', 'subtitulada', 'vose', 'bdrip', 'dvdscreener', 'brscreener r6', 'brscreener', 'webscreener', 'dvd', 'hdrip', 'screener', 'screeer', 'webrip', 'brrip', 'dvb', 'dvdrip', 'dvdsc', 'dvdsc - r6', 'hdts', 'hdtv', 'kvcd', 'line', 'ppv', 'telesync', 'ts hq', 'ts hq proper', '480p', '720p', 'ac3', 'bluray', 'camrip', 'ddc', 'hdtv - screener', 'tc screener', 'ts screener', 'ts screener alto', 'ts screener medio', 'vhs screener']:
|
||||
extra3 = 'next'
|
||||
|
||||
else:
|
||||
itemlist.append(item.clone(action="listado", title=" " + title.capitalize(), url=scrapedurl, extra2="categorias"))
|
||||
|
||||
if extra3 == 'next':
|
||||
itemlist.append(item.clone(action="categorias", title="Otras Calidades", url=item.url + '-0-0-fx-1-1-.fx', extra2="categorias", extra3='now'))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def alfabeto(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
itemlist.append(item.clone(action="listado", title="0-9", url=item.url % "0"))
|
||||
|
||||
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.clone(action="listado", title=letra, url=item.url % letra.lower()))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def listado(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
item.category = categoria
|
||||
|
||||
#logger.debug(item)
|
||||
|
||||
curr_page = 1 # Página inicial
|
||||
last_page = 99999 # Última página inicial
|
||||
if item.curr_page:
|
||||
curr_page = int(item.curr_page) # Si viene de una pasada anterior, lo usamos
|
||||
del item.curr_page # ... y lo borramos
|
||||
if item.last_page:
|
||||
last_page = int(item.last_page) # Si viene de una pasada anterior, lo usamos
|
||||
del item.last_page # ... y lo borramos
|
||||
|
||||
cnt_tot = 40 # Poner el num. máximo de items por página
|
||||
cnt_title = 0 # Contador de líneas insertadas en Itemlist
|
||||
inicio = time.time() # Controlaremos que el proceso no exceda de un tiempo razonable
|
||||
fin = inicio + 10 # Después de este tiempo pintamos (segundos)
|
||||
timeout_search = timeout # Timeout para descargas
|
||||
if item.extra == 'search':
|
||||
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
|
||||
|
||||
#Sistema de paginado para evitar páginas vacías o semi-vacías en casos de búsquedas con series con muchos episodios
|
||||
title_lista = [] # Guarda la lista de series que ya están en Itemlist, para no duplicar lineas
|
||||
if item.title_lista: # Si viene de una pasada anterior, la lista ya estará guardada
|
||||
title_lista.extend(item.title_lista) # Se usa la lista de páginas anteriores en Item
|
||||
del item.title_lista # ... limpiamos
|
||||
|
||||
if not item.extra2: # Si viene de Catálogo o de Alfabeto
|
||||
item.extra2 = ''
|
||||
|
||||
next_page_url = item.url
|
||||
#Máximo num. de líneas permitidas por TMDB. Máx de 10 segundos por Itemlist para no degradar el rendimiento
|
||||
while cnt_title <= cnt_tot * 0.45 and curr_page <= last_page and fin > time.time():
|
||||
|
||||
# Descarga la página
|
||||
data = ''
|
||||
try:
|
||||
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)| ", "", httptools.downloadpage(next_page_url, timeout=timeout_search).data)
|
||||
data = unicode(data, "utf-8", errors="replace").encode("utf-8")
|
||||
except:
|
||||
pass
|
||||
|
||||
curr_page += 1 #Apunto ya a la página siguiente
|
||||
if not data and not item.extra2: #Si la web está caída salimos sin dar error
|
||||
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
|
||||
|
||||
#Patrón para todo, menos para Series completas, incluido búsquedas en cualquier caso
|
||||
patron = '<tr><td(?: class="[^"]+")?><a href="([^"]+)".?title="([^"]+)".*?<\/a><\/td><td(?: class="[^"]+")?>(?:<a href="[^"]+">)?(.*?)(?:<\/a>)?<\/td><td(?: class="[^"]+")?>.*?<\/td><td(?: class="[^"]+")?>(.*?)<\/td><\/tr>'
|
||||
|
||||
#Si son series completas, ponemos un patrón especializado
|
||||
if item.extra == 'series':
|
||||
patron = '<div class="[^"]+"><p class="[^"]+"><a href="([^"]+)".?title="([^"]+)"><img src="([^"]+)".*?<a href=\'[^\']+\'.?title="([^"]+)".*?<\/p><\/div>'
|
||||
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
if not matches and not '<p>Lo sentimos, pero que esta buscando algo que no esta aqui. </p>' in data and not item.extra2 and not '<h2>Sin resultados</h2> 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_episodios(item, itemlist) #Llamamos al método para el pintado del error
|
||||
return itemlist #Salimos
|
||||
|
||||
logger.error("ERROR 02: LISTADO: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
|
||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: LISTADO: 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
|
||||
|
||||
#logger.debug("PATRON: " + patron)
|
||||
#logger.debug(matches)
|
||||
#logger.debug(data)
|
||||
|
||||
#Buscamos la próxima y la última página
|
||||
patron_next = "<ul class=\"pagination\">.*?\(current\).*?href='([^']+)'>(\d+)<\/a><\/li>"
|
||||
#patron_last = "<ul class=\"pagination\">.*?\(current\).*?href='[^']+'>\d+<\/a><\/li>.*?href='[^']+\/(\d+)\/(?:\?s=[^']+)?'><span aria-hidden='[^']+'>&\w+;<\/span><\/a><\/li><\/ul><\/nav><\/div><\/div><\/div>"
|
||||
patron_last = "<ul class=\"pagination\">.*?\(current\).*?href='[^']+'>\d+<\/a><\/li>.*?href='[^']+\/(\d+)\/(?:\?[^']+)?'>(?:\d+)?(?:<span aria-hidden='[^']+'>&\w+;<\/span>)?<\/a><\/li><\/ul><\/nav><\/div><\/div><\/div>"
|
||||
|
||||
try:
|
||||
next_page_url, next_page = scrapertools.find_single_match(data, patron_next)
|
||||
next_page = int(next_page)
|
||||
except: #Si no lo encuentra, lo ponemos a 1
|
||||
#logger.error('ERROR 03: LISTADO: Al obtener la paginación: ' + patron_next + ' / ' + patron_last + ' / ' + scrapertools.find_single_match(data, "<ul class=\"pagination\">.*?<\/span><\/a><\/li><\/ul><\/nav><\/div><\/div><\/div>"))
|
||||
next_page = 1
|
||||
#logger.debug('curr_page: ' + str(curr_page) + ' / next_page: ' + str(next_page) + ' / last_page: ' + str(last_page))
|
||||
|
||||
if last_page == 99999: #Si es el valor inicial, buscamos
|
||||
try:
|
||||
last_page = int(scrapertools.find_single_match(data, patron_last)) #lo cargamos como entero
|
||||
except: #Si no lo encuentra, lo ponemos a 1
|
||||
#logger.error('ERROR 03: LISTADO: Al obtener la paginación: ' + patron_next + ' / ' + patron_last + ' / ' + scrapertools.find_single_match(data, "<ul class=\"pagination\">.*?<\/span><\/a><\/li><\/ul><\/nav><\/div><\/div><\/div>"))
|
||||
last_page = next_page
|
||||
#logger.debug('curr_page: ' + str(curr_page) + ' / next_page: ' + str(next_page) + ' / last_page: ' + str(last_page))
|
||||
|
||||
#Empezamos el procesado de matches
|
||||
for scrapedurl, scrapedtitle, cat_ppal, size in matches:
|
||||
if "/programas" in scrapedurl or "/otros" in scrapedurl:
|
||||
continue
|
||||
|
||||
title = scrapedtitle
|
||||
url = scrapedurl
|
||||
title = title.replace("á", "a").replace("é", "e").replace("í", "i").replace("ó", "o").replace("ú", "u").replace("ü", "u").replace("�", "ñ").replace("ñ", "ñ").replace("ã", "a").replace("&etilde;", "e").replace("ĩ", "i").replace("õ", "o").replace("ũ", "u").replace("ñ", "ñ").replace("’", "'")
|
||||
extra = item.extra
|
||||
|
||||
#Si es una búsqueda, convierte los episodios en Series completas, aptas para la Videoteca
|
||||
if extra == 'search' and '/series' in scrapedurl and not "Temp" in title and not "emporada" in title:
|
||||
if scrapedurl in title_lista: #Si ya hemos procesado la serie, pasamos de los episodios adicionales
|
||||
continue
|
||||
|
||||
# Descarga la página del episodio, buscando el enlace a la serie completa
|
||||
data_serie = ''
|
||||
try:
|
||||
data_serie = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)| ", "", httptools.downloadpage(scrapedurl, timeout=timeout).data)
|
||||
data = unicode(data, "utf-8", errors="replace").encode("utf-8")
|
||||
except:
|
||||
pass
|
||||
|
||||
if not data_serie: #Si la web está caída salimos sin dar error. Pintamos el episodio
|
||||
logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + scrapedurl + " / SERIE: " + scrapedurl)
|
||||
else:
|
||||
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
|
||||
extra = 'series' #es una serie completa
|
||||
title_lista += [scrapedurl] #la añadimos a la lista de series completas procesadas
|
||||
title = scrapedurl #salvamos el título de la serie completa
|
||||
else:
|
||||
url = scrapedurl #No se encuentra la Serie, se trata como Episodio suelto
|
||||
|
||||
cnt_title += 1
|
||||
item_local = item.clone() #Creamos copia de Item para trabajar
|
||||
if item_local.tipo: #... y limpiamos
|
||||
del item_local.tipo
|
||||
if item_local.totalItems:
|
||||
del item_local.totalItems
|
||||
if item_local.post_num:
|
||||
del item_local.post_num
|
||||
if item_local.category:
|
||||
del item_local.category
|
||||
if item_local.intervencion:
|
||||
del item_local.intervencion
|
||||
if item_local.viewmode:
|
||||
del item_local.viewmode
|
||||
item_local.extra2 = True
|
||||
del item_local.extra2
|
||||
item_local.text_bold = True
|
||||
del item_local.text_bold
|
||||
item_local.text_color = True
|
||||
del item_local.text_color
|
||||
if item_local.url_plus:
|
||||
del item_local.url_plus
|
||||
|
||||
title_subs = [] #creamos una lista para guardar info importante
|
||||
item_local.language = [] #creamos lista para los idiomas
|
||||
item_local.quality = '' #iniciamos calidad
|
||||
quality_alt = ''
|
||||
if 'series' in cat_ppal or extra == 'series':
|
||||
item_local.thumbnail = cat_ppal #si son series, contiene el thumb
|
||||
else:
|
||||
quality_alt = scrapedurl.lower().strip() #si no son series, contiene la calidad
|
||||
item_local.thumbnail = '' #guardamos el thumb
|
||||
item_local.extra = extra #guardamos el extra procesado
|
||||
item_local.url = url #guardamos la url final
|
||||
item_local.context = "['buscar_trailer']"
|
||||
|
||||
item_local.contentType = "movie" #por defecto, son películas
|
||||
item_local.action = "findvideos"
|
||||
|
||||
#Analizamos los formatos de la películas
|
||||
if '/peliculas/' in scrapedurl or item_local.extra == 'Películas':
|
||||
item_local.quality = 'HDRip '
|
||||
elif '/peliculas-hd' in scrapedurl or item_local.extra == 'Películas HD':
|
||||
item_local.quality = 'HD '
|
||||
elif '/peliculas-dvdr' in scrapedurl or item_local.extra == 'Películas DVDR':
|
||||
item_local.quality = 'DVDR '
|
||||
elif 'subtituladas' in cat_ppal or item_local.extra == 'VOSE' or 'vose' in title.lower():
|
||||
item_local.language += ['VOSE']
|
||||
elif 'Version Original' in cat_ppal or item_local.extra == 'VO' or 'vo' in title.lower():
|
||||
item_local.language += ['VO']
|
||||
|
||||
#Analizamos los formatos de series, temporadas y episodios
|
||||
elif '/series' in scrapedurl or item_local.extra == 'series':
|
||||
item_local.contentType = "tvshow"
|
||||
item_local.action = "episodios"
|
||||
item_local.season_colapse = True #Muestra las series agrupadas por temporadas
|
||||
elif item_local.extra == 'episodios':
|
||||
item_local.contentType = "episode"
|
||||
item_local.extra = "episodios"
|
||||
if "Temp" in title or "emporada" in title:
|
||||
try:
|
||||
item_local.contentSeason = int(scrapertools.find_single_match(title, '[t|T]emp.*?(\d+)'))
|
||||
except:
|
||||
item_local.contentSeason = 1
|
||||
title = re.sub(r'[t|T]emp.*?\d+', '', title)
|
||||
title_subs += ["Temporada"]
|
||||
item_local.contentType = "season"
|
||||
item_local.extra = "season"
|
||||
|
||||
if item_local.contentType == "movie": #para las peliculas ponemos el mismo extra
|
||||
item_local.extra = "peliculas"
|
||||
|
||||
#Detectamos idiomas
|
||||
if "latino" in scrapedurl.lower() or "latino" in title.lower():
|
||||
item_local.language += ['LAT']
|
||||
elif "vose" in scrapedurl.lower() or "vos" in scrapedurl.lower() or "vose" in title.lower() or "vos" in title.lower():
|
||||
item_local.language += ['VOSE']
|
||||
|
||||
if item_local.language == []:
|
||||
item_local.language = ['CAST']
|
||||
|
||||
#Detectamos el año
|
||||
patron = '(\d{4})\s*?(?:\)|\])?$'
|
||||
item_local.infoLabels["year"] = '-'
|
||||
year = ''
|
||||
year = scrapertools.find_single_match(title, patron)
|
||||
if year:
|
||||
title_alt = re.sub(patron, "", title)
|
||||
title_alt = title_alt.strip()
|
||||
if title_alt:
|
||||
title = title_alt
|
||||
try:
|
||||
year = int(year)
|
||||
if year >= 1970 and year <= 2040:
|
||||
item_local.infoLabels["year"] = year
|
||||
except:
|
||||
pass
|
||||
|
||||
#Detectamos info importante a guardar para después de TMDB
|
||||
if scrapertools.find_single_match(title, '[m|M].*?serie'):
|
||||
title = re.sub(r'[m|M]iniserie', '', title)
|
||||
title_subs += ["Miniserie"]
|
||||
if scrapertools.find_single_match(title, '[s|S]aga'):
|
||||
title = re.sub(r'[s|S]aga', '', title)
|
||||
title_subs += ["Saga"]
|
||||
if scrapertools.find_single_match(title, '[c|C]olecc'):
|
||||
title = re.sub(r'[c|C]olecc...', '', title)
|
||||
title_subs += ["Colección"]
|
||||
|
||||
#Empezamos a limpiar el título en varias pasadas
|
||||
patron = '\s?-?\s?(line)?\s?-\s?$'
|
||||
regex = re.compile(patron, re.I)
|
||||
title = regex.sub("", title)
|
||||
title = re.sub(r'\(\d{4}\s*?\)', '', title)
|
||||
title = re.sub(r'\[\d{4}\s*?\]', '', title)
|
||||
title = re.sub(r'[s|S]erie', '', title)
|
||||
title = re.sub(r'- $', '', title)
|
||||
title = re.sub(r'\d+[M|m|G|g][B|b]', '', title)
|
||||
|
||||
#Limpiamos el título de la basura innecesaria
|
||||
title = title.replace("Dual", "").replace("dual", "").replace("Subtitulada", "").replace("subtitulada", "").replace("Subt", "").replace("subt", "").replace("Sub", "").replace("sub", "").replace("(Proper)", "").replace("(proper)", "").replace("Proper", "").replace("proper", "").replace("#", "").replace("(Latino)", "").replace("Latino", "").replace("LATINO", "").replace("Spanish", "").replace("Trailer", "").replace("Audio", "")
|
||||
title = title.replace("HDTV-Screener", "").replace("DVDSCR", "").replace("TS ALTA", "").replace("- HDRip", "").replace("(HDRip)", "").replace("- Hdrip", "").replace("(microHD)", "").replace("(DVDRip)", "").replace("HDRip", "").replace("(BR-LINE)", "").replace("(HDTS-SCREENER)", "").replace("(BDRip)", "").replace("(BR-Screener)", "").replace("(DVDScreener)", "").replace("TS-Screener", "").replace(" TS", "").replace(" Ts", "").replace(" 480p", "").replace(" 480P", "").replace(" 720p", "").replace(" 720P", "").replace(" 1080p", "").replace(" 1080P", "").replace("DVDRip", "").replace(" Dvd", "").replace(" DVD", "").replace(" V.O", "").replace(" Unrated", "").replace(" UNRATED", "").replace(" unrated", "").replace("screener", "").replace("TS-SCREENER", "").replace("TSScreener", "").replace("HQ", "").replace("AC3 5.1", "").replace("Telesync", "").replace("Line Dubbed", "").replace("line Dubbed", "").replace("LineDuB", "").replace("Line", "").replace("XviD", "").replace("xvid", "").replace("XVID", "").replace("Mic Dubbed", "").replace("HD", "").replace("V2", "").replace("CAM", "").replace("VHS.SCR", "").replace("Dvd5", "").replace("DVD5", "").replace("Iso", "").replace("ISO", "").replace("Reparado", "").replace("reparado", "").replace("DVD9", "").replace("Dvd9", "")
|
||||
|
||||
#Obtenemos temporada y episodio si se trata de Episodios
|
||||
if item_local.contentType == "episode":
|
||||
patron = '(\d+)[x|X](\d+)'
|
||||
try:
|
||||
item_local.contentSeason, item_local.contentEpisodeNumber = scrapertools.find_single_match(title, patron)
|
||||
except:
|
||||
item_local.contentSeason = 1
|
||||
item_local.contentEpisodeNumber = 0
|
||||
|
||||
#Si son eisodios múltiples, lo extraemos
|
||||
patron1 = '\d+[x|X]\d+.?(?:y|Y|al|Al)?.?\d+[x|X](\d+)'
|
||||
epi_rango = scrapertools.find_single_match(title, patron1)
|
||||
if epi_rango:
|
||||
item_local.infoLabels['episodio_titulo'] = 'al %s' % epi_rango
|
||||
title = re.sub(patron1, '', title)
|
||||
else:
|
||||
title = re.sub(patron, '', title)
|
||||
|
||||
#Terminamos de limpiar el título
|
||||
title = re.sub(r'\??\s?\d*?\&.*', '', title)
|
||||
title = re.sub(r'[\(|\[]\s+[\)|\]]', '', title)
|
||||
title = title.replace('()', '').replace('[]', '').strip().lower().title()
|
||||
item_local.from_title = title.strip().lower().title() #Guardamos esta etiqueta para posible desambiguación de título
|
||||
|
||||
#Salvamos el título según el tipo de contenido
|
||||
if item_local.contentType == "movie":
|
||||
item_local.contentTitle = title
|
||||
else:
|
||||
item_local.contentSerieName = title.strip().lower().title()
|
||||
|
||||
if item_local.contentType == "episode":
|
||||
item_local.title = '%sx%s ' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2))
|
||||
item_local.extra3 = 'completa'
|
||||
else:
|
||||
item_local.title = title.strip().lower().title()
|
||||
|
||||
if scrapertools.find_single_match(size, '\d+.\d+\s?[g|G|m|M][b|B]'):
|
||||
size = size.replace('b', ' B').replace('B', ' B').replace('b', 'B').replace('g', 'G').replace('m', 'M').replace('.', ',')
|
||||
item_local.quality += '[%s]' % size
|
||||
|
||||
#Guarda la variable temporal que almacena la info adicional del título a ser restaurada después de TMDB
|
||||
item_local.title_subs = title_subs
|
||||
|
||||
#Salvamos y borramos el número de temporadas porque TMDB a veces hace tonterias. Lo pasamos como serie completa
|
||||
if item_local.contentSeason and (item_local.contentType == "season" or item_local.contentType == "tvshow"):
|
||||
item_local.contentSeason_save = item_local.contentSeason
|
||||
del item_local.infoLabels['season']
|
||||
|
||||
itemlist.append(item_local.clone()) #Pintar pantalla
|
||||
|
||||
#logger.debug(item_local)
|
||||
|
||||
#Pasamos a TMDB la lista completa Itemlist
|
||||
tmdb.set_infoLabels(itemlist, __modo_grafico__)
|
||||
|
||||
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
|
||||
item, itemlist = generictools.post_tmdb_listado(item, itemlist)
|
||||
|
||||
# Si es necesario añadir paginacion
|
||||
if curr_page <= last_page:
|
||||
if last_page:
|
||||
title = '%s de %s' % (curr_page-1, last_page)
|
||||
else:
|
||||
title = '%s' % curr_page-1
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="listado", title=">> Página siguiente " + title, title_lista=title_lista, url=next_page_url, extra=item.extra, extra2=item.extra2, last_page=str(last_page), curr_page=str(curr_page)))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
matches = []
|
||||
item.category = categoria
|
||||
|
||||
#logger.debug(item)
|
||||
|
||||
#Bajamos los datos de la página
|
||||
data = ''
|
||||
patron = '<a onclick="eventDownloadTorrent\(.*?\)".?class="linktorrent" href="([^"]+)">'
|
||||
if item.contentType == 'movie':
|
||||
try:
|
||||
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url, timeout=timeout).data)
|
||||
data = unicode(data, "utf-8", errors="replace").encode("utf-8")
|
||||
except:
|
||||
pass
|
||||
|
||||
if not data:
|
||||
logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url)
|
||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log'))
|
||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
if not matches: #error
|
||||
logger.error("ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web " + " / PATRON: " + patron + data)
|
||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: No hay enlaces o ha cambiado la estructura de la Web. Verificar en la Web esto último y reportar el error con el log'))
|
||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||
else:
|
||||
matches = [item.url]
|
||||
|
||||
#logger.debug("PATRON: " + patron)
|
||||
#logger.debug(matches)
|
||||
#logger.debug(data)
|
||||
|
||||
#Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB
|
||||
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
|
||||
|
||||
#Ahora tratamos los enlaces .torrent
|
||||
for scrapedurl in matches: #leemos los torrents con la diferentes calidades
|
||||
#Generamos una copia de Item para trabajar sobre ella
|
||||
item_local = item.clone()
|
||||
|
||||
#Ahora pintamos el link del Torrent
|
||||
item_local.url = scrapedurl
|
||||
if host not in item_local.url and host.replace('https', 'http') not in item_local.url :
|
||||
item_local.url = host + item_local.url
|
||||
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.quality, str(item_local.language)) #Preparamos título de Torrent
|
||||
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title) #Quitamos etiquetas vacías
|
||||
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', item_local.title) #Quitamos colores vacíos
|
||||
item_local.alive = "??" #Calidad del link sin verificar
|
||||
item_local.action = "play" #Visualizar vídeo
|
||||
item_local.server = "torrent" #Seridor Torrent
|
||||
|
||||
itemlist.append(item_local.clone()) #Pintar pantalla
|
||||
|
||||
#logger.debug("TORRENT: " + scrapedurl + " / title gen/torr: " + item.title + " / " + item_local.title + " / calidad: " + item_local.quality + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
|
||||
#logger.debug(item_local)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def episodios(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
item.category = categoria
|
||||
|
||||
logger.debug(item)
|
||||
|
||||
if item.from_title:
|
||||
item.title = item.from_title
|
||||
|
||||
#Limpiamos num. Temporada y Episodio que ha podido quedar por Novedades
|
||||
season_display = 0
|
||||
if item.contentSeason:
|
||||
if item.season_colapse: #Si viene del menú de Temporadas...
|
||||
season_display = item.contentSeason #... salvamos el num de sesión a pintar
|
||||
item.from_num_season_colapse = season_display
|
||||
del item.season_colapse
|
||||
item.contentType = "tvshow"
|
||||
if item.from_title_season_colapse:
|
||||
item.title = item.from_title_season_colapse
|
||||
del item.from_title_season_colapse
|
||||
if item.infoLabels['title']:
|
||||
del item.infoLabels['title']
|
||||
del item.infoLabels['season']
|
||||
if item.contentEpisodeNumber:
|
||||
del item.infoLabels['episode']
|
||||
if season_display == 0 and item.from_num_season_colapse:
|
||||
season_display = item.from_num_season_colapse
|
||||
|
||||
# Obtener la información actualizada de la Serie. TMDB es imprescindible para Videoteca
|
||||
if not item.infoLabels['tmdb_id']:
|
||||
tmdb.set_infoLabels(item, True)
|
||||
|
||||
modo_ultima_temp_alt = modo_ultima_temp
|
||||
if item.ow_force == "1": #Si hay un traspaso de canal o url, se actualiza todo
|
||||
modo_ultima_temp_alt = False
|
||||
|
||||
max_temp = 1
|
||||
if item.infoLabels['number_of_seasons']:
|
||||
max_temp = item.infoLabels['number_of_seasons']
|
||||
y = []
|
||||
if modo_ultima_temp_alt and item.library_playcounts: #Averiguar cuantas temporadas hay en Videoteca
|
||||
patron = 'season (\d+)'
|
||||
matches = re.compile(patron, re.DOTALL).findall(str(item.library_playcounts))
|
||||
for x in matches:
|
||||
y += [int(x)]
|
||||
max_temp = max(y)
|
||||
|
||||
# Descarga la página
|
||||
data = '' #Inserto en num de página en la url
|
||||
try:
|
||||
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)| ", "", httptools.downloadpage(item.url, timeout=timeout).data)
|
||||
data = unicode(data, "utf-8", errors="replace").encode("utf-8")
|
||||
except: #Algún error de proceso, salimos
|
||||
pass
|
||||
|
||||
if not data:
|
||||
logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea" + item.url)
|
||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: EPISODIOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log'))
|
||||
return itemlist
|
||||
|
||||
#Usamos el mismo patrón que en listado
|
||||
patron = '<tr><td><img src="[^"]+".*?title="Idioma Capitulo" \/>(.*?)<a onclick="[^"]+".?href="[^"]+".?title="[^"]*">(.*?)<\/a><\/td><td><a href="([^"]+)".?title="[^"]*".?onclick="[^"]+".?<img src="([^"]+)".*?<\/a><\/td><td>.*?<\/td><\/tr>'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
if not matches: #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_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)
|
||||
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
|
||||
|
||||
logger.debug("PATRON: " + patron)
|
||||
logger.debug(matches)
|
||||
#logger.debug(data)
|
||||
|
||||
season = max_temp
|
||||
#Comprobamos si realmente sabemos el num. máximo de temporadas
|
||||
if item.library_playcounts or (item.infoLabels['number_of_seasons'] and item.tmdb_stat):
|
||||
num_temporadas_flag = True
|
||||
else:
|
||||
num_temporadas_flag = False
|
||||
|
||||
# Recorremos todos los episodios generando un Item local por cada uno en Itemlist
|
||||
for language, scrapedtitle, scrapedurl, scrapedthumbnail in matches:
|
||||
item_local = item.clone()
|
||||
item_local.action = "findvideos"
|
||||
item_local.contentType = "episode"
|
||||
item_local.extra = "episodios"
|
||||
if item_local.library_playcounts:
|
||||
del item_local.library_playcounts
|
||||
if item_local.library_urls:
|
||||
del item_local.library_urls
|
||||
if item_local.path:
|
||||
del item_local.path
|
||||
if item_local.update_last:
|
||||
del item_local.update_last
|
||||
if item_local.update_next:
|
||||
del item_local.update_next
|
||||
if item_local.channel_host:
|
||||
del item_local.channel_host
|
||||
if item_local.active:
|
||||
del item_local.active
|
||||
if item_local.contentTitle:
|
||||
del item_local.infoLabels['title']
|
||||
if item_local.season_colapse:
|
||||
del item_local.season_colapse
|
||||
|
||||
item_local.title = ''
|
||||
item_local.context = "['buscar_trailer']"
|
||||
item_local.url = scrapedurl
|
||||
title = scrapedtitle
|
||||
item_local.language = []
|
||||
|
||||
lang = language.strip()
|
||||
if not lang:
|
||||
item_local.language += ['CAST']
|
||||
elif 'vo' in lang.lower() or 'v.o' in lang.lower() or 'vo' in title.lower() or 'v.o' in title.lower():
|
||||
item_local.language += ['VO']
|
||||
elif 'vose' in lang.lower() or 'v.o.s.e' in lang.lower() or 'vose' in title.lower() or 'v.o.s.e' in title.lower():
|
||||
item_local.language += ['VOSE']
|
||||
elif 'latino' in lang.lower() or 'latino' in title.lower():
|
||||
item_local.language += ['LAT']
|
||||
|
||||
try:
|
||||
item_local.contentEpisodeNumber = 0
|
||||
if 'miniserie' in title.lower():
|
||||
item_local.contentSeason = 1
|
||||
title = title.replace('miniserie', '').replace('MiniSerie', '')
|
||||
elif 'completa' in title.lower():
|
||||
patron = '[t|T].*?(\d+) [c|C]ompleta'
|
||||
if scrapertools.find_single_match(title, patron):
|
||||
item_local.contentSeason = int(scrapertools.find_single_match(title, patron))
|
||||
if not item_local.contentSeason:
|
||||
#Extraemos los episodios
|
||||
patron = '(\d{1,2})[x|X](\d{1,2})'
|
||||
item_local.contentSeason, item_local.contentEpisodeNumber = scrapertools.find_single_match(title, patron)
|
||||
item_local.contentSeason = int(item_local.contentSeason)
|
||||
item_local.contentEpisodeNumber = int(item_local.contentEpisodeNumber)
|
||||
except:
|
||||
logger.error('ERROR al extraer Temporada/Episodio: ' + title)
|
||||
item_local.contentSeason = 1
|
||||
item_local.contentEpisodeNumber = 0
|
||||
|
||||
#Si son eisodios múltiples, lo extraemos
|
||||
patron1 = '\d+[x|X]\d{1,2}.?(?:y|Y|al|Al)?(?:\d+[x|X]\d{1,2})?.?(?:y|Y|al|Al)?.?\d+[x|X](\d{1,2})'
|
||||
epi_rango = scrapertools.find_single_match(title, patron1)
|
||||
if epi_rango:
|
||||
item_local.infoLabels['episodio_titulo'] = 'al %s' % epi_rango
|
||||
item_local.title = '%sx%s al %s -' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2), str(epi_rango).zfill(2))
|
||||
else:
|
||||
item_local.title = '%sx%s -' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2))
|
||||
|
||||
if modo_ultima_temp_alt and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca
|
||||
if item_local.contentSeason < max_temp:
|
||||
break #Sale del bucle actual del FOR
|
||||
|
||||
if season_display > 0:
|
||||
if item_local.contentSeason > season_display:
|
||||
continue
|
||||
elif item_local.contentSeason < season_display:
|
||||
break
|
||||
|
||||
itemlist.append(item_local.clone())
|
||||
|
||||
#logger.debug(item_local)
|
||||
|
||||
if len(itemlist) > 1:
|
||||
itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) #clasificamos
|
||||
|
||||
if item.season_colapse and not item.add_videolibrary: #Si viene de listado, mostramos solo Temporadas
|
||||
item, itemlist = generictools.post_tmdb_seasons(item, itemlist)
|
||||
|
||||
if not item.season_colapse: #Si no es pantalla de Temporadas, pintamos todo
|
||||
# Pasada por TMDB y clasificación de lista por temporada y episodio
|
||||
tmdb.set_infoLabels(itemlist, True)
|
||||
|
||||
#Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB
|
||||
item, itemlist = generictools.post_tmdb_episodios(item, itemlist)
|
||||
|
||||
#logger.debug(item)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def actualizar_titulos(item):
|
||||
logger.info()
|
||||
|
||||
item = generictools.update_title(item) #Llamamos al método que actualiza el título con tmdb.find_and_set_infoLabels
|
||||
|
||||
#Volvemos a la siguiente acción en el canal
|
||||
return item
|
||||
|
||||
|
||||
def search(item, texto):
|
||||
logger.info()
|
||||
#texto = texto.replace(" ", "+")
|
||||
|
||||
try:
|
||||
item.url = item.url % texto
|
||||
|
||||
if texto != '':
|
||||
return listado(item)
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
logger.error("{0}".format(line))
|
||||
return []
|
||||
|
||||
|
||||
def newest(categoria):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
item = Item()
|
||||
|
||||
try:
|
||||
if categoria == 'peliculas':
|
||||
item.url = host + "peliculas-dvdr/"
|
||||
item.extra = "Películas DVDR"
|
||||
item.channel = channel
|
||||
item.category_new= 'newest'
|
||||
|
||||
itemlist = listado(item)
|
||||
if ">> Página siguiente" in itemlist[-1].title:
|
||||
itemlist.pop()
|
||||
|
||||
# Se captura la excepción, para no interrumpir al canal novedades si un canal falla
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
logger.error("{0}".format(line))
|
||||
return []
|
||||
|
||||
return itemlist
|
||||
@@ -11,7 +11,7 @@ from core import httptools
|
||||
from core import scrapertools
|
||||
from core import servertools
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
from platformcode import config, logger, platformtools
|
||||
from core import tmdb
|
||||
from lib import generictools
|
||||
|
||||
@@ -73,9 +73,9 @@ def submenu(item):
|
||||
|
||||
if item.extra == "series":
|
||||
|
||||
itemlist.append(item.clone(title="Series completas:", action="listado", url=item.url + "descarga-0-58122-0-0-fx-1-1-.fx", thumbnail=thumb_series_VOD, extra="series"))
|
||||
itemlist.append(item.clone(title="Series completas", action="listado", url=item.url + "descarga-0-58122-0-0-fx-1-1-.fx", thumbnail=thumb_series_VOD, extra="series"))
|
||||
itemlist.append(item.clone(title="Nuevos episodios", action="listado", url=item.url + "descarga-0-58122-0-0-fx-1-1-.fx", thumbnail=thumb_series, extra="episodios"))
|
||||
itemlist.append(item.clone(title=" - Año", action="search", url=item.url + "descarga-0-58122-0-%s-fx-1-1-.fx", thumbnail=thumb_series, extra="episodios"))
|
||||
itemlist.append(item.clone(title=" - Año", action="year", url=item.url + "descarga-0-58122-0-%s-fx-1-1-.fx", thumbnail=thumb_series, extra="episodios"))
|
||||
itemlist.append(item.clone(title=" - Alfabético A-Z", action="alfabeto", url=item.url + "descarga-0-58122-0-0-%s-1-1-.fx", thumbnail=thumb_series, extra="episodios"))
|
||||
|
||||
return itemlist
|
||||
@@ -127,8 +127,8 @@ def categorias(item):
|
||||
|
||||
#Insertamos las cabeceras para todas las peliculas de la Aalidad, por Año, Alfabético, por Género, y Otras Calidades
|
||||
if not extra3:
|
||||
itemlist.append(item.clone(title=item.extra.upper(), action="listado", url=item.url + '-0-0-fx-1-1-.fx'))
|
||||
itemlist.append(item.clone(title="Año", action="search", url=item.url + '-0-%s-fx-1-1-.fx'))
|
||||
itemlist.append(item.clone(title="Todas las Películas de " + item.extra.upper(), action="listado", url=item.url + '-0-0-fx-1-1-.fx'))
|
||||
itemlist.append(item.clone(title="Año", action="year", url=item.url + '-0-%s-fx-1-1-.fx'))
|
||||
itemlist.append(item.clone(title="Alfabético A-Z", action="alfabeto", url=item.url + '-0-0-%s-1-1-.fx'))
|
||||
itemlist.append(item.clone(title="Géneros", url=item.url + '-0-0-fx-1-1-.fx'))
|
||||
|
||||
@@ -678,11 +678,14 @@ def findvideos(item):
|
||||
|
||||
item_local.url = scrapedurl #Guardamos la url intermedia
|
||||
|
||||
item_local.quality = ''
|
||||
if scrapedquality and not '--' in scrapedquality: #Salvamos la calidad, si la hay
|
||||
item_local.quality = scrapedquality.lower().capitalize()
|
||||
|
||||
if scrapertools.find_single_match(item.quality, '(\[\d+:\d+ h\])'): #Salvamos la duración
|
||||
item_local.quality += ' [COLOR white]%s' % scrapertools.find_single_match(item.quality, '(\[\d+:\d+ h\])') #Copiamos la duración
|
||||
if not item_local.quality:
|
||||
item_local.quality = item.quality
|
||||
elif scrapertools.find_single_match(item.quality, '(\[\d+:\d+ h\])'): #Salvamos la duración
|
||||
item_local.quality += ' [/COLOR][COLOR white]%s' % scrapertools.find_single_match(item.quality, '(\[\d+:\d+ h\])') #Copiamos duración
|
||||
|
||||
if scrapedlang in IDIOMAS: #Salvamos el idioma, si lo hay
|
||||
item_local.language = ["%s" % IDIOMAS[scrapedlang]]
|
||||
@@ -770,11 +773,14 @@ def findvideos(item):
|
||||
|
||||
item_local.url = scrapedurl #Guardamos la url intermedia
|
||||
|
||||
item_local.quality = ''
|
||||
if scrapedquality:
|
||||
item_local.quality = scrapedquality
|
||||
|
||||
if scrapertools.find_single_match(item.quality, '(\[\d+:\d+ h\])'): #Salvamos la duración
|
||||
item_local.quality += ' [COLOR white]%s' % scrapertools.find_single_match(item.quality, '(\[\d+:\d+ h\])') #Copiamos la duración
|
||||
if not item_local.quality:
|
||||
item_local.quality = item.quality
|
||||
elif scrapertools.find_single_match(item.quality, '(\[\d+:\d+ h\])'): #Salvamos la duración
|
||||
item_local.quality += ' [/COLOR][COLOR white]%s' % scrapertools.find_single_match(item.quality, '(\[\d+:\d+ h\])') #Copiamos duración
|
||||
|
||||
if scrapedlang in IDIOMAS:
|
||||
item_local.language = ["%s" % IDIOMAS[scrapedlang]] #Salvamos el idioma, si lo hay
|
||||
@@ -855,6 +861,7 @@ def findvideos(item):
|
||||
quality = '[%s] %s' % (capitulo, quality)
|
||||
|
||||
#Verificamos el si el enlace del servidor está activo
|
||||
mostrar_server = True
|
||||
if config.get_setting("hidepremium"): #Si no se aceptan servidore premium, se ignoran
|
||||
mostrar_server = servertools.is_server_enabled(servidor)
|
||||
|
||||
@@ -868,9 +875,9 @@ def findvideos(item):
|
||||
|
||||
item_local.alive = servertools.check_video_link(enlace, servidor, timeout=timeout) #activo el link ?
|
||||
#Si el link no está activo se ignora
|
||||
if item_local.alive == "??": #dudoso
|
||||
if "??" in item_local.alive: #dudoso
|
||||
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][%s][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (servidor.capitalize(), quality, str(item_local.language))
|
||||
elif item_local.alive.lower() == "no": #No está activo. Lo preparo, pero no lo pinto
|
||||
elif "no" in item_local.alive.lower(): #No está activo. Lo preparo, pero no lo pinto
|
||||
item_local.title = '[COLOR red][%s][/COLOR] [COLOR yellow][%s][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.alive, servidor.capitalize(), quality, str(item_local.language))
|
||||
logger.debug(item_local.alive + ": ALIVE / " + servidor + " / " + enlace)
|
||||
raise
|
||||
@@ -879,7 +886,6 @@ def findvideos(item):
|
||||
|
||||
#Ahora pintamos el link Directo
|
||||
item_local.url = enlace
|
||||
item_local.title = '[COLOR yellow][%s][/COLOR] [COLOR yellow][%s][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.alive, servidor.capitalize(), quality, str(item_local.language)) #Preparamos título de Directo
|
||||
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title) #Quitamos etiquetas vacías
|
||||
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', item_local.title) #Quitamos colores vacíos
|
||||
item_local.action = "play" #Visualizar vídeo
|
||||
@@ -887,7 +893,7 @@ def findvideos(item):
|
||||
|
||||
itemlist_alt.append(item_local.clone(quality=quality)) #Pintar pantalla
|
||||
except:
|
||||
pass
|
||||
logger.error('ERROR al procesar enlaces DIRECTOS: ' + servidor + ' / ' + scrapedenlace)
|
||||
|
||||
#logger.debug("DIRECTO: " + scrapedenlace + " / title gen/torr: " + item.title + " / " + item_local.title + " / calidad: " + item_local.quality + " / tamaño: " + scrapedsize + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
|
||||
#logger.debug(item_local)
|
||||
@@ -1055,9 +1061,9 @@ def episodios(item):
|
||||
elif 'completa' in title.lower():
|
||||
patron = '[t|T]emporada (\d+) [c|C]ompleta'
|
||||
item_local.contentSeason = int(scrapertools.find_single_match(title, patron))
|
||||
else:
|
||||
if not item_local.contentSeason:
|
||||
#Extraemos los episodios
|
||||
patron = '(\d+)[x|X](\d{1,2})'
|
||||
patron = '(\d{1,2})[x|X](\d{1,2})'
|
||||
item_local.contentSeason, item_local.contentEpisodeNumber = scrapertools.find_single_match(title, patron)
|
||||
item_local.contentSeason = int(item_local.contentSeason)
|
||||
item_local.contentEpisodeNumber = int(item_local.contentEpisodeNumber)
|
||||
@@ -1116,6 +1122,17 @@ def actualizar_titulos(item):
|
||||
return item
|
||||
|
||||
|
||||
def year(item):
|
||||
logger.info()
|
||||
|
||||
texto = platformtools.dialog_numeric(0, heading='Año a buscar')
|
||||
|
||||
item.url = item.url % texto
|
||||
|
||||
if texto != '' and texto != None:
|
||||
return listado(item)
|
||||
|
||||
|
||||
def search(item, texto):
|
||||
logger.info()
|
||||
#texto = texto.replace(" ", "+")
|
||||
|
||||
@@ -35,28 +35,28 @@ def mainlist(item):
|
||||
autoplay.init(item.channel, list_servers, list_quality)
|
||||
itemlist = []
|
||||
|
||||
itemlist.append(item.clone(title="Novedades", action="entradas", url="http://www.inkapelis.com/",
|
||||
itemlist.append(Item(channel=item.channel, title="Novedades", action="entradas", url="http://www.inkapelis.com/",
|
||||
extra="Novedades", text_color=color1, thumbnail=get_thumb('newest', auto=True)))
|
||||
#itemlist.append(item.clone(title="Estrenos", action="entradas", url="http://www.inkapelis.com/genero/estrenos/",
|
||||
#itemlist.append(Item(channel=item.channel, title="Estrenos", action="entradas", url="http://www.inkapelis.com/genero/estrenos/",
|
||||
# text_color=color1, thumbnail=get_thumb('premieres', auto=True)))
|
||||
itemlist.append(item.clone(title="Castellano", action="entradas",
|
||||
itemlist.append(Item(channel=item.channel, title="Castellano", action="entradas",
|
||||
url="https://www.inkapelis.com/?anio=&genero=&calidad=&idioma=Castellano&s=",
|
||||
extra="Buscar", text_color=color1, thumbnail=get_thumb('espanolas', auto=True)))
|
||||
|
||||
itemlist.append(item.clone(title="Latino", action="entradas",
|
||||
itemlist.append(Item(channel=item.channel, title="Latino", action="entradas",
|
||||
url="https://www.inkapelis.com/?anio=&genero=&calidad=&idioma=Latino&s=",
|
||||
extra="Buscar", text_color=color1, thumbnail=get_thumb('latino', auto=True)))
|
||||
|
||||
itemlist.append(item.clone(title="VOSE", action="entradas",
|
||||
itemlist.append(Item(channel=item.channel, title="VOSE", action="entradas",
|
||||
url="https://www.inkapelis.com/?anio=&genero=&calidad=&idioma=Subtitulada&s=",
|
||||
extra="Buscar", text_color=color1, thumbnail=get_thumb('newest', auto=True)))
|
||||
|
||||
itemlist.append(item.clone(title="Géneros", action="generos", url="http://www.inkapelis.com/", text_color=color1,
|
||||
itemlist.append(Item(channel=item.channel, title="Géneros", action="generos", url="http://www.inkapelis.com/", text_color=color1,
|
||||
thumbnail=get_thumb('genres', auto=True),))
|
||||
itemlist.append(item.clone(title="Buscar...", action="", text_color=color1))
|
||||
itemlist.append(item.clone(action="", title=""))
|
||||
itemlist.append(Item(channel=item.channel, title="Buscar...", action="", text_color=color1))
|
||||
itemlist.append(Item(channel=item.channel, action="", title=""))
|
||||
itemlist.append(
|
||||
item.clone(action="filtro", title="Filtrar películas", url="http://www.inkapelis.com/?s=", text_color=color1))
|
||||
Item(channel=item.channel, action="filtro", title="Filtrar películas", url="http://www.inkapelis.com/?s=", text_color=color1))
|
||||
# Filtros personalizados para peliculas
|
||||
for i in range(1, 4):
|
||||
filtros = config.get_setting("pers_peliculas" + str(i), item.channel)
|
||||
@@ -66,7 +66,7 @@ def mainlist(item):
|
||||
new_item.values = filtros
|
||||
itemlist.append(
|
||||
new_item.clone(action="filtro", title=title, url="http://www.inkapelis.com/?s=", text_color=color2))
|
||||
itemlist.append(item.clone(action="configuracion", title="Configurar canal...", text_color="gold", folder=False))
|
||||
itemlist.append(Item(channel=item.channel, action="configuracion", title="Configurar canal...", text_color="gold", folder=False))
|
||||
|
||||
autoplay.show_option(item.channel, itemlist)
|
||||
|
||||
@@ -284,7 +284,7 @@ def entradas(item):
|
||||
title = scrapedtitle
|
||||
calidad = calidad.strip()
|
||||
|
||||
itemlist.append(item.clone(action="findvideos", title=title, url=scrapedurl, thumbnail=thumbnail,
|
||||
itemlist.append(Item(channel=item.channel, action="findvideos", title=title, url=scrapedurl, thumbnail=thumbnail,
|
||||
contentTitle=scrapedtitle, fulltitle=scrapedtitle,
|
||||
context=["buscar_trailer"],
|
||||
contentType="movie"))
|
||||
@@ -326,7 +326,7 @@ def entradas(item):
|
||||
filtro_list = {"poster_path": filtro_thumb}
|
||||
filtro_list = filtro_list.items()
|
||||
|
||||
itemlist.append(item.clone(action="findvideos", title=title, url=url, contentTitle=scrapedtitle,
|
||||
itemlist.append(Item(channel=item.channel, action="findvideos", title=title, url=url, contentTitle=scrapedtitle,
|
||||
fulltitle=scrapedtitle, thumbnail=thumbnail, context=["buscar_trailer"],
|
||||
contentType="movie", infoLabels={'filtro': filtro_list}))
|
||||
|
||||
@@ -337,7 +337,7 @@ def entradas(item):
|
||||
if next_page:
|
||||
if item.extra == "Buscar":
|
||||
next_page = next_page.replace('&', '&')
|
||||
itemlist.append(item.clone(action="entradas", title="Siguiente", url=next_page, text_color=color3))
|
||||
itemlist.append(Item(channel=item.channel, action="entradas", title="Siguiente", url=next_page, text_color=color3))
|
||||
|
||||
return itemlist
|
||||
|
||||
@@ -360,13 +360,13 @@ def eroticas(item):
|
||||
title = scrapedtitle + " [" + idioma + "] [" + calidad + "]"
|
||||
thumbnail = scrapedthumbnail.replace("w185", "original")
|
||||
|
||||
itemlist.append(item.clone(action="findvideos", title=title, url=url, thumbnail=thumbnail,
|
||||
itemlist.append(Item(channel=item.channel, action="findvideos", title=title, url=url, thumbnail=thumbnail,
|
||||
extra="eroticas"))
|
||||
|
||||
# Extrae la marca de la siguiente página
|
||||
next_page = scrapertools.find_single_match(data, '<span class="current">.*?<\/span><a href="([^"]+)"')
|
||||
if next_page:
|
||||
itemlist.append(item.clone(action="entradas", title="Siguiente", url=next_page))
|
||||
itemlist.append(Item(channel=item.channel, action="entradas", title="Siguiente", url=next_page))
|
||||
|
||||
return itemlist
|
||||
|
||||
@@ -406,7 +406,7 @@ def findvideos(item):
|
||||
if server == "Ul":
|
||||
server = "Uploaded"
|
||||
title = "%s [%s][%s]" % (server, idioma, calidad)
|
||||
itemlist.append(item.clone(action="play", title=title, url=url, language=idioma, quality=calidad,
|
||||
itemlist.append(Item(channel=item.channel, action="play", title=title, url=url, language=idioma, quality=calidad,
|
||||
server=server, infoLabels=item.infoLabels))
|
||||
|
||||
patron = 'id="(embed[0-9]*)".*?<div class="calishow">(.*?)<.*?src="([^"]+)"'
|
||||
@@ -417,7 +417,7 @@ def findvideos(item):
|
||||
title = "Directo"
|
||||
idioma = scrapertools.find_single_match(data, 'href="#%s".*?>([^<]+)<' % id_embed)
|
||||
title = "%s [%s][%s]" % (title.capitalize(), idioma, calidad)
|
||||
itemlist.append(item.clone(action="play", title=title, url=url, language=idioma, quality=calidad,
|
||||
itemlist.append(Item(channel=item.channel, action="play", title=title, url=url, language=idioma, quality=calidad,
|
||||
server=server))
|
||||
# Requerido para FilterTools
|
||||
|
||||
|
||||
@@ -1,60 +1,46 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
import urlparse
|
||||
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from core import servertools
|
||||
from core import tmdb
|
||||
from core.item import Item
|
||||
from platformcode import logger
|
||||
|
||||
host = "https://jkanime.net"
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = list()
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="ultimos_capitulos", title="Últimos Capitulos", url="http://jkanime.net/"))
|
||||
itemlist.append(Item(channel=item.channel, action="ultimos", title="Últimos", url="http://jkanime.net/"))
|
||||
itemlist.append(Item(channel=item.channel, action="letras", title="Listado Alfabetico", url="http://jkanime.net/"))
|
||||
itemlist.append(Item(channel=item.channel, action="generos", title="Listado por Genero", url="http://jkanime.net/"))
|
||||
itemlist.append(Item(channel=item.channel, action="ultimas_series", title="Últimas Series", url=host))
|
||||
itemlist.append(Item(channel=item.channel, action="ultimos_episodios", title="Últimos Episodios", url=host))
|
||||
itemlist.append(Item(channel=item.channel, action="p_tipo", title="Listado Alfabetico", url=host, extra="Animes por letra"))
|
||||
itemlist.append(Item(channel=item.channel, action="p_tipo", title="Listado por Genero", url=host, extra="Animes por Genero"))
|
||||
itemlist.append(Item(channel=item.channel, action="search", title="Buscar"))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def ultimos_capitulos(item):
|
||||
def ultimas_series(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = scrapertools.get_match(data, '<ul class="ratedul">.+?</ul>')
|
||||
|
||||
data = data.replace('\t', '')
|
||||
data = data.replace('\n', '')
|
||||
data = data.replace('/thumbnail/', '/image/')
|
||||
|
||||
patron = '<img src="(http://cdn.jkanime.net/assets/images/animes/.+?)" .+?href="(.+?)">(.+?)<.+?span>(.+?)<'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedthumb, scrapedurl, scrapedtitle, scrapedepisode in matches:
|
||||
title = scrapedtitle.strip() + scrapedepisode
|
||||
url = urlparse.urljoin(item.url, scrapedurl)
|
||||
thumbnail = scrapedthumb
|
||||
plot = ""
|
||||
logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]")
|
||||
|
||||
data = scrapertools.find_single_match(data, 'Últimos capitulos agregados.*?/div><!-- .content-box -->')
|
||||
patron = '<a title="([^"]+).*?'
|
||||
patron += 'href="([^"]+)".*?'
|
||||
patron += 'src="([^"]+)'
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for scrapedtitle, scrapedurl, scrapedthumbnail in matches:
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="findvideos", title=title, url=url, thumbnail=thumbnail, plot=plot,
|
||||
show=scrapedtitle.strip(), fulltitle=title))
|
||||
|
||||
Item(channel=item.channel, action="episodios", title=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail,
|
||||
show=scrapedtitle))
|
||||
tmdb.set_infoLabels(itemlist)
|
||||
return itemlist
|
||||
|
||||
|
||||
def search(item, texto):
|
||||
logger.info()
|
||||
if item.url == "":
|
||||
item.url = "http://jkanime.net/buscar/%s/"
|
||||
item.url = host + "/buscar/%s/"
|
||||
texto = texto.replace(" ", "+")
|
||||
item.url = item.url % texto
|
||||
try:
|
||||
@@ -67,127 +53,77 @@ def search(item, texto):
|
||||
return []
|
||||
|
||||
|
||||
def ultimos(item):
|
||||
def ultimos_episodios(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = scrapertools.get_match(data, '<ul class="latestul">(.*?)</ul>')
|
||||
|
||||
patron = '<a href="([^"]+)">([^<]+)<'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
title = scrapedtitle.strip()
|
||||
url = urlparse.urljoin(item.url, scrapedurl)
|
||||
thumbnail = ""
|
||||
plot = ""
|
||||
logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]")
|
||||
|
||||
#data = scrapertools.find_single_match(data, '<ul class="latestul">(.*?)</ul>')
|
||||
patron = '<a class="odd" title="([^"]+).*?'
|
||||
patron += 'href="([^"]+)".*?'
|
||||
patron += 'img src="([^"]+)".*?'
|
||||
patron += 'Episodio.*?(\d+)'
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for scrapedtitle, scrapedurl, scrapedthumbnail, scrapedepisode in matches:
|
||||
title = scrapedtitle + " - Episodio " + scrapedepisode
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="episodios", title=title, url=url, thumbnail=thumbnail, plot=plot))
|
||||
|
||||
Item(channel=item.channel, action="findvideos", title=title, url=scrapedurl, thumbnail=scrapedthumbnail,
|
||||
show=scrapedtitle))
|
||||
tmdb.set_infoLabels(itemlist)
|
||||
return itemlist
|
||||
|
||||
|
||||
def generos(item):
|
||||
def p_tipo(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = scrapertools.get_match(data, '<div class="genres">(.*?)</div>')
|
||||
|
||||
patron = '<a href="([^"]+)">([^<]+)</a>'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
data = scrapertools.find_single_match(data, '<h3>%s(.*?)</ul>' %item.extra)
|
||||
patron = 'href="([^"]+)".*?'
|
||||
patron += 'title.*?>([^<]+)</a>'
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
title = scrapedtitle
|
||||
url = urlparse.urljoin(item.url, scrapedurl)
|
||||
thumbnail = ""
|
||||
plot = ""
|
||||
logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]")
|
||||
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="series", title=title, url=url, thumbnail=thumbnail, plot=plot,
|
||||
viewmode="movie_with_plot"))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def letras(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = scrapertools.get_match(data, '<ul class="animelet">(.*?)</ul>')
|
||||
|
||||
patron = '<a href="([^"]+)">([^<]+)</a>'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
title = scrapedtitle
|
||||
url = urlparse.urljoin(item.url, scrapedurl)
|
||||
thumbnail = ""
|
||||
plot = ""
|
||||
logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]")
|
||||
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="series", title=title, url=url, thumbnail=thumbnail, plot=plot,
|
||||
viewmode="movie_with_plot"))
|
||||
|
||||
if "Por Genero" not in scrapedtitle:
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="series", title=scrapedtitle, url=host + scrapedurl,
|
||||
viewmode="movie_with_plot"))
|
||||
return itemlist
|
||||
|
||||
|
||||
def series(item):
|
||||
logger.info()
|
||||
|
||||
# Descarga la pagina
|
||||
data = httptools.downloadpage(item.url).data
|
||||
|
||||
# Extrae las entradas
|
||||
patron = '<table class="search[^<]+'
|
||||
patron += '<tr[^<]+'
|
||||
patron += '<td[^<]+'
|
||||
patron += '<a href="([^"]+)"><img src="([^"]+)"[^<]+</a>[^<]+'
|
||||
patron += '</td>[^<]+'
|
||||
patron += '<td><a[^>]+>([^<]+)</a></td>[^<]+'
|
||||
patron += '<td[^>]+>([^<]+)</td>[^<]+'
|
||||
patron += '<td[^>]+>([^<]+)</td>[^<]+'
|
||||
patron += '</tr>[^<]+'
|
||||
patron += '<tr>[^<]+'
|
||||
patron += '<td>(.*?)</td>'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
patron = '(?is)let-post.*?src="([^"]+).*?'
|
||||
patron += 'alt="([^"]+).*?'
|
||||
patron += 'href="([^"]+).*?'
|
||||
patron += '<p>([^\<]+).*?'
|
||||
patron += 'eps-num">([^<]+)'
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
itemlist = []
|
||||
|
||||
for scrapedurl, scrapedthumbnail, scrapedtitle, line1, line2, scrapedplot in matches:
|
||||
title = scrapedtitle.strip() + " (" + line1.strip() + ") (" + line2.strip() + ")"
|
||||
extra = line2.strip()
|
||||
url = urlparse.urljoin(item.url, scrapedurl)
|
||||
thumbnail = urlparse.urljoin(item.url, scrapedthumbnail)
|
||||
thumbnail = thumbnail.replace("thumbnail", "image")
|
||||
for scrapedthumbnail, scrapedtitle, scrapedurl, scrapedplot, scrapedepisode in matches:
|
||||
title = scrapedtitle + " (" + scrapedepisode + ")"
|
||||
scrapedthumbnail = scrapedthumbnail.replace("thumbnail", "image")
|
||||
plot = scrapertools.htmlclean(scrapedplot)
|
||||
logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]")
|
||||
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="episodios", title=title, url=url, thumbnail=thumbnail, fanart=thumbnail,
|
||||
plot=plot, extra=extra, show=scrapedtitle.strip()))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="episodios", title=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail, fanart=scrapedthumbnail,
|
||||
plot=scrapedplot, show=scrapedtitle))
|
||||
tmdb.set_infoLabels(itemlist)
|
||||
try:
|
||||
siguiente = scrapertools.get_match(data, '<a class="listsiguiente" href="([^"]+)" >Resultados Siguientes')
|
||||
scrapedurl = urlparse.urljoin(item.url, siguiente)
|
||||
siguiente = scrapertools.find_single_match(data, '<a class="listsiguiente" href="([^"]+)" >Resultados Siguientes')
|
||||
scrapedurl = item.url + siguiente
|
||||
scrapedtitle = ">> Pagina Siguiente"
|
||||
scrapedthumbnail = ""
|
||||
scrapedplot = ""
|
||||
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="series", title=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail,
|
||||
plot=scrapedplot, folder=True, viewmode="movie_with_plot"))
|
||||
if len(itemlist)>0:
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="series", title=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail,
|
||||
plot=scrapedplot, folder=True, viewmode="movie_with_plot"))
|
||||
except:
|
||||
pass
|
||||
return itemlist
|
||||
|
||||
|
||||
def get_pages_and_episodes(data):
|
||||
results = re.findall('href="#pag([0-9]+)">[0-9]+ - ([0-9]+)', data)
|
||||
results = scrapertools.find_multiple_matches(data, 'href="#pag([0-9]+)".*?>[0-9]+ - ([0-9]+)')
|
||||
if results:
|
||||
return int(results[-1][0]), int(results[-1][1])
|
||||
return 1, 0
|
||||
@@ -196,14 +132,11 @@ def get_pages_and_episodes(data):
|
||||
def episodios(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
# Descarga la pagina
|
||||
data = httptools.downloadpage(item.url).data
|
||||
|
||||
scrapedplot = scrapertools.get_match(data, '<meta name="description" content="([^"]+)"/>')
|
||||
scrapedplot = scrapertools.find_single_match(data, '<meta name="description" content="([^"]+)"/>')
|
||||
scrapedthumbnail = scrapertools.find_single_match(data, '<div class="separedescrip">.*?src="([^"]+)"')
|
||||
|
||||
idserie = scrapertools.get_match(data, "ajax/pagination_episodes/(\d+)/")
|
||||
idserie = scrapertools.find_single_match(data, "ajax/pagination_episodes/(\d+)/")
|
||||
logger.info("idserie=" + idserie)
|
||||
if " Eps" in item.extra and "Desc" not in item.extra:
|
||||
caps_x = item.extra
|
||||
@@ -212,69 +145,55 @@ def episodios(item):
|
||||
paginas = capitulos / 10 + (capitulos % 10 > 0)
|
||||
else:
|
||||
paginas, capitulos = get_pages_and_episodes(data)
|
||||
|
||||
logger.info("idserie=" + idserie)
|
||||
for num_pag in range(1, paginas + 1):
|
||||
|
||||
numero_pagina = str(num_pag)
|
||||
headers = {"Referer": item.url}
|
||||
data2 = scrapertools.cache_page("http://jkanime.net/ajax/pagination_episodes/%s/%s/" % (idserie, numero_pagina),
|
||||
headers=headers)
|
||||
# logger.info("data2=" + data2)
|
||||
|
||||
data2 = httptools.downloadpage(host + "/ajax/pagination_episodes/%s/%s/" % (idserie, numero_pagina),
|
||||
headers=headers).data
|
||||
patron = '"number"\:"(\d+)","title"\:"([^"]+)"'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data2)
|
||||
|
||||
# http://jkanime.net/get-backers/1/
|
||||
matches = scrapertools.find_multiple_matches(data2, patron)
|
||||
for numero, scrapedtitle in matches:
|
||||
title = scrapedtitle.strip()
|
||||
url = urlparse.urljoin(item.url, numero)
|
||||
thumbnail = scrapedthumbnail
|
||||
url = item.url + numero
|
||||
plot = scrapedplot
|
||||
logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]")
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="findvideos", title=title, url=url, thumbnail=thumbnail,
|
||||
fanart=thumbnail, plot=plot, fulltitle=title))
|
||||
|
||||
itemlist.append(item.clone(action="findvideos", title=title, url=url, plot=plot))
|
||||
if len(itemlist) == 0:
|
||||
try:
|
||||
# porestrenar = scrapertools.get_match(data,
|
||||
# '<div[^<]+<span class="labl">Estad[^<]+</span[^<]+<span[^>]+>Por estrenar</span>')
|
||||
itemlist.append(Item(channel=item.channel, action="findvideos", title="Serie por estrenar", url="",
|
||||
thumbnail=scrapedthumbnail, fanart=scrapedthumbnail, plot=scrapedplot,
|
||||
server="directo", folder=False))
|
||||
except:
|
||||
pass
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
data = re.sub(r"\n|\r|\t|\s{2}|-\s", "", httptools.downloadpage(item.url).data)
|
||||
|
||||
list_videos = scrapertools.find_multiple_matches(data, '<iframe class="player_conte" src="([^"]+)"')
|
||||
aux_url = []
|
||||
data = httptools.downloadpage(item.url).data
|
||||
list_videos = scrapertools.find_multiple_matches(data, '<iframe class="player_conte" src="([^"]+)"')
|
||||
index = 1
|
||||
for e in list_videos:
|
||||
if e.startswith("https://jkanime.net/jk.php?"):
|
||||
if e.startswith(host + "/jk"):
|
||||
headers = {"Referer": item.url}
|
||||
data = httptools.downloadpage(e, headers=headers).data
|
||||
|
||||
url = scrapertools.find_single_match(data, '<embed class="player_conte".*?&file=([^\"]+)\"')
|
||||
if not url:
|
||||
url = scrapertools.find_single_match(data, 'source src="([^\"]+)\"')
|
||||
if not url:
|
||||
url = scrapertools.find_single_match(data, '<iframe class="player_conte" src="([^\"]+)\"')
|
||||
if "jkanime" in url:
|
||||
url = httptools.downloadpage(url, follow_redirects=False, only_headers=True).headers.get("location", "")
|
||||
if url:
|
||||
itemlist.append(item.clone(title="Enlace encontrado en server #%s" % index, url=url, action="play"))
|
||||
itemlist.append(item.clone(title="Enlace encontrado en server #" + str(index) + " (%s)", url=url, action="play"))
|
||||
index += 1
|
||||
|
||||
else:
|
||||
aux_url.append(e)
|
||||
|
||||
itemlist.extend(servertools.find_video_items(data=",".join(aux_url)))
|
||||
aux_url.append(item.clone(title="Enlace encontrado (%s)", url=e, action="play"))
|
||||
itemlist.extend(aux_url)
|
||||
itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server.capitalize())
|
||||
for videoitem in itemlist:
|
||||
videoitem.fulltitle = item.fulltitle
|
||||
videoitem.channel = item.channel
|
||||
videoitem.thumbnail = item.thumbnail
|
||||
|
||||
return itemlist
|
||||
|
||||
@@ -41,7 +41,7 @@ tcalidad = {"FULL HD": "https://s18.postimg.cc/qszt3n6tl/fullhd.png",
|
||||
"HD": "https://s27.postimg.cc/m2dhhkrur/image.png",
|
||||
"SD": "https://s29.postimg.cc/l66t2pfqf/image.png"
|
||||
}
|
||||
host = 'http://miradetodo.io/'
|
||||
host = 'http://miradetodo.net/'
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
"id": "intervenidos_channels_list",
|
||||
"type": "text",
|
||||
"label": "Lista de canales y clones de NewPct1 intervenidos y orden de sustitución de URLs",
|
||||
"default": "('0', 'canal_org', 'canal_des', 'url_org', 'url_des', 'patron1', 'patron2', 'patron3', 'patron4', 'patron5', 'content_inc', 'content_exc', 'ow_force'), ('1', 'mejortorrent', 'mejortorrent1', 'http://www.mejortorrent.com/', 'https://mejortorrent1.com/', '(http.?:\/\/.*?\/)', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-(?:[^-]+-)([^0-9]+-)', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-(?:[^-]+-)[^0-9]+-\\d+-(Temporada-).html', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-(?:[^-]+-)[^0-9]+-(\\d+)-', '', 'tvshow, season', '', 'force'), ('1', 'mejortorrent', 'mejortorrent1', 'http://www.mejortorrent.com/', 'https://mejortorrent1.com/', '(http.?:\/\/.*?\/)', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-([^.]+).html', '', '', '', 'movie', '', 'force')",
|
||||
"default": "('0', 'canal_org', 'canal_des', 'url_org', 'url_des', 'patron1', 'patron2', 'patron3', 'patron4', 'patron5', 'content_inc', 'content_exc', 'ow_force'), ('1', 'mejortorrent', 'mejortorrent1', 'http://www.mejortorrent.com/', 'https://mejortorrent1.com/', '(http.?:\/\/.*?\/)', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-(?:[^-]+-)([^0-9]+-)', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-(?:[^-]+-)[^0-9]+-\\d+-(Temporada-).html', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-(?:[^-]+-)[^0-9]+-(\\d+)-', '', 'tvshow, season', '', 'force'), ('1', 'mejortorrent', 'mejortorrent1', 'http://www.mejortorrent.com/', 'https://mejortorrent1.com/', '(http.?:\/\/.*?\/)', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-([^.]+).html', '', '', '', 'movie', '', 'force'), ('1', 'newpct1', '', '', '', '', '', '', '', '', '*', '', 'del'), ('1', 'videolibrary', '', '', '', '', '', '', '', '', '*', '', 'del')",
|
||||
"enabled": true,
|
||||
"visible": false
|
||||
},
|
||||
|
||||
@@ -1165,6 +1165,8 @@ def findvideos(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
#logger.debug(item)
|
||||
|
||||
#Renombramos el canal al nombre de clone elegido. Actualizados URL
|
||||
host = scrapertools.find_single_match(item.url, '(http.?\:\/\/(?:www.)?\w+\.\w+\/)')
|
||||
item.channel_host = host
|
||||
@@ -1306,7 +1308,7 @@ def findvideos(item):
|
||||
item.category = category_servidores #restauramos valores originales
|
||||
item.url = url_servidores
|
||||
|
||||
# Nuevo sistema de scrapeo de servidores creado por Torrentlocula, compatible con otros clones de Newpct1
|
||||
# Sistema de scrapeo de servidores creado por Torrentlocula, compatible con otros clones de Newpct1
|
||||
patron = '<div class=\"box1\"[^<]+<img src=\"([^<]+)?" style[^<]+><\/div[^<]+<div class="box2">([^<]+)?<\/div[^<]+<div class="box3">([^<]+)?'
|
||||
patron += '<\/div[^<]+<div class="box4">([^<]+)?<\/div[^<]+<div class="box5"><a href=(.*?)? rel.*?'
|
||||
patron += '<\/div[^<]+<div class="box6">([^<]+)?<'
|
||||
@@ -1338,10 +1340,9 @@ def findvideos(item):
|
||||
size = size.replace(".", ",") #sustituimos . por , porque Unify lo borra
|
||||
if not size:
|
||||
size = scrapertools.find_single_match(item.quality, '\s\[(\d+,?\d*?\s\w[b|B])\]')
|
||||
else:
|
||||
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
|
||||
if size:
|
||||
size = size.replace('GB', 'G B').replace('Gb', 'G b').replace('MB', 'M B').replace('Mb', 'M b')
|
||||
item.quality = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.quality) #Quitamos size de calidad, si lo traía
|
||||
|
||||
@@ -1440,9 +1441,9 @@ def findvideos(item):
|
||||
break #Si se ha agotado el contador de verificación, se sale de Ver Online
|
||||
|
||||
#Si el link no está activo se ignora
|
||||
if item_local.alive == "??": #dudoso
|
||||
if "??" in item_local.alive: #dudoso
|
||||
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][%s][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (servidor.capitalize(), item_local.quality, str(item_local.language))
|
||||
elif item_local.alive.lower() == "no": #No está activo. Lo preparo, pero no lo pinto
|
||||
elif "no" in item_local.alive.lower(): #No está activo. Lo preparo, pero no lo pinto
|
||||
item_local.title = '[COLOR red][%s][/COLOR] [COLOR yellow][%s][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.alive, servidor.capitalize(), item_local.quality, str(item_local.language))
|
||||
logger.debug(item_local.alive + ": ALIVE / " + title + " / " + servidor + " / " + enlace)
|
||||
raise
|
||||
@@ -1458,7 +1459,7 @@ def findvideos(item):
|
||||
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', item_local.title).strip()
|
||||
itemlist.append(item_local.clone())
|
||||
except:
|
||||
pass
|
||||
logger.error('ERROR al procesar enlaces VER DIRECTOS: ' + servidor + ' / ' + enlace)
|
||||
|
||||
#Ahora vemos los enlaces de DESCARGAR
|
||||
if len(enlaces_descargar) > 0 and ver_enlaces_descargas != 0:
|
||||
@@ -1530,12 +1531,12 @@ def findvideos(item):
|
||||
ver_enlaces_descargas = 0 #FORZAR SALIR de DESCARGAS
|
||||
break #Si se ha agotado el contador de verificación, se sale de "Enlace"
|
||||
|
||||
if item_local.alive == "??": #dudoso
|
||||
if "??" in item_local.alive: #dudoso
|
||||
if not item.unify: #Si titles Inteligentes NO seleccionados:
|
||||
parte_title = '[COLOR yellow][?][/COLOR] %s' % (parte_title)
|
||||
else:
|
||||
parte_title = '[COLOR yellow]%s[/COLOR]-%s' % (item_local.alive, parte_title)
|
||||
elif item_local.alive.lower() == "no": #No está activo. Lo preparo, pero no lo pinto
|
||||
elif "no" in item_local.alive.lower(): #No está activo. Lo preparo, pero no lo pinto
|
||||
if not item.unify: #Si titles Inteligentes NO seleccionados:
|
||||
parte_title = '[COLOR red][%s][/COLOR] %s' % (item_local.alive, parte_title)
|
||||
else:
|
||||
@@ -1552,7 +1553,7 @@ def findvideos(item):
|
||||
item_local.title = re.sub(r'\[COLOR \w+\]-\[\/COLOR\]', '', item_local.title).strip()
|
||||
itemlist.append(item_local.clone())
|
||||
except:
|
||||
pass
|
||||
logger.error('ERROR al procesar enlaces DESCARGAR DIRECTOS: ' + servidor + ' / ' + enlace)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -14,6 +14,26 @@
|
||||
],
|
||||
"settings": [
|
||||
{
|
||||
"id": "filter_languages",
|
||||
"type": "list",
|
||||
"label": "Mostrar enlaces en idioma...",
|
||||
"default": 0,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": [
|
||||
"No filtrar",
|
||||
"Latino"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "include_in_global_search",
|
||||
"type": "bool",
|
||||
"label": "Incluir en busqueda global",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "modo_grafico",
|
||||
"type": "bool",
|
||||
"label": "Buscar información extra",
|
||||
|
||||
@@ -8,6 +8,8 @@ import sys
|
||||
import urllib
|
||||
import urlparse
|
||||
|
||||
from channels import autoplay
|
||||
from channels import filtertools
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from core import servertools
|
||||
@@ -19,7 +21,7 @@ from channelselector import get_thumb
|
||||
|
||||
__channel__ = "pedropolis"
|
||||
|
||||
host = "http://pedropolis.com/"
|
||||
host = "http://pedropolis.tv/"
|
||||
|
||||
try:
|
||||
__modo_grafico__ = config.get_setting('modo_grafico', __channel__)
|
||||
@@ -44,10 +46,16 @@ parameters = channeltools.get_channel_parameters(__channel__)
|
||||
fanart_host = parameters['fanart']
|
||||
thumbnail_host = parameters['thumbnail']
|
||||
|
||||
IDIOMAS = {'Latino': 'LAT'}
|
||||
list_language = IDIOMAS.values()
|
||||
list_quality = []
|
||||
list_servers = ['rapidvideo', 'streamango', 'fastplay', 'openload']
|
||||
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
|
||||
autoplay.init(item.channel, list_servers, list_quality)
|
||||
itemlist = [item.clone(title="Peliculas", action="menumovies", text_blod=True,
|
||||
viewcontent='movies', viewmode="movie_with_plot", thumbnail=get_thumb("channels_movie.png")),
|
||||
|
||||
@@ -57,31 +65,27 @@ def mainlist(item):
|
||||
|
||||
item.clone(title="Buscar", action="search", text_blod=True, extra='buscar',
|
||||
thumbnail=get_thumb('search.png'), url=host)]
|
||||
|
||||
autoplay.show_option(item.channel, itemlist)
|
||||
return itemlist
|
||||
|
||||
|
||||
def menumovies(item):
|
||||
logger.info()
|
||||
itemlist = [item.clone(title="Todas", action="peliculas", text_blod=True, url=host + 'movies/',
|
||||
itemlist = [item.clone(title="Todas", action="peliculas", text_blod=True, url=host + 'pelicula/',
|
||||
viewcontent='movies', viewmode="movie_with_plot"),
|
||||
|
||||
item.clone(title="Más Vistas", action="peliculas", text_blod=True,
|
||||
viewcontent='movies', url=host + 'tendencias/?get=movies', viewmode="movie_with_plot"),
|
||||
|
||||
item.clone(title="Más Valoradas", action="peliculas", text_blod=True, viewcontent='movies',
|
||||
url=host + 'calificaciones/?get=movies', viewmode="movie_with_plot"),
|
||||
|
||||
item.clone(title="Géneros", action="generos", text_blod=True, viewmode="movie_with_plot",
|
||||
viewcontent='movies', url=host)]
|
||||
|
||||
viewcontent='movies', url=host + 'tendencias/?get=movie', viewmode="movie_with_plot"),
|
||||
item.clone(title="Por año", action="p_portipo", text_blod=True, extra="Películas Por año",
|
||||
viewcontent='movies', url=host, viewmode="movie_with_plot"),
|
||||
item.clone(title="Por género", action="p_portipo", text_blod=True, extra="Categorías",
|
||||
viewcontent='movies', url=host, viewmode="movie_with_plot")]
|
||||
return itemlist
|
||||
|
||||
|
||||
def menuseries(item):
|
||||
logger.info()
|
||||
itemlist = [item.clone(title="Todas", action="series", text_blod=True, extra='serie', mediatype="tvshow",
|
||||
viewcontent='tvshows', url=host + 'tvshows/', viewmode="movie_with_plot"),
|
||||
viewcontent='tvshows', url=host + 'serie/', viewmode="movie_with_plot"),
|
||||
|
||||
item.clone(title="Más Vistas", action="series", text_blod=True, extra='serie', mediatype="tvshow",
|
||||
viewcontent='tvshows', url=host + 'tendencias/?get=tv', viewmode="movie_with_plot"),
|
||||
@@ -92,6 +96,22 @@ def menuseries(item):
|
||||
return itemlist
|
||||
|
||||
|
||||
def p_portipo(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
data = httptools.downloadpage(item.url).data
|
||||
bloque = scrapertools.find_single_match(data, '(?is)%s.*?</ul>' %item.extra)
|
||||
patron = 'href="([^"]+).*?'
|
||||
patron += '>([^"<]+)'
|
||||
matches = scrapertools.find_multiple_matches(bloque, patron)
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
itemlist.append(item.clone(action = "peliculas",
|
||||
title = scrapedtitle,
|
||||
url = scrapedurl
|
||||
))
|
||||
return itemlist
|
||||
|
||||
|
||||
def peliculas(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
@@ -99,14 +119,11 @@ def peliculas(item):
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\(.*?\)|\s{2}| ", "", data)
|
||||
# logger.info(data)
|
||||
|
||||
patron = '<div class="poster"><img src="([^"]+)" alt="([^"]+)">.*?' # img, title
|
||||
patron = '<div class="poster"> <img src="([^"]+)" alt="([^"]+)">.*?' # img, title
|
||||
patron += '<div class="rating"><span class="[^"]+"></span>([^<]+).*?' # rating
|
||||
patron += '<span class="quality">([^<]+)</span></div><a href="([^"]+)">.*?' # calidad, url
|
||||
patron += '<span class="quality">([^<]+)</span></div> <a href="([^"]+)">.*?' # calidad, url
|
||||
patron += '<span>([^<]+)</span>' # year
|
||||
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
|
||||
# Paginación
|
||||
if item.next_page != 'b':
|
||||
if len(matches) > 19:
|
||||
@@ -120,65 +137,28 @@ def peliculas(item):
|
||||
matches_next_page = re.compile(patron_next_page, re.DOTALL).findall(data)
|
||||
if len(matches_next_page) > 0:
|
||||
url_next_page = urlparse.urljoin(item.url, matches_next_page[0])
|
||||
|
||||
for scrapedthumbnail, scrapedtitle, rating, quality, scrapedurl, year in matches:
|
||||
if 'Proximamente' not in quality:
|
||||
scrapedtitle = scrapedtitle.replace('Ver ', '').partition(' /')[0].partition(':')[0].replace(
|
||||
'Español Latino', '').strip()
|
||||
title = "%s [COLOR green][%s][/COLOR] [COLOR yellow][%s][/COLOR]" % (scrapedtitle, year, quality)
|
||||
|
||||
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="findvideos", contentTitle=scrapedtitle,
|
||||
infoLabels={"year":year, "rating":rating}, thumbnail=scrapedthumbnail,
|
||||
url=scrapedurl, next_page=next_page, quality=quality, title=title))
|
||||
|
||||
tmdb.set_infoLabels_itemlist(itemlist, __modo_grafico__)
|
||||
|
||||
if url_next_page:
|
||||
itemlist.append(Item(channel=__channel__, action="peliculas", title="» Siguiente »",
|
||||
url=url_next_page, next_page=next_page, folder=True, text_blod=True,
|
||||
thumbnail=get_thumb("next.png")))
|
||||
|
||||
for no_plot in itemlist:
|
||||
if no_plot.infoLabels['plot'] == '':
|
||||
thumb_id = scrapertools.find_single_match(no_plot.thumbnail, '.*?\/\d{2}\/(.*?)-')
|
||||
thumbnail = "/%s.jpg" % thumb_id
|
||||
filtro_list = {"poster_path": thumbnail}
|
||||
filtro_list = filtro_list.items()
|
||||
no_plot.infoLabels={'filtro':filtro_list}
|
||||
tmdb.set_infoLabels_item(no_plot, __modo_grafico__)
|
||||
|
||||
if no_plot.infoLabels['plot'] == '':
|
||||
data = httptools.downloadpage(no_plot.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
# logger.info(data)
|
||||
no_plot.fanart = scrapertools.find_single_match(data,
|
||||
"<meta property='og:image' content='([^']+)' />").replace(
|
||||
'w780', 'original')
|
||||
no_plot.plot = scrapertools.find_single_match(data, '<div itemprop="description" '
|
||||
'class="wp-content">.*?<p>(['
|
||||
'^<]+)</p>')
|
||||
no_plot.plot = scrapertools.htmlclean(no_plot.plot)
|
||||
no_plot.infoLabels['director'] = scrapertools.find_single_match(data,
|
||||
'<div class="name"><a href="[^"]+">([^<]+)</a>')
|
||||
no_plot.infoLabels['rating'] = scrapertools.find_single_match(data, '<b id="repimdb"><strong>(['
|
||||
'^<]+)</strong>')
|
||||
no_plot.infoLabels['votes'] = scrapertools.find_single_match(data, '<b id="repimdb"><strong>['
|
||||
'^<]+</strong>\s(.*?) votos</b>')
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def search(item, texto):
|
||||
logger.info()
|
||||
|
||||
texto = texto.replace(" ", "+")
|
||||
item.url = urlparse.urljoin(item.url, "?s={0}".format(texto))
|
||||
|
||||
try:
|
||||
return sub_search(item)
|
||||
|
||||
# Se captura la excepción, para no interrumpir al buscador global si un canal falla
|
||||
except:
|
||||
import sys
|
||||
@@ -189,20 +169,18 @@ def search(item, texto):
|
||||
|
||||
def sub_search(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t| |<br>", "", data)
|
||||
|
||||
patron = '<a href="([^"]+)"><img src="([^"]+)" alt="([^"]+)" />' # url, img, title
|
||||
bloque = scrapertools.find_single_match(data, 'Resultados encontrados.*?class="widget widget_fbw_id')
|
||||
patron = '(?is)<a href="([^"]+)">.*?'
|
||||
patron += '<img src="([^"]+)".*?'
|
||||
patron += 'alt="([^"]+)" />.*?' # url, img, title
|
||||
patron += '<span class="[^"]+">([^<]+)</span>.*?' # tipo
|
||||
patron += '<span class="year">([^"]+)</span>.*?<div class="contenido"><p>([^<]+)</p>' # year, plot
|
||||
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedurl, scrapedthumbnail, scrapedtitle, tipo, year, plot in matches:
|
||||
patron += '<span class="year">([^"]+)' # year
|
||||
matches = scrapertools.find_multiple_matches(bloque, patron)
|
||||
for scrapedurl, scrapedthumbnail, scrapedtitle, tipo, year in matches:
|
||||
title = scrapedtitle
|
||||
if tipo == 'Serie':
|
||||
if tipo == ' Serie ':
|
||||
contentType = 'tvshow'
|
||||
action = 'temporadas'
|
||||
title += ' [COLOR red](' + tipo + ')[/COLOR]'
|
||||
@@ -210,18 +188,14 @@ def sub_search(item):
|
||||
contentType = 'movie'
|
||||
action = 'findvideos'
|
||||
title += ' [COLOR green](' + tipo + ')[/COLOR]'
|
||||
|
||||
itemlist.append(item.clone(title=title, url=scrapedurl, contentTitle=scrapedtitle, extra='buscar',
|
||||
action=action, infoLabels={"year": year}, contentType=contentType,
|
||||
thumbnail=scrapedthumbnail, text_color=color1, contentSerieName=scrapedtitle))
|
||||
|
||||
tmdb.set_infoLabels_itemlist(itemlist, __modo_grafico__)
|
||||
paginacion = scrapertools.find_single_match(data, '<link rel="next" href="([^"]+)" />')
|
||||
|
||||
if paginacion:
|
||||
itemlist.append(Item(channel=item.channel, action="sub_search",
|
||||
title="» Siguiente »", url=paginacion, thumbnail=get_thumb("next.png")))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -253,42 +227,17 @@ def newest(categoria):
|
||||
return itemlist
|
||||
|
||||
|
||||
def generos(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
# logger.info(data)
|
||||
data = scrapertools.find_single_match(data, 'Genero</a><ulclass="sub-menu">(.*?)</ul></li><li id')
|
||||
|
||||
patron = '<li id="[^"]+" class="menu-item.*?<a href="([^"]+)">([^<]+)</a></li>'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
if scrapedtitle != 'Proximamente':
|
||||
title = "%s" % scrapedtitle
|
||||
itemlist.append(item.clone(channel=item.channel, action="peliculas", title=title,
|
||||
url=scrapedurl, text_color=color3, viewmode="movie_with_plot"))
|
||||
|
||||
itemlist.sort(key=lambda it: it.title)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def series(item):
|
||||
logger.info()
|
||||
url_next_page = ''
|
||||
|
||||
itemlist = []
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t| |<br>", "", data)
|
||||
# logger.info(data)
|
||||
|
||||
patron = '<div class="poster"><img src="([^"]+)" alt="([^"]+)">.*?<a href="([^"]+)">' # img, title, url
|
||||
|
||||
patron = '<div class="poster"> <img src="([^"]+)"'
|
||||
patron += ' alt="([^"]+)">.*?'
|
||||
patron += '<a href="([^"]+)">'
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
|
||||
if item.next_page != 'b':
|
||||
if len(matches) > 19:
|
||||
url_next_page = item.url
|
||||
@@ -301,45 +250,27 @@ def series(item):
|
||||
matches_next_page = re.compile(patron_next_page, re.DOTALL).findall(data)
|
||||
if len(matches_next_page) > 0:
|
||||
url_next_page = urlparse.urljoin(item.url, matches_next_page[0])
|
||||
|
||||
for scrapedthumbnail, scrapedtitle, scrapedurl in matches:
|
||||
scrapedtitle = scrapedtitle.replace('’', "'")
|
||||
itemlist.append(Item(channel=__channel__, title=scrapedtitle, extra='serie',
|
||||
url=scrapedurl, thumbnail=scrapedthumbnail,
|
||||
contentSerieName=scrapedtitle, show=scrapedtitle,
|
||||
next_page=next_page, action="temporadas", contentType='tvshow'))
|
||||
|
||||
tmdb.set_infoLabels(itemlist, __modo_grafico__)
|
||||
tmdb.set_infoLabels(itemlist, __modo_grafico__)
|
||||
|
||||
if url_next_page:
|
||||
itemlist.append(Item(channel=__channel__, action="series", title="» Siguiente »", url=url_next_page,
|
||||
next_page=next_page, thumbnail=get_thumb("next.png")))
|
||||
|
||||
for item in itemlist:
|
||||
if item.infoLabels['plot'] == '':
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
# logger.info(data)
|
||||
item.fanart = scrapertools.find_single_match(data,
|
||||
"<meta property='og:image' content='([^']+)' />").replace(
|
||||
'w780', 'original')
|
||||
item.plot = scrapertools.find_single_match(data, '<h2>Sinopsis</h2><div class="wp-content"><p>([^<]+)</p>')
|
||||
item.plot = scrapertools.htmlclean(item.plot)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def temporadas(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t| |<br>", "", data)
|
||||
# logger.info(data)
|
||||
patron = '<span class="title">([^<]+)<i>.*?' # season
|
||||
patron += '<img src="([^"]+)"></a></div>' # img
|
||||
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
if len(matches) > 1:
|
||||
for scrapedseason, scrapedthumbnail in matches:
|
||||
@@ -349,7 +280,6 @@ def temporadas(item):
|
||||
new_item.infoLabels['season'] = temporada
|
||||
new_item.extra = ""
|
||||
itemlist.append(new_item)
|
||||
|
||||
tmdb.set_infoLabels(itemlist, __modo_grafico__)
|
||||
for i in itemlist:
|
||||
i.title = "%s. %s" % (i.infoLabels['season'], i.infoLabels['tvshowtitle'])
|
||||
@@ -359,14 +289,11 @@ def temporadas(item):
|
||||
if i.infoLabels.has_key('poster_path'):
|
||||
# Si la temporada tiene poster propio remplazar al de la serie
|
||||
i.thumbnail = i.infoLabels['poster_path']
|
||||
|
||||
itemlist.sort(key=lambda it: it.title)
|
||||
|
||||
if config.get_videolibrary_support() and len(itemlist) > 0:
|
||||
itemlist.append(Item(channel=__channel__, title="Añadir esta serie a la videoteca", url=item.url,
|
||||
action="add_serie_to_library", extra="episodios", show=item.show, category="Series",
|
||||
text_color=color1, thumbnail=get_thumb("videolibrary_tvshow.png"), fanart=fanart_host))
|
||||
|
||||
return itemlist
|
||||
else:
|
||||
return episodios(item)
|
||||
@@ -375,36 +302,28 @@ def temporadas(item):
|
||||
def episodios(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t| |<br>", "", data)
|
||||
# logger.info(data)
|
||||
patron = '<div class="imagen"><a href="([^"]+)">.*?' # url
|
||||
patron += '<div class="numerando">(.*?)</div>.*?' # numerando cap
|
||||
patron += '<a href="[^"]+">([^<]+)</a>' # title de episodios
|
||||
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
|
||||
for scrapedurl, scrapedtitle, scrapedname in matches:
|
||||
scrapedtitle = scrapedtitle.replace('--', '0')
|
||||
patron = '(\d+) - (\d+)'
|
||||
match = re.compile(patron, re.DOTALL).findall(scrapedtitle)
|
||||
season, episode = match[0]
|
||||
|
||||
if 'season' in item.infoLabels and int(item.infoLabels['season']) != int(season):
|
||||
continue
|
||||
|
||||
title = "%sx%s: %s" % (season, episode.zfill(2), scrapertools.unescape(scrapedname))
|
||||
new_item = item.clone(title=title, url=scrapedurl, action="findvideos", text_color=color3, fulltitle=title,
|
||||
contentType="episode", extra='serie')
|
||||
if 'infoLabels' not in new_item:
|
||||
new_item.infoLabels = {}
|
||||
|
||||
new_item.infoLabels['season'] = season
|
||||
new_item.infoLabels['episode'] = episode.zfill(2)
|
||||
|
||||
itemlist.append(new_item)
|
||||
|
||||
# TODO no hacer esto si estamos añadiendo a la videoteca
|
||||
if not item.extra:
|
||||
# Obtenemos los datos de todos los capítulos de la temporada mediante multihilos
|
||||
@@ -416,31 +335,25 @@ def episodios(item):
|
||||
if i.infoLabels.has_key('poster_path'):
|
||||
# Si el capitulo tiene imagen propia remplazar al poster
|
||||
i.thumbnail = i.infoLabels['poster_path']
|
||||
|
||||
itemlist.sort(key=lambda it: int(it.infoLabels['episode']),
|
||||
reverse=config.get_setting('orden_episodios', __channel__))
|
||||
|
||||
tmdb.set_infoLabels_itemlist(itemlist, __modo_grafico__)
|
||||
|
||||
# Opción "Añadir esta serie a la videoteca"
|
||||
if config.get_videolibrary_support() and len(itemlist) > 0:
|
||||
itemlist.append(Item(channel=__channel__, title="Añadir esta serie a la videoteca", url=item.url,
|
||||
action="add_serie_to_library", extra="episodios", show=item.show, category="Series",
|
||||
text_color=color1, thumbnail=get_thumb("videolibrary_tvshow.png"), fanart=fanart_host))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
# logger.info(data)
|
||||
patron = '<div id="option-(\d+)" class="[^"]+"><iframe.*?src="([^"]+)".*?</iframe>' # lang, url
|
||||
patron = '<div id="option-(\d+)".*?<iframe.*?src="([^"]+)".*?</iframe>' # lang, url
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for option, url in matches:
|
||||
lang = scrapertools.find_single_match(data, '<li><a class="options" href="#option-%s">.*?</b>-->(\w+)' % option)
|
||||
lang = lang.lower()
|
||||
@@ -451,17 +364,13 @@ def findvideos(item):
|
||||
'ingles': '[COLOR red](VOS)[/COLOR]'}
|
||||
if lang in idioma:
|
||||
lang = idioma[lang]
|
||||
|
||||
# obtenemos los redirecionamiento de shorturl en caso de coincidencia
|
||||
if "bit.ly" in url:
|
||||
url = httptools.downloadpage(url, follow_redirects=False, only_headers=True).headers.get("location", "")
|
||||
|
||||
itemlist.append(item.clone(channel=__channel__, url=url, title=item.contentTitle,
|
||||
action='play', language=lang))
|
||||
|
||||
itemlist = servertools.get_servers_itemlist(itemlist)
|
||||
itemlist.sort(key=lambda it: it.language, reverse=False)
|
||||
|
||||
for x in itemlist:
|
||||
if x.extra != 'directo':
|
||||
x.thumbnail = item.thumbnail
|
||||
@@ -469,10 +378,14 @@ def findvideos(item):
|
||||
if item.extra != 'serie' and item.extra != 'buscar':
|
||||
x.title = "Ver en: [COLOR yellowgreen](%s)[/COLOR] [COLOR yellow](%s)[/COLOR] %s" % (
|
||||
x.server.title(), x.quality, x.language)
|
||||
# Requerido para FilterTools
|
||||
itemlist = filtertools.get_links(itemlist, item, list_language)
|
||||
|
||||
# Requerido para AutoPlay
|
||||
|
||||
autoplay.start(itemlist, item)
|
||||
if config.get_videolibrary_support() and len(itemlist) > 0 and item.extra != 'serie':
|
||||
itemlist.append(Item(channel=__channel__, url=item.url, action="add_pelicula_to_library", extra="findvideos",
|
||||
title='[COLOR yellow]Añadir esta pelicula a la videoteca[/COLOR]',
|
||||
thumbnail=get_thumb("videolibrary_movie.png"), contentTitle=item.contentTitle))
|
||||
|
||||
return itemlist
|
||||
|
||||
@@ -114,21 +114,12 @@ def listado_alfabetico(item):
|
||||
itemlist = []
|
||||
|
||||
for letra in '0ABCDEFGHIJKLMNOPQRSTUVWXYZ':
|
||||
|
||||
cadena = "series/letra/"
|
||||
if item.extra == "movies":
|
||||
cadena = 'movies/all/?letra='
|
||||
cadena = 'letra/' + ('num' if letra == '0' else letra) + '/'
|
||||
viewcontent = "movies"
|
||||
if letra == '0':
|
||||
cadena += "Num"
|
||||
else:
|
||||
cadena += letra
|
||||
else:
|
||||
cadena = 'series/letra/' + ('num' if letra == '0' else letra) + '/'
|
||||
viewcontent = "tvshows"
|
||||
if letra == '0':
|
||||
cadena += "num/"
|
||||
else:
|
||||
cadena += letra + "/"
|
||||
|
||||
itemlist.append(
|
||||
Item(channel=__channel__, action="listado", title=letra, url=urlparse.urljoin(CHANNEL_HOST, cadena),
|
||||
@@ -148,7 +139,7 @@ def listado_genero(item):
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| |<Br>|<BR>|<br>|<br/>|<br />|-\s", "", data)
|
||||
|
||||
if item.extra == "movies":
|
||||
cadena = 'movies/all/?gender='
|
||||
cadena = 'genero/'
|
||||
viewcontent = "movies"
|
||||
patron = '<select name="gender" id="genres" class="auxBtn1">.*?</select>'
|
||||
data = scrapertools.find_single_match(data, patron)
|
||||
@@ -164,9 +155,7 @@ def listado_genero(item):
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for key, value in matches[1:]:
|
||||
cadena2 = cadena + key
|
||||
if item.extra != "movies":
|
||||
cadena2 += "/"
|
||||
cadena2 = cadena + key + '/'
|
||||
|
||||
itemlist.append(
|
||||
Item(channel=__channel__, action="listado", title=value, url=urlparse.urljoin(CHANNEL_HOST, cadena2),
|
||||
@@ -186,7 +175,7 @@ def listado_anio(item):
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| |<Br>|<BR>|<br>|<br/>|<br />|-\s", "", data)
|
||||
|
||||
if item.extra == "movies":
|
||||
cadena = 'movies/all/?year='
|
||||
cadena = 'anio/'
|
||||
viewcontent = "movies"
|
||||
patron = '<select name="year" id="years" class="auxBtn1">.*?</select>'
|
||||
data = scrapertools.find_single_match(data, patron)
|
||||
@@ -203,10 +192,7 @@ def listado_anio(item):
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for value in matches[1:]:
|
||||
cadena2 = cadena + value
|
||||
|
||||
if item.extra != "movies":
|
||||
cadena2 += "/"
|
||||
cadena2 = cadena + value + '/'
|
||||
|
||||
itemlist.append(
|
||||
Item(channel=__channel__, action="listado", title=titulo + value, url=urlparse.urljoin(CHANNEL_HOST, cadena2),
|
||||
@@ -294,7 +280,7 @@ def listado(item):
|
||||
'<p class="font12">(.*?)</p>'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedurl, scrapedtitle, scrapedthumbnail, scrapedyear, scrapedplot in matches[:28]:
|
||||
for scrapedurl, scrapedtitle, scrapedthumbnail, scrapedyear, scrapedplot in matches:
|
||||
title = "%s (%s)" % (scrapertools.unescape(scrapedtitle.strip()), scrapedyear)
|
||||
plot = scrapertools.entityunescape(scrapedplot)
|
||||
|
||||
@@ -309,52 +295,19 @@ def listado(item):
|
||||
else:
|
||||
new_item.fulltitle = scrapertools.unescape(scrapedtitle.strip())
|
||||
new_item.infoLabels = {'year': scrapedyear}
|
||||
# logger.debug(new_item.tostring())
|
||||
|
||||
itemlist.append(new_item)
|
||||
|
||||
# Obtenemos los datos basicos de todas las peliculas mediante multihilos
|
||||
tmdb.set_infoLabels(itemlist, __modo_grafico__)
|
||||
|
||||
# numero de registros que se muestran por página, se fija a 28 por cada paginación
|
||||
if len(matches) >= 28 and '/buscar/?' not in item.url:
|
||||
if '<ul class="pagination"' in data:
|
||||
url_next = scrapertools.find_single_match(data, 'href="([^"]*)" rel="next"')
|
||||
if url_next:
|
||||
url = urlparse.urljoin(CHANNEL_HOST, url_next)
|
||||
|
||||
file_php = "666more"
|
||||
tipo_serie = ""
|
||||
|
||||
if item.extra == "movies":
|
||||
anio = scrapertools.find_single_match(item.url, "(?:year=)(\w+)")
|
||||
letra = scrapertools.find_single_match(item.url, "(?:letra=)(\w+)")
|
||||
genero = scrapertools.find_single_match(item.url, "(?:gender=|genre=)(\w+)")
|
||||
params = "letra=%s&year=%s&genre=%s" % (letra, anio, genero)
|
||||
|
||||
else:
|
||||
tipo2 = scrapertools.find_single_match(item.url, "(?:series/|tipo2=)(\w+)")
|
||||
tipo_serie = "&tipo=serie"
|
||||
|
||||
if tipo2 != "all":
|
||||
file_php = "letra"
|
||||
tipo_serie += "&tipo2=" + tipo2
|
||||
|
||||
genero = ""
|
||||
if tipo2 == "anio":
|
||||
genero = scrapertools.find_single_match(item.url, "(?:anio/|genre=)(\w+)")
|
||||
if tipo2 == "genero":
|
||||
genero = scrapertools.find_single_match(item.url, "(?:genero/|genre=)(\w+)")
|
||||
if tipo2 == "letra":
|
||||
genero = scrapertools.find_single_match(item.url, "(?:letra/|genre=)(\w+)")
|
||||
|
||||
params = "genre=%s" % genero
|
||||
|
||||
url = "http://www.pelispedia.tv/api/%s.php?rangeStart=28&rangeEnd=28%s&%s" % (file_php, tipo_serie, params)
|
||||
|
||||
if "rangeStart" in item.url:
|
||||
ant_inicio = scrapertools.find_single_match(item.url, "rangeStart=(\d+)&")
|
||||
inicio = str(int(ant_inicio) + 28)
|
||||
url = item.url.replace("rangeStart=" + ant_inicio, "rangeStart=" + inicio)
|
||||
|
||||
itemlist.append(Item(channel=__channel__, action="listado", title=">> Página siguiente", extra=item.extra,
|
||||
url=url, thumbnail=thumbnail_host, fanart=fanart_host))
|
||||
itemlist.append(Item(channel=__channel__, action="listado", title=">> Página siguiente", extra=item.extra,
|
||||
url=url, thumbnail=thumbnail_host, fanart=fanart_host))
|
||||
|
||||
return itemlist
|
||||
|
||||
@@ -486,7 +439,7 @@ def findvideos(item):
|
||||
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
|
||||
if scrapedurl.startswith("https://cloud.pelispedia.vip/html5.php"):
|
||||
if scrapedurl.startswith("https://cloud.pelispedia.vip/html5.php") or scrapedurl.startswith("https://cloud.pelispedia.stream/html5.php"):
|
||||
parms = dict(re.findall('[&|\?]{1}([^=]*)=([^&]*)', scrapedurl))
|
||||
for cal in ['360', '480', '720', '1080']:
|
||||
if parms[cal]:
|
||||
|
||||
@@ -22,6 +22,20 @@
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "filter_languages",
|
||||
"type": "list",
|
||||
"label": "Mostrar enlaces en idioma...",
|
||||
"default": 0,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": [
|
||||
"No filtrar",
|
||||
"Lat",
|
||||
"Cast",
|
||||
"VOSE"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -12,8 +12,17 @@ from core import scrapertools
|
||||
from core.item import Item
|
||||
from core import servertools
|
||||
from core import httptools
|
||||
from channels import filtertools, autoplay
|
||||
from core import tmdb
|
||||
|
||||
|
||||
|
||||
IDIOMAS = {'latino':'Lat', 'castellano':'Cast', 'subtitulado':'VOSE'}
|
||||
list_language = IDIOMAS.values()
|
||||
list_quality = ['360p', '480p', '720p', '1080p']
|
||||
list_servers = ['mailru', 'openload', 'streamango', 'estream']
|
||||
|
||||
|
||||
host = 'http://pelisplus.co'
|
||||
CHANNEL_HEADERS = [
|
||||
["Host", host.replace("http://","")],
|
||||
@@ -26,6 +35,8 @@ def mainlist(item):
|
||||
|
||||
itemlist = []
|
||||
|
||||
autoplay.init(item.channel, list_servers, list_quality)
|
||||
|
||||
itemlist.append(item.clone(title="Peliculas",
|
||||
action="movie_menu",
|
||||
))
|
||||
@@ -34,6 +45,8 @@ def mainlist(item):
|
||||
action="series_menu",
|
||||
))
|
||||
|
||||
autoplay.show_option(item.channel, itemlist)
|
||||
|
||||
return itemlist
|
||||
|
||||
def movie_menu(item):
|
||||
@@ -342,6 +355,8 @@ def get_links_by_language(item, data):
|
||||
language = scrapertools.find_single_match(data, 'ul id=level\d_(.*?)\s*class=')
|
||||
patron = 'data-source=(.*?)data.*?srt=(.*?)data-iframe.*?Opci.*?<.*?hidden>[^\(]\((.*?)\)'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
if language in IDIOMAS:
|
||||
language == IDIOMAS[language]
|
||||
|
||||
for url, sub, quality in matches:
|
||||
if 'http' not in url:
|
||||
@@ -386,6 +401,14 @@ def findvideos(item):
|
||||
|
||||
video_list = servertools.get_servers_itemlist(video_list, lambda i: i.title % (i.server.capitalize(), i.language,
|
||||
i.quality) )
|
||||
# Requerido para FilterTools
|
||||
|
||||
itemlist = filtertools.get_links(video_list, item, list_language)
|
||||
|
||||
# Requerido para AutoPlay
|
||||
|
||||
autoplay.start(video_list, item)
|
||||
|
||||
if item.contentType != 'episode':
|
||||
if config.get_videolibrary_support() and len(video_list) > 0 and item.extra != 'findvideos':
|
||||
video_list.append(
|
||||
@@ -397,5 +420,6 @@ def findvideos(item):
|
||||
contentTitle=item.contentTitle
|
||||
))
|
||||
|
||||
|
||||
return video_list
|
||||
|
||||
|
||||
@@ -125,8 +125,8 @@ def list_all(item):
|
||||
|
||||
data = get_source(item.url)
|
||||
if item.type == 'movies':
|
||||
patron = '<article id="post-\d+" class="item movies"><div class="poster"><img src="([^"]+)" alt="([^"]+)">.*?'
|
||||
patron += '"quality">([^<]+)</span><\/div><a href="([^"]+)">.*?</h3>.*?<span>([^<]+)</'
|
||||
patron = '<article id="post-\d+" class="item movies"><div class="poster">\s?<img src="([^"]+)" alt="([^"]+)">.*?'
|
||||
patron += '"quality">([^<]+)</span><\/div>\s?<a href="([^"]+)">.*?</h3>.*?<span>([^<]+)</'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedthumbnail, scrapedtitle, quality, scrapedurl, year in matches:
|
||||
@@ -235,29 +235,32 @@ def episodesxseasons(item):
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
from lib import generictools
|
||||
import urllib
|
||||
itemlist = []
|
||||
data = get_source(item.url)
|
||||
patron = 'id="option-(\d+).*?rptss" src="([^"]+)" frameborder'
|
||||
patron = 'data-post="(\d+)" data-nume="(\d+)".*?img src=\'([^\']+)\''
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
for option, scrapedurl in matches:
|
||||
lang = scrapertools.find_single_match(data, 'href="#option-%s">.*?/flags/(.*?).png' % option)
|
||||
for id, option, lang in matches:
|
||||
lang = scrapertools.find_single_match(lang, '.*?/flags/(.*?).png')
|
||||
quality = ''
|
||||
|
||||
post = {'action': 'doo_player_ajax', 'post': id, 'nume': option}
|
||||
post = urllib.urlencode(post)
|
||||
test_url = 'https://pelisr.com/wp-admin/admin-ajax.php'
|
||||
new_data = httptools.downloadpage(test_url, post=post).data
|
||||
scrapedurl = scrapertools.find_single_match(new_data, "src='([^']+)'")
|
||||
|
||||
if lang not in IDIOMAS:
|
||||
lang = 'en'
|
||||
title = '%s'
|
||||
|
||||
if 'embed' in scrapedurl:
|
||||
enc_data = get_source(scrapedurl)
|
||||
if 'drive' in scrapedurl:
|
||||
enc_data = httptools.downloadpage(scrapedurl, headers = {'Referer':item.url}).data
|
||||
|
||||
dec_data = generictools.dejuice(enc_data)
|
||||
url, quality = scrapertools.find_single_match(dec_data, '"file":"(.*?)","label":"(.*?)"')
|
||||
|
||||
elif 'wd=' in scrapedurl:
|
||||
new_id = scrapertools.find_single_match(scrapedurl, 'wd=(.*?)&')
|
||||
new_id = new_id[::-1]
|
||||
new_url = 'https://pelisr.com/encri/?wr=%s' % new_id
|
||||
headers = {'Referer': scrapedurl}
|
||||
data = httptools.downloadpage(new_url, headers=headers, follow_redirects=False)
|
||||
url = data.headers['location']
|
||||
else:
|
||||
url = scrapedurl
|
||||
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, url=url, title=title, action='play', quality=quality, language=IDIOMAS[lang],
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"id": "seriesmeme",
|
||||
"name": "SeriesMeme",
|
||||
"active": true,
|
||||
"adult": false,
|
||||
"language": ["cast", "lat"],
|
||||
"thumbnail": "seriesmeme.png",
|
||||
"banner": "seriesmeme.png",
|
||||
"categories": [
|
||||
"tvshow"
|
||||
]
|
||||
}
|
||||
@@ -1,224 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
import urlparse
|
||||
|
||||
from channels import renumbertools
|
||||
from channelselector import get_thumb
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from core import servertools
|
||||
from core import tmdb
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
from channels import autoplay
|
||||
|
||||
IDIOMAS = {'latino': 'Latino', 'español':'Español'}
|
||||
list_language = IDIOMAS.values()
|
||||
list_servers = ['openload',
|
||||
'sendvid',
|
||||
'netutv',
|
||||
'rapidvideo'
|
||||
]
|
||||
list_quality = ['default']
|
||||
|
||||
host = "https://seriesmeme.com/"
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
|
||||
thumb_series = get_thumb("channels_tvshow.png")
|
||||
thumb_series_az = get_thumb("channels_tvshow_az.png")
|
||||
autoplay.init(item.channel, list_servers, list_quality)
|
||||
itemlist = list()
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="lista_gen", title="Novedades", url=host,
|
||||
thumbnail=thumb_series))
|
||||
itemlist.append(Item(channel=item.channel, action="lista", title="Listado Completo de Series", url=urlparse.urljoin(host, "/lista"),
|
||||
thumbnail=thumb_series))
|
||||
itemlist.append(Item(channel=item.channel, action="categorias", title="Categorias", url=host,
|
||||
thumbnail=thumb_series))
|
||||
itemlist.append(Item(channel=item.channel, action="alfabetico", title="Listado Alfabetico", url=host,
|
||||
thumbnail=thumb_series_az))
|
||||
itemlist.append(Item(channel=item.channel, action="top", title="Top Series", url=host,
|
||||
thumbnail=thumb_series))
|
||||
itemlist = renumbertools.show_option(item.channel, itemlist)
|
||||
autoplay.show_option(item.channel, itemlist)
|
||||
return itemlist
|
||||
|
||||
|
||||
"""
|
||||
def search(item, texto):
|
||||
logger.info()
|
||||
texto = texto.replace(" ","+")
|
||||
item.url = item.url+texto
|
||||
if texto!='':
|
||||
return lista(item)
|
||||
"""
|
||||
|
||||
|
||||
def categorias(item):
|
||||
logger.info()
|
||||
dict_gender = {"acción": "accion", "animes": "animacion", "aventuras": "aventura", "dibujos": "animacion",
|
||||
"ciencia ficción": "ciencia%20ficcion", "intriga": "misterio", "suspenso": "suspense",
|
||||
"thriller": "suspense", "fantástico": "fantasia"}
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
patron_cat = '<li id="menu-item-15068" class=".+?"><.+?>.+?<\/a>(.+?)<\/ul><\/li>'
|
||||
categorias = scrapertools.find_single_match(data, patron_cat)
|
||||
patron = '<li id="menu-item-.+?" class=".+?"><a href="([^"]+)">([^"]+)<\/a><\/li>'
|
||||
matches = scrapertools.find_multiple_matches(categorias, patron)
|
||||
for link, name in matches:
|
||||
if 'Género' in name:
|
||||
title = name.replace('Género ', '')
|
||||
url = link
|
||||
thumbnail = "https://raw.githubusercontent.com/master-1970/resources/master/images/genres/4/azul/%s.png"
|
||||
thumbnail = thumbnail % dict_gender.get(title.lower(), title.lower())
|
||||
itemlist.append(item.clone(title=title, url=url, plot=title, action="lista_gen", thumbnail=thumbnail))
|
||||
return itemlist
|
||||
|
||||
|
||||
def alfabetico(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
patron_alf1 = '<li id="menu-item-15069" class=".+?"><.+?>.+?<\/a>(.+?)<\/ul><\/li>'
|
||||
patron_alf2 = '<li id="menu-item-15099" class=".+?"><.+?>.+?<\/a>(.+?)<\/ul><\/li>'
|
||||
alfabeto1 = scrapertools.find_single_match(data, patron_alf1)
|
||||
alfabeto2 = scrapertools.find_single_match(data, patron_alf2)
|
||||
alfabeto = alfabeto1 + alfabeto2
|
||||
patron = '<li id="menu-item-.+?" class=".+?"><a href="([^"]+)">([^"]+)<\/a><\/li>'
|
||||
matches = scrapertools.find_multiple_matches(alfabeto, patron)
|
||||
for link, name in matches:
|
||||
title = name
|
||||
url = link
|
||||
itemlist.append(item.clone(title=title, url=url, plot=title, action="lista_gen"))
|
||||
return itemlist
|
||||
|
||||
|
||||
def top(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
patron_top = '<li id="menu-item-15087" class=".+?"><.+?>.+?<\/a>(.+?)<\/ul><\/li>'
|
||||
top = scrapertools.find_single_match(data, patron_top)
|
||||
patron = '<a href="([^"]+)">([^"]+)<\/a>'
|
||||
matches = scrapertools.find_multiple_matches(top, patron)
|
||||
for link, name in matches:
|
||||
title = name
|
||||
url = link
|
||||
itemlist.append(item.clone(title=title, url=url, plot=title, action="lista_gen", show=title))
|
||||
tmdb.set_infoLabels(itemlist)
|
||||
return itemlist
|
||||
|
||||
|
||||
def lista_gen(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
|
||||
data1 = httptools.downloadpage(item.url).data
|
||||
data1 = re.sub(r"\n|\r|\t|\s{2}| ", "", data1)
|
||||
patron_sec = '<section class="content">.+?<\/section>'
|
||||
data = scrapertools.find_single_match(data1, patron_sec)
|
||||
patron = '<article id=.+? class=.+?><div.+?>'
|
||||
patron += '<a href="([^"]+)" title="([^"]+)' # scrapedurl, # scrapedtitle
|
||||
patron += ' Capítulos Completos ([^"]+)">' # scrapedlang
|
||||
patron += '<img src=".+?" data-lazy-src="([^"]+)"' # scrapedthumbnail
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
i = 0
|
||||
for scrapedurl, scrapedtitle, scrapedlang, scrapedthumbnail in matches:
|
||||
i = i + 1
|
||||
if 'HD' in scrapedlang:
|
||||
scrapedlang = scrapedlang.replace('HD', '')
|
||||
title = scrapedtitle + " [ " + scrapedlang + "]"
|
||||
context1=[renumbertools.context(item), autoplay.context]
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, title=title, url=scrapedurl, thumbnail=scrapedthumbnail, action="episodios",
|
||||
show=scrapedtitle, context=context1, language=scrapedlang))
|
||||
tmdb.set_infoLabels(itemlist)
|
||||
# Paginacion
|
||||
|
||||
#patron_pag='<a class="nextpostslink" rel="next" href="([^"]+)">'
|
||||
patron_pag='<li class="next right"><a href="([^"]+)" >([^"]+)<\/a><\/li>'
|
||||
next_page_url = scrapertools.find_single_match(data,patron_pag)
|
||||
|
||||
if next_page_url!="" and i!=1:
|
||||
item.url=next_page_url[0]
|
||||
itemlist.append(Item(channel = item.channel,action = "lista_gen",title = ">> Página siguiente", url = next_page_url[0], thumbnail='https://s32.postimg.cc/4zppxf5j9/siguiente.png'))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def lista(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
patron = '<li><strong><a href="([^"]+)">([^"]+)<\/a>'
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for link, name in matches:
|
||||
title = name
|
||||
url = link
|
||||
itemlist.append(item.clone(title=title, url=url, plot=title, action="episodios"))
|
||||
return itemlist
|
||||
|
||||
|
||||
def episodios(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
patron_caps = '<li><strong><a href="([^"]+)">(.+?)–(.+?)<\/a>'
|
||||
matches = scrapertools.find_multiple_matches(data, patron_caps)
|
||||
show = scrapertools.find_single_match(data, '<h3><strong>.+?de (.+?)<\/strong>')
|
||||
scrapedplot = scrapertools.find_single_match(data, '<strong>Sinopsis<\/strong><strong>([^"]+)<\/strong><\/pre>')
|
||||
for link, cap, name in matches:
|
||||
if 'x' in cap:
|
||||
title = cap + " - " + name
|
||||
else:
|
||||
season = 1
|
||||
episode = int(cap)
|
||||
season, episode = renumbertools.numbered_for_tratk(
|
||||
item.channel, item.show, season, episode)
|
||||
date = name
|
||||
title = "{0}x{1:02d} {2} ({3})".format(
|
||||
season, episode, "Episodio " + str(episode), date)
|
||||
# title = cap+" - "+name
|
||||
url = link
|
||||
itemlist.append(Item(channel=item.channel, action="findvideos", title=title, url=url, thumbnail=item.thumbnail,
|
||||
plot=scrapedplot, show=show))
|
||||
|
||||
if config.get_videolibrary_support() and len(itemlist) > 0:
|
||||
itemlist.append(Item(channel=item.channel, title="Añadir esta serie a la videoteca", url=item.url,
|
||||
|
||||
action="add_serie_to_library", extra="episodios", show=show))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
itemlist.extend(servertools.find_video_items(data=data))
|
||||
for videoitem in itemlist:
|
||||
videoitem.channel=item.channel
|
||||
|
||||
autoplay.start(itemlist, item)
|
||||
|
||||
return itemlist
|
||||
@@ -37,51 +37,11 @@ def mainlist(item):
|
||||
return itemlist
|
||||
|
||||
|
||||
def listarpeliculas(item):
|
||||
def get_source(url):
|
||||
logger.info()
|
||||
|
||||
# Descarga la página
|
||||
data = httptools.downloadpage(item.url).data
|
||||
extra = item.extra
|
||||
|
||||
# Extrae las entradas de la pagina seleccionada
|
||||
'''<td class="DarkText" align="center" valign="top" width="100px" height="160px"
|
||||
style="background-color:#1e1e1e;" onmouseover="this.style.backgroundColor='#000000'"
|
||||
onmouseout="this.style.backgroundColor='#1e1e1e'"><p style="margin-bottom: 3px;border-bottom:#ABABAB 1px solid">
|
||||
<a href="http://www.peliculasaudiolatino.com/movies/Larry_Crowne.html"><img
|
||||
src="http://www.peliculasaudiolatino.com/poster/85x115/peliculas/movieimg/movie1317696842.jpg"
|
||||
alt="Larry Crowne" border="0" height="115" width="85"></a>'''
|
||||
patron = '<td class=.*?<a '
|
||||
patron += 'href="([^"]+)"><img src="([^"]+)" alt="([^"]+)"'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
itemlist = []
|
||||
for match in matches:
|
||||
scrapedurl = match[0]
|
||||
scrapedtitle = match[2]
|
||||
scrapedtitle = unicode(scrapedtitle, "iso-8859-1", errors="replace").encode("utf-8")
|
||||
scrapedthumbnail = match[1]
|
||||
scrapedplot = ""
|
||||
logger.info(scrapedtitle)
|
||||
|
||||
# Añade al listado
|
||||
itemlist.append(Item(channel=item.channel, action="findvideos", title=scrapedtitle, fulltitle=scrapedtitle,
|
||||
url=scrapedurl, thumbnail=scrapedthumbnail, plot=scrapedplot, extra=extra, folder=True))
|
||||
|
||||
# Extrae la marca de siguiente página
|
||||
patron = 'Anterior.*? :: <a href="/../../.*?/page/([^"]+)">Siguiente '
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
for match in matches:
|
||||
if len(matches) > 0:
|
||||
scrapedurl = extra + match
|
||||
scrapedtitle = "!Pagina Siguiente"
|
||||
scrapedthumbnail = ""
|
||||
scrapedplot = ""
|
||||
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="listarpeliculas", title=scrapedtitle, fulltitle=scrapedtitle,
|
||||
url=scrapedurl, thumbnail=scrapedthumbnail, plot=scrapedplot, extra=extra, folder=True))
|
||||
|
||||
return itemlist
|
||||
data = httptools.downloadpage(url).data
|
||||
data = re.sub(r'\n|\r|\t| |<br>|\s{2,}', "", data)
|
||||
return data
|
||||
|
||||
def generos(item):
|
||||
logger.info()
|
||||
@@ -187,11 +147,9 @@ def listado2(item):
|
||||
itemlist = []
|
||||
|
||||
# Descarga la página
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r'"|\n|\r|\t| |<br>|\s{2,}', "", data)
|
||||
|
||||
patron = '<h2 class=titpeli.*?<a href=(.*?) title=(.*?)>.*?peli_img_img>.*?<img src=(.*?) alt.*?'
|
||||
patron += '<p>(.*?)<.*?Genero.*?:.*?(\d{4})<.*?png\/>(.*?)<.*?: (.*?)<'
|
||||
data = get_source(item.url)
|
||||
patron = '<h2 class="titpeli.*?<a href="([^"]+)" title="([^"]+)">.*?peli_img_img">.*?'
|
||||
patron +='<img src="([^"]+)" alt.*?<p>([^<]+)</p>.*?Genero.*?:.*?(\d{4})<.*?png".*?\/>([^<]+)<.*?: (.*?)<'
|
||||
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
for scrapedurl, scrapedtitle, scrapedthumbnail, scrapedplot, year, language, quality in matches:
|
||||
@@ -214,12 +172,6 @@ def listado2(item):
|
||||
return itemlist
|
||||
|
||||
|
||||
def get_source(url):
|
||||
logger.info()
|
||||
data = httptools.downloadpage(url).data
|
||||
data = re.sub(r'\n|\r|\t| |<br>|\s{2,}', "", data)
|
||||
return data
|
||||
|
||||
def get_link(data):
|
||||
new_url = scrapertools.find_single_match(data, '(?:IFRAME|iframe) src="([^"]+)" scrolling')
|
||||
return new_url
|
||||
|
||||
@@ -18,6 +18,20 @@
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "filter_languages",
|
||||
"type": "list",
|
||||
"label": "Mostrar enlaces en idioma...",
|
||||
"default": 0,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": [
|
||||
"No filtrar",
|
||||
"Cast",
|
||||
"Lat",
|
||||
"VOSE"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -14,11 +14,17 @@ from core import scrapertools
|
||||
from core import servertools
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
from channels import filtertools, autoplay
|
||||
from core import tmdb
|
||||
|
||||
__channel__ = "ver-peliculas"
|
||||
|
||||
host = "http://ver-peliculas.io/"
|
||||
host = "https://ver-peliculas.co/"
|
||||
|
||||
IDIOMAS = {'Latino':'Lat', 'Catellano':'Cast', 'Subtitulada':'VOSE'}
|
||||
list_language = IDIOMAS.values()
|
||||
list_quality = []
|
||||
list_servers = ['directo', 'openload', 'streamango', 'rapidvideo']
|
||||
|
||||
try:
|
||||
__modo_grafico__ = config.get_setting('modo_grafico', __channel__)
|
||||
@@ -27,7 +33,11 @@ except:
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = list()
|
||||
|
||||
autoplay.init(item.channel, list_servers, list_quality)
|
||||
|
||||
itemlist.append(
|
||||
Item(channel=item.channel,
|
||||
title="Peliculas",
|
||||
@@ -63,9 +73,11 @@ def mainlist(item):
|
||||
Item(channel=item.channel,
|
||||
title="Buscar",
|
||||
action="search",
|
||||
url=host + "core/ajax/suggest_search",
|
||||
url=host + "/buscar/",
|
||||
thumbnail=get_thumb("search.png")))
|
||||
|
||||
autoplay.show_option(item.channel, itemlist)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -90,33 +102,10 @@ def categories(item):
|
||||
|
||||
def search(item, texto):
|
||||
logger.info()
|
||||
|
||||
try:
|
||||
itemlist = []
|
||||
post = "keyword=%s" % texto
|
||||
data = httptools.downloadpage(item.url, post=post).data
|
||||
data = data.replace('\\"', '"').replace('\\/', '/')
|
||||
|
||||
pattern = 'url\((.*?)\).+?<a href="([^"]+)".*?class="ss-title">(.*?)</a>'
|
||||
matches = re.compile(pattern, re.DOTALL).findall(data)
|
||||
|
||||
for thumb, url, title in matches:
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
action="findvideos",
|
||||
title=title,
|
||||
url=url,
|
||||
thumbnail=thumb
|
||||
))
|
||||
|
||||
return itemlist
|
||||
|
||||
# Se captura la excepción, para no interrumpir al buscador global si un canal falla
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
logger.error("%s" % line)
|
||||
return []
|
||||
|
||||
texto = texto.replace(" ", "+")
|
||||
item.url = item.url + texto + '.html'
|
||||
if texto != '':
|
||||
return listado(item)
|
||||
|
||||
def listado(item):
|
||||
logger.info()
|
||||
@@ -126,7 +115,8 @@ def listado(item):
|
||||
matches = scrapertools.find_multiple_matches(data, pattern)
|
||||
for url, thumb, title in matches:
|
||||
year = scrapertools.find_single_match(url, '-(\d+)-online')
|
||||
title = title.replace("Película", "", 1).partition(" /")[0].partition(":")[0]
|
||||
#title = title.replace("Película", "", 1).partition(" /")[0].partition(":")[0]
|
||||
title = title.replace("Película", "", 1).partition(" /")[0]
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
action="findvideos",
|
||||
title=title,
|
||||
@@ -159,61 +149,70 @@ def get_source(url):
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
duplicated = []
|
||||
|
||||
itemlist = []
|
||||
data = get_source(item.url)
|
||||
video_info = scrapertools.find_single_match(data, "load_player\('([^']+).*?([^']+)")
|
||||
movie_info = scrapertools.find_single_match(item.url,
|
||||
'http:\/\/ver-peliculas\.(io|org)\/peliculas\/(\d+)-(.*?)-\d{4}-online\.')
|
||||
'http.:\/\/ver-peliculas\.(io|org|co)\/peliculas\/(\d+)-(.*?)-\d{4}-online\.')
|
||||
|
||||
if movie_info:
|
||||
movie_host = movie_info[0]
|
||||
movie_id = scrapertools.find_single_match(data,'id=idpelicula value=(.*?)>')
|
||||
movie_name = scrapertools.find_single_match(data,'id=nombreslug value=(.*?)>')
|
||||
sub = scrapertools.find_single_match(data, 'id=imdb value=(.*?)>')
|
||||
sub = '%s/subtix/%s.srt' % (movie_host, sub)
|
||||
url_base = 'https://ver-peliculas.%s/core/api.php?id=%s&slug=%s' % (movie_host, movie_id, movie_name)
|
||||
data = httptools.downloadpage(url_base).data
|
||||
json_data = jsontools.load(data)
|
||||
video_list = json_data['lista']
|
||||
for videoitem in video_list:
|
||||
video_base_url = host.replace('.io', '.%s' % movie_host) + 'core/videofinal.php'
|
||||
if video_list[videoitem] != None:
|
||||
video_lang = video_list[videoitem]
|
||||
languages = ['latino', 'spanish', 'subtitulos', 'subtitulosp']
|
||||
for lang in languages:
|
||||
if lang not in video_lang:
|
||||
continue
|
||||
if video_lang[lang] != None:
|
||||
if not isinstance(video_lang[lang], int):
|
||||
video_id = video_lang[lang][0]["video"]
|
||||
post = {"video": video_id, "sub": sub}
|
||||
post = urllib.urlencode(post)
|
||||
data = httptools.downloadpage(video_base_url, post=post).data
|
||||
playlist = jsontools.load(data)
|
||||
sources = playlist[['playlist'][0]]
|
||||
server = playlist['server']
|
||||
for video_link in sources:
|
||||
url = video_link['sources']
|
||||
if url not in duplicated and server!='drive':
|
||||
|
||||
movie_host = movie_info[0]
|
||||
movie_id = scrapertools.find_single_match(data,'id=idpelicula value=(.*?)>')
|
||||
movie_name = scrapertools.find_single_match(data,'id=nombreslug value=(.*?)>')
|
||||
sub = scrapertools.find_single_match(data, 'id=imdb value=(.*?)>')
|
||||
sub = '%s/subtix/%s.srt' % (movie_host, sub)
|
||||
url_base = 'http://ver-peliculas.%s/core/api.php?id=%s&slug=%s' % (movie_host, movie_id, movie_name)
|
||||
data = httptools.downloadpage(url_base).data
|
||||
json_data = jsontools.load(data)
|
||||
video_list = json_data['lista']
|
||||
itemlist = []
|
||||
for videoitem in video_list:
|
||||
video_base_url = host + '/core/videofinal.php'
|
||||
if video_list[videoitem] != None:
|
||||
video_lang = video_list[videoitem]
|
||||
languages = ['latino', 'spanish', 'subtitulos', 'subtitulosp']
|
||||
for lang in languages:
|
||||
if lang not in video_lang:
|
||||
continue
|
||||
if video_lang[lang] != None:
|
||||
if not isinstance(video_lang[lang], int):
|
||||
video_id = video_lang[lang][0]["video"]
|
||||
post = {"video": video_id, "sub": sub}
|
||||
post = urllib.urlencode(post)
|
||||
data = httptools.downloadpage(video_base_url, post=post).data
|
||||
playlist = jsontools.load(data)
|
||||
sources = playlist[['playlist'][0]]
|
||||
server = playlist['server']
|
||||
for video_link in sources:
|
||||
url = video_link['sources']
|
||||
if url not in duplicated and server!='drive':
|
||||
|
||||
if lang == 'spanish':
|
||||
lang = 'Español'
|
||||
elif 'sub' in lang:
|
||||
lang = 'Subtitulada'
|
||||
lang = lang.capitalize()
|
||||
title = 'Ver en %s [' + lang + ']'
|
||||
thumbnail = servertools.guess_server_thumbnail(server)
|
||||
itemlist.append(item.clone(title=title,
|
||||
url=url,
|
||||
thumbnail=thumbnail,
|
||||
action='play',
|
||||
language=lang
|
||||
|
||||
))
|
||||
duplicated.append(url)
|
||||
if lang == 'spanish':
|
||||
lang = 'Castellano'
|
||||
elif 'sub' in lang:
|
||||
lang = 'Subtitulada'
|
||||
lang = lang.capitalize()
|
||||
title = 'Ver en %s [' + lang + ']'
|
||||
thumbnail = servertools.guess_server_thumbnail(server)
|
||||
itemlist.append(item.clone(title=title,
|
||||
url=url,
|
||||
thumbnail=thumbnail,
|
||||
action='play',
|
||||
language=IDIOMAS[lang]
|
||||
))
|
||||
duplicated.append(url)
|
||||
tmdb.set_infoLabels(itemlist, __modo_grafico__)
|
||||
itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server.capitalize())
|
||||
|
||||
itemlist = sorted(itemlist, key=lambda i: i.language)
|
||||
|
||||
# Requerido para FilterTools
|
||||
|
||||
itemlist = filtertools.get_links(itemlist, item, list_language)
|
||||
|
||||
# Requerido para AutoPlay
|
||||
|
||||
autoplay.start(itemlist, item)
|
||||
|
||||
if config.get_videolibrary_support() and len(itemlist) > 0 and item.extra != 'findvideos':
|
||||
itemlist.append(
|
||||
Item(channel=item.channel,
|
||||
|
||||
@@ -24,6 +24,10 @@ def getmainlist(view="thumb_"):
|
||||
thumbnail=get_thumb("channels.png", view), view=view,
|
||||
category=config.get_localized_string(30119), viewmode="thumbnails"))
|
||||
|
||||
itemlist.append(Item(title='Mis enlaces', channel="alfavorites", action="mainlist",
|
||||
thumbnail=get_thumb("favorites.png", view), view=view,
|
||||
category='Mis enlaces', viewmode="thumbnails"))
|
||||
|
||||
itemlist.append(Item(title=config.get_localized_string(30103), channel="search", action="mainlist",
|
||||
thumbnail=get_thumb("search.png", view),
|
||||
category=config.get_localized_string(30119), viewmode="list",
|
||||
@@ -63,10 +67,6 @@ def getchanneltypes(view="thumb_"):
|
||||
|
||||
# Lista de categorias
|
||||
channel_types = ["movie", "tvshow", "anime", "documentary", "vos", "direct", "torrent"]
|
||||
dict_types_lang = {'movie': config.get_localized_string(30122), 'tvshow': config.get_localized_string(30123),
|
||||
'anime': config.get_localized_string(30124), 'documentary': config.get_localized_string(30125),
|
||||
'vos': config.get_localized_string(30136), 'adult': config.get_localized_string(30126),
|
||||
'direct': config.get_localized_string(30137)}
|
||||
|
||||
if config.get_setting("adult_mode") != 0:
|
||||
channel_types.append("adult")
|
||||
@@ -188,7 +188,6 @@ def filterchannels(category, view="thumb_"):
|
||||
channelslist.sort(key=lambda item: item.title.lower().strip())
|
||||
|
||||
if category == "all":
|
||||
|
||||
channel_parameters = channeltools.get_channel_parameters('url')
|
||||
# Si prefiere el banner y el canal lo tiene, cambia ahora de idea
|
||||
if view == "banner_" and "banner" in channel_parameters:
|
||||
@@ -196,6 +195,7 @@ def filterchannels(category, view="thumb_"):
|
||||
|
||||
channelslist.insert(0, Item(title=config.get_localized_string(60088), action="mainlist", channel="url",
|
||||
thumbnail=channel_parameters["thumbnail"], type="generic", viewmode="list"))
|
||||
|
||||
if category in ['movie', 'tvshow']:
|
||||
titles = [config.get_localized_string(70028), config.get_localized_string(30985), config.get_localized_string(70527), config.get_localized_string(60264), config.get_localized_string(70528)]
|
||||
ids = ['popular', 'top_rated', 'now_playing', 'on_the_air']
|
||||
|
||||
@@ -241,7 +241,6 @@ def post_tmdb_listado(item, itemlist):
|
||||
#Ajustamos el nombre de la categoría
|
||||
if not item.category_new:
|
||||
item.category_new = ''
|
||||
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
|
||||
for item_local in itemlist: #Recorremos el Itenlist generado por el canal
|
||||
title = item_local.title
|
||||
@@ -262,7 +261,8 @@ def post_tmdb_listado(item, itemlist):
|
||||
del item_local.extra2
|
||||
|
||||
#Ajustamos el nombre de la categoría
|
||||
item_local.category = scrapertools.find_single_match(item_local.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
if item_local.channel == channel_py:
|
||||
item_local.category = scrapertools.find_single_match(item_local.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
|
||||
#Restauramos la info adicional guarda en la lista title_subs, y la borramos de Item
|
||||
title_add = ' '
|
||||
@@ -616,7 +616,8 @@ def post_tmdb_episodios(item, itemlist):
|
||||
del item.contentSeason_save
|
||||
|
||||
#Ajustamos el nombre de la categoría
|
||||
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
if item.channel == channel_py:
|
||||
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
|
||||
#Restauramos valores si ha habido fail-over
|
||||
channel_alt = ''
|
||||
@@ -640,6 +641,10 @@ def post_tmdb_episodios(item, itemlist):
|
||||
del item.ow_force
|
||||
if item.season_colapse:
|
||||
del item.season_colapse
|
||||
if item.from_action:
|
||||
del item.from_action
|
||||
if item.from_channel:
|
||||
del item.from_channel
|
||||
|
||||
for item_local in itemlist: #Recorremos el Itemlist generado por el canal
|
||||
if item_local.add_videolibrary:
|
||||
@@ -670,10 +675,15 @@ def post_tmdb_episodios(item, itemlist):
|
||||
del item_local.ow_force
|
||||
if item_local.season_colapse:
|
||||
del item_local.season_colapse
|
||||
if item_local.from_action:
|
||||
del item_local.from_action
|
||||
if item_local.from_channel:
|
||||
del item_local.from_channel
|
||||
#logger.debug(item_local)
|
||||
|
||||
#Ajustamos el nombre de la categoría si es un clone de NewPct1
|
||||
item_local.category = scrapertools.find_single_match(item_local.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
if item_local.channel == channel_py:
|
||||
item_local.category = scrapertools.find_single_match(item_local.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
|
||||
#Restauramos valores para cada Episodio si ha habido fail-over de un clone de NewPct1
|
||||
if item_local.channel == channel_py:
|
||||
@@ -777,7 +787,10 @@ def post_tmdb_episodios(item, itemlist):
|
||||
if num_episodios and not item_local.infoLabels['temporada_num_episodios']:
|
||||
item_local.infoLabels['temporada_num_episodios'] = num_episodios
|
||||
num_episodios_flag = False
|
||||
num_episodios_lista[item_local.contentSeason] = num_episodios
|
||||
try:
|
||||
num_episodios_lista[item_local.contentSeason] = num_episodios
|
||||
except:
|
||||
pass
|
||||
|
||||
#logger.debug("title: " + item_local.title + " / url: " + item_local.url + " / calidad: " + item_local.quality + " / Season: " + str(item_local.contentSeason) + " / EpisodeNumber: " + str(item_local.contentEpisodeNumber) + " / num_episodios_lista: " + str(num_episodios_lista) + str(num_episodios_flag))
|
||||
#logger.debug(item_local)
|
||||
@@ -932,6 +945,10 @@ def post_tmdb_findvideos(item, itemlist):
|
||||
except:
|
||||
pass
|
||||
|
||||
#Ajustamos el nombre de la categoría
|
||||
if item.channel == channel_py:
|
||||
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
|
||||
#Quitamos el la categoría o nombre del título, si lo tiene
|
||||
if item.contentTitle:
|
||||
item.contentTitle = re.sub(r' -%s-' % item.category, '', item.contentTitle)
|
||||
@@ -986,7 +1003,7 @@ def post_tmdb_findvideos(item, itemlist):
|
||||
horas = tiempo_final / 60 #Lo transformo a horas
|
||||
resto = tiempo_final - (horas * 60) #guardo el resto de minutos de la hora
|
||||
if not scrapertools.find_single_match(item.quality, '(\[\d+:\d+)'): #si ya tiene la duración, pasamos
|
||||
item.quality += ' [COLOR white][%s:%s h]' % (str(horas).zfill(2), str(resto).zfill(2)) #Lo agrego a Calidad del Servidor
|
||||
item.quality += ' [/COLOR][COLOR white][%s:%s h]' % (str(horas).zfill(2), str(resto).zfill(2)) #Lo agrego a Calidad del Servidor
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -1186,44 +1203,43 @@ def fail_over_newpct1(item, patron, patron2=None, timeout=None):
|
||||
data = ''
|
||||
channel_failed = ''
|
||||
url_alt = []
|
||||
if not item.category:
|
||||
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
if not item.extra2:
|
||||
item.extra2 = 'z9z8z7z6z5'
|
||||
|
||||
#Array con los datos de los canales alternativos
|
||||
#Cargamos en .json del canal para ver las listas de valores en settings
|
||||
fail_over = channeltools.get_channel_json(channel_py)
|
||||
for settings in fail_over['settings']: #Se recorren todos los settings
|
||||
if settings['id'] == "clonenewpct1_channels_list": #Encontramos en setting
|
||||
fail_over = settings['default'] #Carga lista de clones
|
||||
for settings in fail_over['settings']: #Se recorren todos los settings
|
||||
if settings['id'] == "clonenewpct1_channels_list": #Encontramos en setting
|
||||
fail_over = settings['default'] #Carga lista de clones
|
||||
break
|
||||
fail_over_list = ast.literal_eval(fail_over)
|
||||
|
||||
if item.from_channel: #Desde search puede venir con el nombre de canal equivocado
|
||||
if item.from_channel and item.from_channel != 'videolibrary': #Desde search puede venir con el nombre de canal equivocado
|
||||
item.channel = item.from_channel
|
||||
#Recorremos el Array identificando el canal que falla
|
||||
for active, channel, channel_host, contentType, action_excluded in fail_over_list:
|
||||
if item.channel == channel_py:
|
||||
if channel != item.category.lower(): #es el canal/categoría que falla?
|
||||
if channel != item.category.lower(): #es el canal/categoría que falla?
|
||||
continue
|
||||
else:
|
||||
if channel != item.channel: #es el canal que falla?
|
||||
if channel != item.channel: #es el canal que falla?
|
||||
continue
|
||||
channel_failed = channel #salvamos el nombre del canal o categoría
|
||||
channel_host_failed = channel_host #salvamos el nombre del host
|
||||
channel_url_failed = item.url #salvamos la url
|
||||
if patron == True and active == '1': #solo nos han pedido verificar el clone
|
||||
return (item, data) #nos vamos, con el mismo clone, si está activo
|
||||
channel_failed = channel #salvamos el nombre del canal o categoría
|
||||
channel_host_failed = channel_host #salvamos el nombre del host
|
||||
channel_url_failed = item.url #salvamos la url
|
||||
if patron == True and active == '1': #solo nos han pedido verificar el clone
|
||||
return (item, data) #nos vamos, con el mismo clone, si está activo
|
||||
if (item.action == 'episodios' or item.action == 'findvideos') and item.contentType not in contentType: #soporta el fail_over de este contenido?
|
||||
logger.error("ERROR 99: " + item.action.upper() + ": Acción no soportada para Fail-Over en canal: " + item.url)
|
||||
return (item, data) #no soporta el fail_over de este contenido, no podemos hacer nada
|
||||
return (item, data) #no soporta el fail_over de este contenido, no podemos hacer nada
|
||||
break
|
||||
|
||||
if not channel_failed:
|
||||
logger.error('Patrón: ' + str(patron) + ' / fail_over_list: ' + str(fail_over_list))
|
||||
logger.error(item)
|
||||
return (item, data) #Algo no ha funcionado, no podemos hacer nada
|
||||
return (item, data) #Algo no ha funcionado, no podemos hacer nada
|
||||
|
||||
#Recorremos el Array identificando canales activos que funcionen, distintos del caído, que soporten el contenido
|
||||
for active, channel, channel_host, contentType, action_excluded in fail_over_list:
|
||||
@@ -1447,7 +1463,12 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F
|
||||
- force: indica al canal que analize toda la serie y que videolibrary_service la reescriba
|
||||
- auto: indica a videolibrary_service que la reescriba
|
||||
- no: no acción para videolibrary_service, solo redirige en visionado de videolibrary
|
||||
ejemplo: ('1', 'mejortorrent', 'mejortorrent1', 'http://www.mejortorrent.com/', 'https://mejortorrent1.com/', 'auto')
|
||||
- del: borra las estrucuturas de un determinado canal en videolibrary_service, quizás creadas por errores de un canal
|
||||
ejemplos:
|
||||
('1', 'mejortorrent', 'mejortorrent1', 'http://www.mejortorrent.com/', 'https://mejortorrent1.com/', '(http.?:\/\/.*?\/)', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-(?:[^-]+-)([^0-9]+-)', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-(?:[^-]+-)[^0-9]+-\\d+-(Temporada-).html', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-(?:[^-]+-)[^0-9]+-(\\d+)-', '', 'tvshow, season', '', 'force'),
|
||||
('1', 'mejortorrent', 'mejortorrent1', 'http://www.mejortorrent.com/', 'https://mejortorrent1.com/', '(http.?:\/\/.*?\/)', 'http.?:\/\/.*?\/.*?-torrent.?-[^-]+-([^.]+).html', '', '', '', 'movie', '', 'force')",
|
||||
('1', 'torrentrapid', 'torrentlocura', 'http://torrentrapid.com/', 'http://torrentlocura.com/', '', '', '', '', '', '*', '', 'no'),
|
||||
('1', 'newpct1', '', '', '', '', '', '', '', '', '*', '', 'del'),
|
||||
|
||||
La llamada recibe el parámetro Item, el .nfo y los devuleve actualizados, así como opcionalmente el parámetro "overwrite· que puede forzar la reescritura de todos los archivos de la serie, y el parámetro "path" si viene de videolibrary_service. Por último, recibe opcionalmente el parámetro "lookup" si se quiere solo averigurar si habrá migración para ese título, pero sin realizarla.
|
||||
|
||||
@@ -1458,6 +1479,22 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F
|
||||
ow_force_param = True
|
||||
channel_enabled = False
|
||||
update_stat = 0
|
||||
delete_stat = 0
|
||||
canal_org_des_list = []
|
||||
json_path_list = []
|
||||
|
||||
if item.ow_force == '1': #Ha podido qudar activado de una pasada anteriores
|
||||
del item.ow_force
|
||||
logger.error('** item.ow_force: ' + item.path) #aviso que ha habido una incidencia
|
||||
if it.ow_force == '1': #Ha podido qudar activado de una pasada anteriores
|
||||
del it.ow_force
|
||||
if path and it.contentType != 'movies':
|
||||
try:
|
||||
nfo = filetools.join(path, '/tvshow.nfo')
|
||||
filetools.write(nfo, head_nfo + it.tojson()) #escribo el .nfo de la peli por si aborta update
|
||||
logger.error('** .nfo ACTUALIZADO: it.ow_force: ' + nfo) #aviso que ha habido una incidencia
|
||||
except:
|
||||
logger.error('** .nfo ERROR actualizar: it.ow_force: ' + nfo) #aviso que ha habido una incidencia
|
||||
|
||||
#Array con los datos de los canales alternativos
|
||||
#Cargamos en .json de Newpct1 para ver las listas de valores en settings
|
||||
@@ -1469,133 +1506,223 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F
|
||||
intervencion = settings['default'] #Carga lista de clones y canales intervenidos
|
||||
|
||||
#primero tratamos los clones de Newpct1
|
||||
channel_alt = item.channel #Salvamos en nombre del canal o clone
|
||||
channel = "'%s'" % item.channel
|
||||
if channel in fail_over_list: #Si es un clone de Newpct1, se actualiza el canal
|
||||
channel_alt = item.channel
|
||||
if item.url:
|
||||
channel_alt = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').lower() #Salvamos en nombre del canal o clone
|
||||
channel = "'%s'" % channel_alt
|
||||
category = ''
|
||||
if channel_alt != 'videolibrary':
|
||||
item.category = channel_alt.capitalize()
|
||||
category = "'%s'" % channel_alt
|
||||
channel_py_alt = ''
|
||||
if channel in fail_over_list : #Si es un clone de Newpct1, se actualiza el canal y la categoría
|
||||
item.channel = channel_py
|
||||
|
||||
channel_py_alt = "'%s'" % channel_py
|
||||
if item.channel_host: #y se borran resto de pasadas anteriores
|
||||
del item.channel_host
|
||||
|
||||
#Ahora tratamos las webs intervenidas, tranformamos la url, el nfo y borramos los archivos obsoletos de la serie
|
||||
if channel not in intervencion and channel_alt != 'videolibrary': #Hacemos una lookup para ver si...
|
||||
if channel not in intervencion and channel_py_alt not in intervencion and category not in intervencion and channel_alt != 'videolibrary': #lookup
|
||||
return (item, it, overwrite) #... el canal/clone está listado
|
||||
|
||||
import ast
|
||||
intervencion_list = ast.literal_eval(intervencion) #Convertir a Array el string
|
||||
intervencion_list = ast.literal_eval(intervencion) #Convertir a Array el string
|
||||
#logger.debug(intervencion_list)
|
||||
|
||||
if lookup == True:
|
||||
overwrite = False #Solo avisamos si hay cambios
|
||||
overwrite = False #Solo avisamos si hay cambios
|
||||
for activo, canal_org, canal_des, url_org, url_des, patron1, patron2, patron3, patron4, patron5, content_inc, content_exc, ow_force in intervencion_list:
|
||||
if activo == '1' and (canal_org == channel_alt or channel_alt == 'videolibrary'): #Es esta nuestra entrada?
|
||||
if channel_alt == 'videolibrary': #Viene de videolibrary.list_movies
|
||||
for canal_vid, url_vid in item.library_urls.items():
|
||||
if canal_org != canal_vid: #Miramos si canal_org de la regla está en item.library_urls
|
||||
continue
|
||||
else:
|
||||
channel_alt = canal_org #Sí, ponermos el nombre del canal de origen
|
||||
channel_b = "'%s'" % canal_org
|
||||
if channel_b in fail_over_list: #Si es un clone de Newpct1, se actualiza a newpct1
|
||||
channel_alt = channel_py
|
||||
if channel_alt == 'videolibrary':
|
||||
continue
|
||||
if item.contentType == "list": #Si viene de Videolibrary, le cambiamos ya el canal
|
||||
if item.channel != channel_py:
|
||||
item.channel = canal_des #Cambiamos el canal. Si es clone, lo hace el canal
|
||||
continue #Salimos sin hacer nada más. item está casi vacío
|
||||
if item.contentType not in content_inc and "*" not in content_inc: #Está el contenido el la lista de incluidos
|
||||
continue
|
||||
if item.contentType in content_exc: #Está el contenido excluido?
|
||||
continue
|
||||
if item.channel != channel_py:
|
||||
channel_enabled = channeltools.is_enabled(channel_alt) #Verificamos que el canal esté inactivo
|
||||
channel_enabled_alt = config.get_setting('enabled', channel_alt)
|
||||
channel_enabled = channel_enabled * channel_enabled_alt #Si está inactivo en algún sitio, tomamos eso
|
||||
if channel_enabled == 1 and canal_org != canal_des: #Si el canal está activo, puede ser solo...
|
||||
continue #... una intervención que afecte solo a una región
|
||||
if ow_force == 'no' and it.library_urls: #Esta regla solo vale para findvideos...
|
||||
continue #... salidmos si estamos actualizando
|
||||
if lookup == True: #Queremos que el canal solo visualice sin migración?
|
||||
if ow_force != 'no':
|
||||
overwrite = True #Avisamos que hay cambios
|
||||
continue #Salimos sin tocar archivos
|
||||
url_total = ''
|
||||
if item.url:
|
||||
url_total = item.url
|
||||
elif not item.url and item.library_urls:
|
||||
url_total = item.library_urls[canal_org]
|
||||
url_total = url_total.replace(url_org, url_des) #reemplazamos una parte de url
|
||||
url = ''
|
||||
if patron1: #Hay expresión regex?
|
||||
url += scrapertools.find_single_match(url_total, patron1) #La aplicamos a url
|
||||
if patron2: #Hay más expresión regex?
|
||||
url += scrapertools.find_single_match(url_total, patron2) #La aplicamos a url
|
||||
if patron3: #Hay más expresión regex?
|
||||
url += scrapertools.find_single_match(url_total, patron3) #La aplicamos a url
|
||||
if patron4: #Hay más expresión regex?
|
||||
url += scrapertools.find_single_match(url_total, patron4) #La aplicamos a url
|
||||
if patron5: #Hay más expresión regex?
|
||||
url += scrapertools.find_single_match(url_total, patron5) #La aplicamos a url
|
||||
if url:
|
||||
url_total = url #Guardamos la suma de los resultados intermedios
|
||||
update_stat += 1 #Ya hemos actualizado algo
|
||||
canal_org_def = canal_org
|
||||
canal_des_def = canal_des
|
||||
ow_force_def = ow_force
|
||||
#Es esta nuestra entrada?
|
||||
if activo == '1' and (canal_org == channel_alt or canal_org == item.channel or channel_alt == 'videolibrary' or ow_force == 'del'):
|
||||
|
||||
if update_stat > 0: #Ha habido alguna actualización? Entonces salvamos
|
||||
if item.channel == channel_py or channel in fail_over_list: #Si es Newpct1...
|
||||
if item.contentType == "tvshow":
|
||||
url_total = re.sub(r'\/\d+\/?$', '', url_total) #parece que con el título ecuentra la serie, normalmente...
|
||||
if item.url:
|
||||
item.url = url_total #Salvamos la url convertida
|
||||
if item.library_urls:
|
||||
item.library_urls.pop(canal_org_def, None)
|
||||
item.library_urls = {canal_des_def: url_total}
|
||||
it.library_urls = item.library_urls
|
||||
if item.channel != channel_py and item.channel != 'videolibrary':
|
||||
item.channel = canal_des_def #Cambiamos el canal. Si es clone, lo hace el canal
|
||||
if channel_alt == item.category.lower(): #Actualizamos la Categoría y si la tenía
|
||||
item.category = item.channel.capitalize()
|
||||
if ow_force_def == 'force' and item.contentType != "movie": #Queremos que el canal revise la serie entera?
|
||||
item.ow_force = '1' #Se lo decimos
|
||||
if ow_force_def in ['force', 'auto']: #Sobreescribir la series?
|
||||
overwrite = True #Sí, lo marcamos
|
||||
if ow_force == 'del': #Si es un borrado de estructuras erroneas, hacemos un proceso aparte
|
||||
canal_des_def = canal_des #Si hay canal de sustitución para item.library_urls, lo usamos
|
||||
if not canal_des_def and canal_org in item.library_urls and len(item.library_urls) == 1: #Si no, lo extraemos de la url
|
||||
canal_des_def = scrapertools.find_single_match(item.library_urls[canal_org], 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').lower() #salvamos la url actual de la estructura a borrar
|
||||
url_total = ''
|
||||
if item.url:
|
||||
url_total = item.url #Si existe item.url, lo salvamos para futuro uso
|
||||
if item.library_urls and canal_org in item.library_urls: #Si existe una entrada con el canal a borrar, lo procesamos
|
||||
if lookup == True: #Queremos que el canal solo visualice sin migración?
|
||||
overwrite = True #Avisamos que hay cambios
|
||||
continue
|
||||
logger.error('** REGLA: ' + canal_org + ', ' + canal_des+ ', ' + ow_force)
|
||||
logger.error('item.library_urls PREVIA: ' + str(item.library_urls))
|
||||
url_total = item.library_urls[canal_org] #salvamos la url actual de la estructura a borrar
|
||||
url_total_status = False
|
||||
if len(item.library_urls) == 1 or canal_des: #si el nuevo canal no existe ya...
|
||||
item.library_urls.update({canal_des_def: url_total}) #restauramos la url con el nuevo canal
|
||||
url_total_status = True #marcamos esta url como válida
|
||||
overwrite = True #Le decimos que sobreescriba todos los .jsons
|
||||
item.ow_force = '1' #Le decimos que revise todas las temporadas
|
||||
if len(item.library_urls) > 1:
|
||||
item.library_urls.pop(canal_org, None) #borramos la url del canal a borrar
|
||||
overwrite = True #Le decimos que sobreescriba todos los .jsons
|
||||
item.ow_force = '1' #Le decimos que revise todas las temporadas
|
||||
if it.library_urls:
|
||||
it.library_urls = item.library_urls #lo salvamos en el .nfo, si lo hay
|
||||
|
||||
if item.url and item.url == url_total and url_total_status == False: #si la url es la del canal borrado...
|
||||
for canal_vid, url_vid in item.library_urls.items():
|
||||
canal_vid_alt = "'%s'" % canal_vid
|
||||
if canal_vid_alt not in intervencion: #... la sustituimos por la primera válida
|
||||
item.url = url_vid
|
||||
break
|
||||
if canal_vid_alt in fail_over_list: #Si es un clone de Newpct1, salvamos la nueva categoría
|
||||
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').lower() #Salvamos categoría
|
||||
else:
|
||||
item.category = canal_vid.capitalize() #si no, salvamos nueva categoría
|
||||
logger.error('item.library_urls ACTUALIZADA: ' + str(item.library_urls))
|
||||
|
||||
if lookup == False: #si es migración completa...
|
||||
delete_stat += 1 #Ya hemos actualizado algo, o habrá que hacerlo...
|
||||
canal_org_des_list += [(canal_org, canal_des, url_total, ow_force)] #salvamos el resultado para su proceso
|
||||
|
||||
#logger.debug(canal_org_def + canal_des_def + ow_force_def)
|
||||
if it.library_urls and path != False and ow_force_def != 'no': #Continuamos si hay .nfo, path, y queremos actualizarlo
|
||||
if item.update_next:
|
||||
del item.update_next #Borramos estos campos para forzar la actualización ya
|
||||
if it.update_next:
|
||||
del it.update_next
|
||||
else:
|
||||
if channel_alt == 'videolibrary': #Viene de videolibrary.list_movies: IMPRESCINDIBLE
|
||||
for canal_vid, url_vid in item.library_urls.items():
|
||||
if canal_org != canal_vid: #Miramos si canal_org de la regla está en item.library_urls
|
||||
continue
|
||||
else:
|
||||
channel_alt = canal_org #Sí, ponermos el nombre del canal de origen
|
||||
channel_b = "'%s'" % canal_org
|
||||
if channel_b in fail_over_list: #Si es un clone de Newpct1, se actualiza a newpct1
|
||||
channel_alt = channel_py
|
||||
if channel_alt == 'videolibrary':
|
||||
continue
|
||||
if item.contentType == "list": #Si viene de Videolibrary, le cambiamos ya el canal
|
||||
if item.channel != channel_py:
|
||||
item.channel = canal_des #Cambiamos el canal. Si es clone, lo hace el canal
|
||||
continue #Salimos sin hacer nada más. item está casi vacío
|
||||
if item.contentType not in content_inc and "*" not in content_inc: #Está el contenido el la lista de incluidos
|
||||
continue
|
||||
if item.contentType in content_exc: #Está el contenido excluido?
|
||||
continue
|
||||
if item.channel != channel_py:
|
||||
channel_enabled = channeltools.is_enabled(channel_alt) #Verificamos que el canal esté inactivo
|
||||
channel_enabled_alt = config.get_setting('enabled', channel_alt)
|
||||
channel_enabled = channel_enabled * channel_enabled_alt #Si está inactivo en algún sitio, tomamos eso
|
||||
if channel_enabled == 1 and canal_org != canal_des: #Si el canal está activo, puede ser solo...
|
||||
continue #... una intervención que afecte solo a una región
|
||||
if ow_force == 'no' and it.library_urls: #Esta regla solo vale para findvideos...
|
||||
continue #... salidmos si estamos actualizando
|
||||
if lookup == True: #Queremos que el canal solo visualice sin migración?
|
||||
if ow_force != 'no':
|
||||
overwrite = True #Avisamos que hay cambios
|
||||
continue #Salimos sin tocar archivos
|
||||
url_total = ''
|
||||
if item.url:
|
||||
url_total = item.url
|
||||
elif not item.url and item.library_urls:
|
||||
url_total = item.library_urls[canal_org]
|
||||
url_total = url_total.replace(url_org, url_des) #reemplazamos una parte de url
|
||||
url = ''
|
||||
if patron1: #Hay expresión regex?
|
||||
url += scrapertools.find_single_match(url_total, patron1) #La aplicamos a url
|
||||
if patron2: #Hay más expresión regex?
|
||||
url += scrapertools.find_single_match(url_total, patron2) #La aplicamos a url
|
||||
if patron3: #Hay más expresión regex?
|
||||
url += scrapertools.find_single_match(url_total, patron3) #La aplicamos a url
|
||||
if patron4: #Hay más expresión regex?
|
||||
url += scrapertools.find_single_match(url_total, patron4) #La aplicamos a url
|
||||
if patron5: #Hay más expresión regex?
|
||||
url += scrapertools.find_single_match(url_total, patron5) #La aplicamos a url
|
||||
if url:
|
||||
url_total = url #Guardamos la suma de los resultados intermedios
|
||||
update_stat += 1 #Ya hemos actualizado algo
|
||||
canal_org_des_list += [(canal_org, canal_des, url_total, ow_force)] #salvamos el resultado para su proceso
|
||||
|
||||
if update_stat > 0 or delete_stat > 0: #Ha habido alguna actualización o borrado? Entonces salvamos
|
||||
if (update_stat > 0 and path != False) or item.ow_force == '1':
|
||||
logger.error('** Lista de Actualizaciones a realizar: ' + str(canal_org_des_list))
|
||||
for canal_org_def, canal_des_def, url_total, ow_force_def in canal_org_des_list: #pasamos por todas las "parejas" cambiadas
|
||||
if ow_force_def != 'del':
|
||||
url_total_def = url_total
|
||||
if item.channel == channel_py or channel in fail_over_list: #Si es Newpct1...
|
||||
if item.contentType == "tvshow":
|
||||
url_total_def = re.sub(r'\/\d+\/?$', '', url_total) #parece que con el título encuentra la serie, normalmente...
|
||||
if item.url:
|
||||
item.url = url_total_def #Salvamos la url convertida
|
||||
if item.library_urls:
|
||||
item.library_urls.pop(canal_org_def, None)
|
||||
item.library_urls.update({canal_des_def: url_total})
|
||||
it.library_urls = item.library_urls
|
||||
if item.channel != channel_py and item.channel != 'videolibrary':
|
||||
item.channel = canal_des_def #Cambiamos el canal. Si es clone, lo hace el canal
|
||||
if channel_alt == item.category.lower(): #Actualizamos la Categoría y si la tenía
|
||||
item.category = item.channel.capitalize()
|
||||
if ow_force_def == 'force': #Queremos que el canal revise la serie entera?
|
||||
item.ow_force = '1' #Se lo decimos
|
||||
if ow_force_def in ['force', 'auto']: #Sobreescribir la series?
|
||||
overwrite = True #Sí, lo marcamos
|
||||
|
||||
if it.library_urls and path != False and ow_force_def != 'no': #Continuamos si hay .nfo, path, y queremos actualizarlo
|
||||
item.update_next = '1'
|
||||
del item.update_next #Borramos estos campos para forzar la actualización ya
|
||||
it.update_next = '1'
|
||||
del it.update_next
|
||||
|
||||
# Listamos todos los ficheros de la serie, asi evitamos tener que comprobar si existe uno por uno
|
||||
canal_erase_list = []
|
||||
raiz, carpetas_series, ficheros = filetools.walk(path).next()
|
||||
ficheros = [filetools.join(path, f) for f in ficheros] #Almacenamos la lista de archivos de la carpeta
|
||||
canal_erase = '[%s]' % canal_org_def
|
||||
ficheros = [filetools.join(path, f) for f in ficheros] #Almacenamos la lista de archivos de la carpeta
|
||||
for archivo in ficheros:
|
||||
if canal_erase in archivo: #Borramos los .json que sean del canal intervenido
|
||||
json_path = archivo.replace(canal_org_def, canal_des_def) #Salvamos el path del .json para luego crearlo
|
||||
filetools.remove(archivo)
|
||||
for canal_org_def, canal_des_def, url_total, ow_force_def in canal_org_des_list: #pasamos por todas las "parejas" a borrar
|
||||
canal_erase = '[%s]' % canal_org_def
|
||||
canal_new = '[%s]' % canal_des_def
|
||||
if canal_erase in archivo: #Borramos los .json que sean de los canal afectados
|
||||
if canal_des_def:
|
||||
item_json = Item().fromjson(filetools.read(archivo)) #leemos el .json ante de borrarlo para salvar...
|
||||
title = item_json.title #... el título con su formato
|
||||
language = item_json.language #... los idiomas, que no están en el .nfo
|
||||
wanted = item_json.wanted #... y wanted con el título original
|
||||
json_path = archivo.replace(canal_erase, canal_new) #Salvamos el path del .json para luego crearlo
|
||||
json_path_list += [(canal_org_def, canal_des_def, url_total, json_path, title, language, wanted)]
|
||||
filetools.remove(archivo) #Borramos el .json
|
||||
logger.error('** BORRAMOS: ' + str(archivo))
|
||||
if ow_force_def == 'del': #Si la función es 'del' ...
|
||||
overwrite = True #Le decimos que sobreescriba todos los .jsons
|
||||
item.ow_force = '1' #Le decimos que revise todas las temporadas
|
||||
|
||||
#Si se ha cambiado algo, se actualizan los .nfo
|
||||
if item.contentType == "movie" and ".nfo" in archivo:
|
||||
filetools.write(archivo, head_nfo + it.tojson()) #escribo el .nfo de la peli por si aborta update
|
||||
if it.ow_force: del it.ow_force
|
||||
filetools.write(archivo, head_nfo + it.tojson()) #escribo el .nfo de la peli por si aborta update
|
||||
if item.contentType != "movie" and "tvshow.nfo" in archivo:
|
||||
filetools.write(archivo, head_nfo + it.tojson()) #escribo el tvshow.nfo por si aborta update
|
||||
filetools.write(archivo, head_nfo + it.tojson()) #escribo el tvshow.nfo por si aborta update
|
||||
|
||||
#Aquí convertimos las películas. Después de borrado el .json, dejamos que videolibrarytools lo regenere
|
||||
if item.contentType == "movie": #Dejamos que regenere el archivo .json
|
||||
if item.contentType == "movie": #Dejamos que regenere el archivo .json
|
||||
item_movie = item.clone()
|
||||
item_movie.channel = canal_des_def #mombre del canal migrado
|
||||
del item_movie.library_playcounts #Borramos lo que no es necesario en el .json
|
||||
if item_movie.ow_force: del item_movie.ow_force
|
||||
item_movie.update_last = '1'
|
||||
del item_movie.update_last
|
||||
del item_movie.library_playcounts #Borramos lo que no es necesario en el .json
|
||||
del item_movie.library_urls
|
||||
item_movie.url = url_total #url migrada
|
||||
del item_movie.nfo
|
||||
del item_movie.path
|
||||
del item_movie.strm_path
|
||||
del item_movie.text_color
|
||||
filetools.write(json_path, item_movie.tojson()) #Salvamos el nuevo .json de la película
|
||||
if not item_movie.context: item_movie.context = "['buscar_trailer']"
|
||||
if not item_movie.extra: item_movie.extra = "peliculas"
|
||||
|
||||
if json_path_list:
|
||||
logger.error('** .json LIST: ' + str(json_path_list))
|
||||
for canal_org_def, canal_des_def, url_total, json_path, title, language, wanted in json_path_list: #pasamos por todas canales
|
||||
logger.error('** ESCRIBIMOS: ' + json_path)
|
||||
item_movie.channel = canal_des_def #mombre del canal migrado
|
||||
if not item_movie.category: item_movie.category = canal_des_def.capitalize() #categoría
|
||||
item_movie.url = url_total #url migrada
|
||||
if title: item_movie.title = title #restaurmos el título con formato
|
||||
if language: item_movie.language = language #restaurmos los idiomas
|
||||
if wanted: item_movie.wanted = wanted #restaurmos wanted
|
||||
item_movie.added_replacing = canal_org_def #guardamos la traza del canal reemplazado
|
||||
filetools.write(json_path, item_movie.tojson()) #Salvamos el nuevo .json de la película
|
||||
|
||||
if (update_stat > 0 and path != False and ow_force_def in ['force', 'auto']) or item.ow_force == '1' or len(json_path_list) > 0:
|
||||
logger.error('ITEM cambiado')
|
||||
logger.error(item)
|
||||
|
||||
if update_stat > 0 and path != False and ow_force_def != 'no':
|
||||
logger.debug(item)
|
||||
|
||||
return (item, it, overwrite)
|
||||
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ def render_items(itemlist, parent_item):
|
||||
valid_genre = True
|
||||
|
||||
|
||||
if unify_enabled:
|
||||
if unify_enabled and parent_item.channel != 'alfavorites':
|
||||
# Formatear titulo con unify
|
||||
item = unify.title_format(item)
|
||||
else:
|
||||
@@ -238,10 +238,14 @@ def render_items(itemlist, parent_item):
|
||||
if config.get_setting("forceview"):
|
||||
# ...forzamos segun el viewcontent
|
||||
xbmcplugin.setContent(int(sys.argv[1]), parent_item.viewcontent)
|
||||
elif parent_item.channel not in ["channelselector", ""]:
|
||||
|
||||
elif parent_item.channel not in ["channelselector", "", "alfavorites"]:
|
||||
# ... o segun el canal
|
||||
xbmcplugin.setContent(int(sys.argv[1]), "movies")
|
||||
|
||||
elif parent_item.channel == "alfavorites" and parent_item.action == 'mostrar_perfil':
|
||||
xbmcplugin.setContent(int(sys.argv[1]), "movies")
|
||||
|
||||
# Fijamos el "breadcrumb"
|
||||
if parent_item.list_type == '':
|
||||
breadcrumb = parent_item.category.capitalize()
|
||||
@@ -433,12 +437,22 @@ def set_context_commands(item, parent_item):
|
||||
if "channel" in command:
|
||||
command["from_channel"] = item.channel
|
||||
|
||||
# Si no se está dentro de Alfavoritos y hay los contextos de alfavoritos, descartarlos.
|
||||
# (pasa al ir a un enlace de alfavoritos, si este se clona en el canal)
|
||||
if parent_item.channel != 'alfavorites' and 'i_perfil' in command and 'i_enlace' in command:
|
||||
continue
|
||||
|
||||
if "goto" in command:
|
||||
context_commands.append((command["title"], "XBMC.Container.Refresh (%s?%s)" %
|
||||
(sys.argv[0], item.clone(**command).tourl())))
|
||||
else:
|
||||
context_commands.append(
|
||||
(command["title"], "XBMC.RunPlugin(%s?%s)" % (sys.argv[0], item.clone(**command).tourl())))
|
||||
|
||||
# No añadir más opciones predefinidas si se está dentro de Alfavoritos
|
||||
if parent_item.channel == 'alfavorites':
|
||||
return context_commands
|
||||
|
||||
# Opciones segun criterios, solo si el item no es un tag (etiqueta), ni es "Añadir a la videoteca", etc...
|
||||
if item.action and item.action not in ["add_pelicula_to_library", "add_serie_to_library", "buscartrailer"]:
|
||||
# Mostrar informacion: si el item tiene plot suponemos q es una serie, temporada, capitulo o pelicula
|
||||
@@ -500,6 +514,12 @@ def set_context_commands(item, parent_item):
|
||||
(sys.argv[0], item.clone(channel="favorites", action="addFavourite",
|
||||
from_channel=item.channel,
|
||||
from_action=item.action).tourl())))
|
||||
# Añadir a Alfavoritos (Mis enlaces)
|
||||
if item.channel not in ["favorites", "videolibrary", "help", ""] and parent_item.channel != "favorites":
|
||||
context_commands.append(('[COLOR blue]Guardar enlace[/COLOR]', "XBMC.RunPlugin(%s?%s)" %
|
||||
(sys.argv[0], item.clone(channel="alfavorites", action="addFavourite",
|
||||
from_channel=item.channel,
|
||||
from_action=item.action).tourl())))
|
||||
|
||||
# Buscar en otros canales
|
||||
if item.contentType in ['movie', 'tvshow'] and item.channel != 'search':
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"active": true,
|
||||
"find_videos": {
|
||||
"ignore_urls": [],
|
||||
"patterns": [
|
||||
{
|
||||
"pattern": "http://documentary.es/(\\d+[a-z0-9\\-]+)",
|
||||
"url": "http://documentary.es/\\1?embed"
|
||||
}
|
||||
]
|
||||
},
|
||||
"free": true,
|
||||
"id": "documentary",
|
||||
"name": "documentary",
|
||||
"settings": [
|
||||
{
|
||||
"default": false,
|
||||
"enabled": true,
|
||||
"id": "black_list",
|
||||
"label": "@60654",
|
||||
"type": "bool",
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"enabled": true,
|
||||
"id": "favorites_servers_list",
|
||||
"label": "@60655",
|
||||
"lvalues": [
|
||||
"No",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5"
|
||||
],
|
||||
"type": "list",
|
||||
"visible": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from core import scrapertools
|
||||
from platformcode import logger
|
||||
|
||||
|
||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
video_urls = []
|
||||
|
||||
data = scrapertools.cache_page(page_url)
|
||||
|
||||
try:
|
||||
# var videoVars = {"videoNonceVar":"94767795ce","post_id":"2835"};
|
||||
videoNonceVar = scrapertools.get_match(data,
|
||||
'var\s*videoVars\s*\=\s*\{"videoNonceVar"\:"([^"]+)","post_id"\:"\d+"')
|
||||
post_id = scrapertools.get_match(data, 'var\s*videoVars\s*\=\s*\{"videoNonceVar"\:"[^"]+","post_id"\:"(\d+)"')
|
||||
|
||||
# http://documentary.es/wp-admin/admin-ajax.php?postId=2835&videoNonce=94767795ce&action=getVideo&_=1385893877929
|
||||
import random
|
||||
url = "http://documentary.es/wp-admin/admin-ajax.php?postId=" + post_id + "&videoNonce=" + videoNonceVar + "&action=getVideo&_=" + str(
|
||||
random.randint(10000000000, 9999999999999))
|
||||
data = scrapertools.cache_page(url)
|
||||
|
||||
# {"videoUrl":"http:\/\/www.dailymotion.com\/embed\/video\/xioggh?autoplay=1&defaultSubtitle=es"}
|
||||
data = data.replace("\\", "")
|
||||
except:
|
||||
pass
|
||||
|
||||
from core import servertools
|
||||
real_urls = servertools.find_video_items(data=data)
|
||||
if len(real_urls) > 0:
|
||||
item = real_urls[len(real_urls) - 1]
|
||||
servermodule = __import__('servers.%s' % item.server, None, None, ["servers.%s" % item.server])
|
||||
# exec "import " + item.server
|
||||
# exec "servermodule = " + item.server
|
||||
video_urls = servermodule.get_video_url(item.url)
|
||||
|
||||
for video_url in video_urls:
|
||||
logger.info("%s - %s" % (video_url[0], video_url[1]))
|
||||
|
||||
return video_urls
|
||||
@@ -1,45 +0,0 @@
|
||||
{
|
||||
"active": true,
|
||||
"find_videos": {
|
||||
"ignore_urls": [],
|
||||
"patterns": [
|
||||
{
|
||||
"pattern": "(fileflyer.com/view/[a-zA-Z0-9]+)",
|
||||
"url": "http://www.\\1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"free": true,
|
||||
"id": "fileflyer",
|
||||
"name": "fileflyer",
|
||||
"premium": [
|
||||
"realdebrid",
|
||||
"alldebrid"
|
||||
],
|
||||
"settings": [
|
||||
{
|
||||
"default": false,
|
||||
"enabled": true,
|
||||
"id": "black_list",
|
||||
"label": "@60654",
|
||||
"type": "bool",
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"enabled": true,
|
||||
"id": "favorites_servers_list",
|
||||
"label": "@60655",
|
||||
"lvalues": [
|
||||
"No",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5"
|
||||
],
|
||||
"type": "list",
|
||||
"visible": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from core import scrapertools
|
||||
from platformcode import logger
|
||||
|
||||
|
||||
def test_video_exists(page_url):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
|
||||
# Vídeo borrado: http://www.fileflyer.com/view/fioZRBu
|
||||
# Video erróneo:
|
||||
data = scrapertools.cache_page(page_url)
|
||||
if '<a href="/RemoveDetail.aspx">' in data:
|
||||
return False, "El archivo ya no está disponible<br/>en fileflyer (ha sido borrado)"
|
||||
else:
|
||||
return True, ""
|
||||
|
||||
|
||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
video_urls = []
|
||||
|
||||
data = scrapertools.cache_page(page_url)
|
||||
location = scrapertools.get_match(data,
|
||||
'<td class="dwnlbtn"[^<]+<a id="[^"]+" title="[^"]+" class="[^"]+" href="([^"]+)"')
|
||||
|
||||
video_urls.append([scrapertools.get_filename_from_url(location)[-4:] + " [fileflyer]", location])
|
||||
|
||||
for video_url in video_urls:
|
||||
logger.info("%s - %s" % (video_url[0], video_url[1]))
|
||||
|
||||
return video_urls
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"active": true,
|
||||
"find_videos": {
|
||||
"ignore_urls": [],
|
||||
"patterns": [
|
||||
{
|
||||
"pattern": "filez.tv/(?:embed/u=)?([A-z0-9]+)",
|
||||
"url": "http://filez.tv/embed/u=\\1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"free": true,
|
||||
"id": "filez",
|
||||
"name": "filez",
|
||||
"settings": [
|
||||
{
|
||||
"default": false,
|
||||
"enabled": true,
|
||||
"id": "black_list",
|
||||
"label": "@60654",
|
||||
"type": "bool",
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"enabled": true,
|
||||
"id": "favorites_servers_list",
|
||||
"label": "@60655",
|
||||
"lvalues": [
|
||||
"No",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5"
|
||||
],
|
||||
"type": "list",
|
||||
"visible": false
|
||||
}
|
||||
],
|
||||
"thumbnail": "http://i.imgur.com/HasfjUH.png"
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from platformcode import logger
|
||||
|
||||
|
||||
def test_video_exists(page_url):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
data = httptools.downloadpage(page_url, follow_redirects=False)
|
||||
|
||||
if data.headers.get("location"):
|
||||
return False, "[filez] El archivo ha sido eliminado o no existe"
|
||||
|
||||
return True, ""
|
||||
|
||||
|
||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||
logger.info("url=" + page_url)
|
||||
|
||||
data = httptools.downloadpage(page_url).data
|
||||
|
||||
video_urls = []
|
||||
media_urls = scrapertools.find_multiple_matches(data, 'file\s*:\s*"([^"]+)",\s*type\s*:\s*"([^"]+)"')
|
||||
for media_url, ext in media_urls:
|
||||
video_urls.append([".%s [filez]" % ext, media_url])
|
||||
|
||||
if not video_urls:
|
||||
media_urls = scrapertools.find_multiple_matches(data, '<embed.*?src="([^"]+)"')
|
||||
for media_url in media_urls:
|
||||
media_url = media_url.replace("https:", "http:")
|
||||
ext = httptools.downloadpage(media_url, only_headers=True).headers.get("content-disposition", "")
|
||||
ext = scrapertools.find_single_match(ext, 'filename="([^"]+)"')
|
||||
if ext:
|
||||
ext = ext[-4:]
|
||||
video_urls.append(["%s [filez]" % ext, media_url])
|
||||
|
||||
return video_urls
|
||||
@@ -1,46 +0,0 @@
|
||||
{
|
||||
"active": true,
|
||||
"find_videos": {
|
||||
"ignore_urls": [],
|
||||
"patterns": [
|
||||
{
|
||||
"pattern": "movshare.net/(?:embed|video)/([a-z0-9]+)",
|
||||
"url": "http://www.movshare.net/video/\\1"
|
||||
},
|
||||
{
|
||||
"pattern": "movshare.net/embed.php\\?v\\=([a-z0-9]+)",
|
||||
"url": "http://www.movshare.net/video/\\1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"free": true,
|
||||
"id": "movshare",
|
||||
"name": "movshare",
|
||||
"settings": [
|
||||
{
|
||||
"default": false,
|
||||
"enabled": true,
|
||||
"id": "black_list",
|
||||
"label": "@60654",
|
||||
"type": "bool",
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"enabled": true,
|
||||
"id": "favorites_servers_list",
|
||||
"label": "@60655",
|
||||
"lvalues": [
|
||||
"No",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5"
|
||||
],
|
||||
"type": "list",
|
||||
"visible": false
|
||||
}
|
||||
],
|
||||
"thumbnail": "server_movshare.png"
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from core import scrapertools
|
||||
from platformcode import logger
|
||||
|
||||
|
||||
def test_video_exists(page_url):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
|
||||
data = scrapertools.cache_page(page_url)
|
||||
|
||||
if "This file no longer exists on our servers" in data:
|
||||
return False, "El fichero ha sido borrado de movshare"
|
||||
|
||||
return True, ""
|
||||
|
||||
|
||||
# Returns an array of possible video url's from the page_url
|
||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
|
||||
videoid = scrapertools.get_match(page_url, "http://www.movshare.net/video/([a-z0-9]+)")
|
||||
video_urls = []
|
||||
|
||||
# Descarga la página
|
||||
headers = []
|
||||
headers.append(
|
||||
['User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'])
|
||||
html = scrapertools.cache_page(page_url, headers=headers)
|
||||
|
||||
# La vuelve a descargar, como si hubieras hecho click en el botón
|
||||
# html = scrapertools.cache_page(page_url , headers = headers)
|
||||
filekey = scrapertools.find_single_match(html, 'flashvars.filekey="([^"]+)"')
|
||||
|
||||
# get stream url from api
|
||||
api = 'http://www.movshare.net/api/player.api.php?key=%s&file=%s' % (filekey, videoid)
|
||||
headers.append(['Referer', page_url])
|
||||
|
||||
html = scrapertools.cache_page(api, headers=headers)
|
||||
logger.info("html=" + html)
|
||||
stream_url = scrapertools.find_single_match(html, 'url=(.+?)&title')
|
||||
|
||||
if stream_url != "":
|
||||
video_urls.append([scrapertools.get_filename_from_url(stream_url)[-4:] + " [movshare]", stream_url])
|
||||
|
||||
for video_url in video_urls:
|
||||
logger.info("%s - %s" % (video_url[0], video_url[1]))
|
||||
|
||||
return video_urls
|
||||
13
plugin.video.alfa/servers/powvideo.py
Executable file → Normal file
13
plugin.video.alfa/servers/powvideo.py
Executable file → Normal file
@@ -33,11 +33,16 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
||||
|
||||
url = scrapertools.find_single_match(unpacked, "(?:src):\\\\'([^\\\\]+.mp4)\\\\'")
|
||||
|
||||
a, b = scrapertools.find_single_match(data, "\['splice'\]\(0x([0-9a-fA-F]*),0x([0-9a-fA-F]*)\);")
|
||||
if a and b:
|
||||
url = decode_powvideo_url(url, int(a, 16), int(b, 16))
|
||||
matches = scrapertools.find_single_match(data, "\['splice'\]\(0x([0-9a-fA-F]*),0x([0-9a-fA-F]*)\);")
|
||||
if matches:
|
||||
url = decode_powvideo_url(url, int(matches[0], 16), int(matches[1], 16))
|
||||
else:
|
||||
logger.debug('No detectado splice! Revisar sistema de decode...')
|
||||
matches = scrapertools.find_single_match(data, "\(0x([0-9a-fA-F]*),0x([0-9a-fA-F]*)\);")
|
||||
if matches:
|
||||
url = decode_powvideo_url(url, int(matches[0], 16), int(matches[1], 16))
|
||||
else:
|
||||
logger.debug('No detectado splice! Revisar sistema de decode...')
|
||||
# ~ logger.debug(data)
|
||||
|
||||
itemlist.append([".mp4" + " [powvideo]", url])
|
||||
itemlist.sort(key=lambda x: x[0], reverse=True)
|
||||
|
||||
@@ -46,5 +46,5 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
||||
def decode_video_url(url):
|
||||
tria = re.compile('[0-9a-z]{40,}', re.IGNORECASE).findall(url)[0]
|
||||
gira = tria[::-1]
|
||||
x = gira[:3] + gira[4:]
|
||||
x = gira[:4] + gira[6:]
|
||||
return re.sub(tria, x, url)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import urllib
|
||||
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from platformcode import logger
|
||||
@@ -15,17 +17,15 @@ def test_video_exists(page_url):
|
||||
|
||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||
logger.info("url=" + page_url)
|
||||
data = httptools.downloadpage(page_url).data
|
||||
key = scrapertools.find_single_match(data, "var thief\s*=\s*'([^']+)'")
|
||||
data_vt = httptools.downloadpage("http://vidup.tv/jwv/%s" % key).data
|
||||
vt = scrapertools.find_single_match(data_vt, 'file\|direct\|(.*?)\|')
|
||||
# Extrae la URL
|
||||
video_urls = []
|
||||
media_urls = scrapertools.find_multiple_matches(data, '\{"file"\:"([^"]+)","label"\:"([^"]+)"\}')
|
||||
for media_url, label in media_urls:
|
||||
ext = scrapertools.get_filename_from_url(media_url)[-4:]
|
||||
media_url += "?direct=false&ua=1&vt=%s" % vt
|
||||
video_urls.append(["%s (%s) [vidup]" % (ext, label), media_url])
|
||||
for video_url in video_urls:
|
||||
logger.info("%s - %s" % (video_url[0], video_url[1]))
|
||||
post= {}
|
||||
post = urllib.urlencode(post)
|
||||
url = httptools.downloadpage(page_url, follow_redirects=False, only_headers=True).headers.get("location", "")
|
||||
data = httptools.downloadpage("https://vidup.io/api/serve/video/" + scrapertools.find_single_match(url, "embed/([A-z0-9]+)"), post=post).data
|
||||
bloque = scrapertools.find_single_match(data, 'qualities":\{(.*?)\}')
|
||||
matches = scrapertools.find_multiple_matches(bloque, '"([^"]+)":"([^"]+)')
|
||||
for res, media_url in matches:
|
||||
video_urls.append(
|
||||
[scrapertools.get_filename_from_url(media_url)[-4:] + " (" + res + ") [vidup.tv]", media_url])
|
||||
video_urls.reverse()
|
||||
return video_urls
|
||||
|
||||
@@ -177,6 +177,8 @@ def check_for_update(overwrite=True):
|
||||
if overwrite or config.get_setting("updatetvshows_interval", "videolibrary") == 0:
|
||||
# ... forzar actualizacion independientemente del intervalo
|
||||
serie_actualizada = update(path, p_dialog, i, t, serie, overwrite)
|
||||
if not serie_actualizada:
|
||||
update_next = hoy + datetime.timedelta(days=interval)
|
||||
|
||||
elif interval == 1 and update_next <= hoy:
|
||||
# ...actualizacion diaria
|
||||
@@ -201,9 +203,14 @@ def check_for_update(overwrite=True):
|
||||
serie_actualizada = update(path, p_dialog, i, t, serie, overwrite)
|
||||
if not serie_actualizada:
|
||||
update_next += datetime.timedelta(days=interval)
|
||||
|
||||
if serie_actualizada:
|
||||
update_last = hoy
|
||||
update_next = hoy + datetime.timedelta(days=interval)
|
||||
|
||||
head_nfo, serie = videolibrarytools.read_nfo(tvshow_file) #Vuelve a leer el.nfo, que ha sido modificado
|
||||
if interval != int(serie.active) or update_next.strftime('%Y-%m-%d') != serie.update_next:
|
||||
if interval != int(serie.active) or update_next.strftime('%Y-%m-%d') != serie.update_next or update_last.strftime('%Y-%m-%d') != serie.update_last:
|
||||
serie.update_last = update_last.strftime('%Y-%m-%d')
|
||||
if update_next > hoy:
|
||||
serie.update_next = update_next.strftime('%Y-%m-%d')
|
||||
serie.active = interval
|
||||
|
||||
Reference in New Issue
Block a user