Merge branch 'master' of https://github.com/alfa-addon/addon
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.11" provider-name="Alfa Addon">
|
||||
<addon id="plugin.video.alfa" name="Alfa" version="2.7.12" provider-name="Alfa Addon">
|
||||
<requires>
|
||||
<import addon="xbmc.python" version="2.1.0"/>
|
||||
<import addon="script.module.libtorrent" optional="true"/>
|
||||
@@ -19,16 +19,17 @@
|
||||
</assets>
|
||||
<news>[B]Estos son los cambios para esta versión:[/B]
|
||||
[COLOR green][B]Arreglos[/B][/COLOR]
|
||||
¤ anitoons ¤ rexpelis ¤ bitertv
|
||||
¤ fembed ¤ animeflv ¤ canalpelis
|
||||
¤ dilo ¤ fanpelis ¤ pelisplus
|
||||
¤ pelisr ¤ retroseries ¤ datoporn
|
||||
¤ newpct1 ¤ subtorrents ¤ sleazemovies
|
||||
¤ PoseidonHD ¤ TuPelicula ¤ SeriesLan
|
||||
¤ danimados ¤ pelisgratis ¤ rexpelis
|
||||
¤ sipeliculas ¤ yape ¤ DivxTotal
|
||||
¤ EliteTorrent ¤ GranTorrent ¤ Newpct1
|
||||
¤ pelispedia ¤ pepecine ¤ cuevana2
|
||||
¤ cuevana2español
|
||||
|
||||
[COLOR green][B]Novedades[/B][/COLOR]
|
||||
¤ tupelicula
|
||||
¤ AnimeBoom ¤ SeriesMetro ¤ Pack canales +18
|
||||
|
||||
¤ Agradecimientos a @sculkurt por colaborar en ésta versión
|
||||
Agradecimientos a @mrgaturus y @paeznet 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>
|
||||
|
||||
@@ -81,6 +81,11 @@ def addFavourite(item):
|
||||
platformtools.dialog_notification('Enlace repetido', 'Ya tienes este enlace en la carpeta')
|
||||
return False
|
||||
|
||||
# Si es una película, completar información de tmdb si no se tiene activado tmdb_plus_info
|
||||
if item.contentType == 'movie' and not config.get_setting('tmdb_plus_info', default=False):
|
||||
from core import tmdb
|
||||
tmdb.set_infoLabels(item, True) # obtener más datos en "segunda pasada" (actores, duración, ...)
|
||||
|
||||
# Guardar
|
||||
alfav.user_favorites[i_perfil]['items'].append(item.tourl())
|
||||
alfav.save()
|
||||
|
||||
53
plugin.video.alfa/channels/animeboom.json
Normal file
53
plugin.video.alfa/channels/animeboom.json
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"id": "animeboom",
|
||||
"name": "AnimeBoom",
|
||||
"active": true,
|
||||
"adult": false,
|
||||
"language": ["cast", "lat"],
|
||||
"thumbnail": "https://animeboom.net/images/logo.png",
|
||||
"banner": "",
|
||||
"categories": [
|
||||
"anime",
|
||||
"vos"
|
||||
],
|
||||
"settings": [
|
||||
{
|
||||
"id": "include_in_global_search",
|
||||
"type": "bool",
|
||||
"label": "Incluir en busqueda global",
|
||||
"default": false,
|
||||
"enabled": false,
|
||||
"visible": false
|
||||
},
|
||||
{
|
||||
"id": "filter_languages",
|
||||
"type": "list",
|
||||
"label": "Mostrar enlaces en idioma...",
|
||||
"default": 0,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": [
|
||||
"No filtrar",
|
||||
"LAT",
|
||||
"VOSE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "comprueba_enlaces_num",
|
||||
"type": "list",
|
||||
"label": "Número de enlaces a verificar",
|
||||
"default": 1,
|
||||
"enabled": true,
|
||||
"visible": "eq(-1,true)",
|
||||
"lvalues": [ "5", "10", "15", "20" ]
|
||||
},
|
||||
{
|
||||
"id": "include_in_newest_anime",
|
||||
"type": "bool",
|
||||
"label": "Incluir en Novedades - Episodios de anime",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
}
|
||||
]
|
||||
}
|
||||
281
plugin.video.alfa/channels/animeboom.py
Normal file
281
plugin.video.alfa/channels/animeboom.py
Normal file
@@ -0,0 +1,281 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- Channel AnimeBoom -*-
|
||||
# -*- Created for Alfa-addon -*-
|
||||
# -*- By the Alfa Develop Group -*-
|
||||
|
||||
import re
|
||||
import urllib
|
||||
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from core import servertools
|
||||
from channelselector import get_thumb
|
||||
from core import tmdb
|
||||
from core.item import Item
|
||||
from platformcode import logger, config
|
||||
from channels import autoplay
|
||||
from channels import filtertools
|
||||
|
||||
|
||||
host = "https://animeboom.net/"
|
||||
|
||||
__comprueba_enlaces__ = config.get_setting('comprueba_enlaces', 'animeboom')
|
||||
__comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', 'animeboom')
|
||||
|
||||
IDIOMAS = {'Latino':'LAT', 'VOSE': 'VOSE'}
|
||||
list_language = IDIOMAS.values()
|
||||
list_quality = []
|
||||
list_servers = ['directo', 'openload', 'streamango']
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
|
||||
autoplay.init(item.channel, list_servers, list_quality)
|
||||
|
||||
itemlist = []
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title="Nuevos Episodios",
|
||||
action="new_episodes",
|
||||
thumbnail=get_thumb('new_episodes', auto=True),
|
||||
url=host))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title="Ultimas",
|
||||
action="list_all",
|
||||
thumbnail=get_thumb('last', auto=True),
|
||||
url=host + 'emision'))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title="Todas",
|
||||
action="list_all",
|
||||
thumbnail=get_thumb('all', auto=True),
|
||||
url=host + 'series'))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title="Series",
|
||||
action="list_all",
|
||||
thumbnail=get_thumb('tvshows', auto=True),
|
||||
url=host + 'tv'))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title="Películas",
|
||||
action="list_all",
|
||||
thumbnail=get_thumb('movies', auto=True),
|
||||
url=host + 'peliculas'))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title="OVAs",
|
||||
action="list_all",
|
||||
thumbnail='',
|
||||
url=host + 'ova'))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title="ONAs",
|
||||
action="list_all",
|
||||
thumbnail='',
|
||||
url=host + 'ona'))
|
||||
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title="Especiales",
|
||||
action="list_all",
|
||||
thumbnail='',
|
||||
url=host + '/specials'))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title="Buscar",
|
||||
action="search",
|
||||
url=host + 'search?s=',
|
||||
thumbnail=get_thumb('search', auto=True),
|
||||
fanart='https://s30.postimg.cc/pei7txpa9/buscar.png'
|
||||
))
|
||||
|
||||
autoplay.show_option(item.channel, itemlist)
|
||||
|
||||
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 list_all(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
|
||||
data = get_source(item.url)
|
||||
patron = '<article class="([^"]+)"><figure class="image"><a href="([^"]+)" title=".*?">'
|
||||
patron += '<img src="([^"]+)" alt="([^"]+)">.*?class="year">(\d{4})<'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for type, scrapedurl, scrapedthumbnail, scrapedtitle, year in matches:
|
||||
url = scrapedurl
|
||||
thumbnail = scrapedthumbnail
|
||||
if 'latino' in scrapedtitle.lower():
|
||||
lang = 'Latino'
|
||||
else:
|
||||
lang = 'VOSE'
|
||||
title = re.sub('Audio Latino', '', scrapedtitle)
|
||||
itemlist.append(Item(channel=item.channel, action='episodios',
|
||||
title=title,
|
||||
url=url,
|
||||
thumbnail=thumbnail,
|
||||
contentSerieName=title,
|
||||
language = lang,
|
||||
infoLabels={'year':year}
|
||||
))
|
||||
|
||||
# Paginacion
|
||||
next_page = scrapertools.find_single_match(data,
|
||||
'<a href="([^"]+)" rel="next">»</a>')
|
||||
next_page_url = scrapertools.decodeHtmlentities(next_page)
|
||||
|
||||
if next_page_url != "":
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
action="list_all",
|
||||
title=">> Página siguiente",
|
||||
url=next_page_url,
|
||||
thumbnail='https://s16.postimg.cc/9okdu7hhx/siguiente.png'
|
||||
))
|
||||
tmdb.set_infoLabels(itemlist, seekTmdb=True)
|
||||
return itemlist
|
||||
|
||||
|
||||
def search_results(item):
|
||||
logger.info()
|
||||
|
||||
itemlist=[]
|
||||
|
||||
full_data = get_source(item.url)
|
||||
data = scrapertools.find_single_match(full_data, '<div class="search-results">(.*?)<h4')
|
||||
|
||||
patron = '<a href="([^"]+)".*?<img src="([^"]+)".*?alt="([^"]+)"'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedurl, scrapedthumbnail, scrapedtitle in matches:
|
||||
|
||||
url = scrapedurl
|
||||
title = re.sub('online|Audio|Latino', '', scrapedtitle)
|
||||
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
action="episodios",
|
||||
title=title,
|
||||
url=url,
|
||||
thumbnail=scrapedthumbnail))
|
||||
|
||||
tmdb.set_infoLabels(itemlist, seekTmdb=True)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def search(item, texto):
|
||||
logger.info()
|
||||
texto = texto.replace(" ", "+")
|
||||
item.url = item.url + texto
|
||||
try:
|
||||
if texto != '':
|
||||
return search_results(item)
|
||||
else:
|
||||
return []
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
logger.error("%s" % line)
|
||||
return []
|
||||
|
||||
def new_episodes(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
|
||||
full_data = get_source(item.url)
|
||||
data = scrapertools.find_single_match(full_data, '>Episodios Estreno</h2>(.*?)</section>')
|
||||
patron = '<a href="([^"]+)"><img src="([^"]+)" alt="([^"]+)">'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedurl, scrapedthumbnail, scrapedtitle in matches:
|
||||
url = scrapedurl
|
||||
if 'latino' in scrapedtitle.lower():
|
||||
lang = 'Latino'
|
||||
else:
|
||||
lang = 'VOSE'
|
||||
title = re.sub('sub|Sub|Español|español|Audio|Latino|audio|latino','', scrapedtitle)
|
||||
itemlist.append(Item(channel=item.channel, title=title, url=url, thumbnail=scrapedthumbnail,
|
||||
action='findvideos', language=lang))
|
||||
|
||||
return itemlist
|
||||
|
||||
def episodios(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
full_data = get_source(item.url)
|
||||
data = scrapertools.find_single_match(full_data, '<ul class="list-episodies scrolling">(.*?)</ul>')
|
||||
patron = '<a href="([^"]+)".*?title="([^"]+)".*?Episodio (\d+)'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
infoLabels = item.infoLabels
|
||||
for scrapedurl, title, episode in matches:
|
||||
if 'latino' in title.lower():
|
||||
lang='Latino'
|
||||
else:
|
||||
lang = 'VOSE'
|
||||
title = "1x" + episode + " - Episodio %s" % episode
|
||||
url = scrapedurl
|
||||
infoLabels['season'] = '1'
|
||||
infoLabels['episode'] = episode
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title=title, contentSerieName=item.contentSerieName, url=url,
|
||||
action='findvideos', language=lang, infoLabels=infoLabels))
|
||||
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
|
||||
itemlist = itemlist[::-1]
|
||||
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,
|
||||
extra1='library'))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
|
||||
data = get_source(item.url)
|
||||
#return
|
||||
patron = 'video\[\d+\] = \'<iframe src="([^"]+)"'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedurl in matches:
|
||||
|
||||
if 'animeboom' in scrapedurl:
|
||||
new_data = get_source(scrapedurl)
|
||||
scrapedurl = scrapertools.find_single_match(new_data, 'src:"([^,]+)",')
|
||||
|
||||
if scrapedurl != '':
|
||||
itemlist.append(Item(channel=item.channel, title='%s', url=scrapedurl, action='play', language = item.language,
|
||||
infoLabels=item.infoLabels))
|
||||
|
||||
itemlist = servertools.get_servers_itemlist(itemlist, lambda x: x.title % x.server.capitalize())
|
||||
|
||||
if __comprueba_enlaces__:
|
||||
itemlist = servertools.check_list_links(itemlist, __comprueba_enlaces_num__)
|
||||
|
||||
# Requerido para FilterTools
|
||||
|
||||
itemlist = filtertools.get_links(itemlist, item, list_language)
|
||||
|
||||
# Requerido para AutoPlay
|
||||
|
||||
autoplay.start(itemlist, item)
|
||||
|
||||
return itemlist
|
||||
|
||||
def newest(categoria):
|
||||
itemlist = []
|
||||
item = Item()
|
||||
if categoria == 'anime':
|
||||
item.url=host
|
||||
itemlist = new_episodes(item)
|
||||
return itemlist
|
||||
@@ -22,8 +22,7 @@ def mainlist(item):
|
||||
autoplay.init(item.channel, list_servers, list_quality)
|
||||
itemlist = []
|
||||
# PELICULAS
|
||||
itemlist.append(Item(channel = item.channel, title = "Peliculas", folder=False,
|
||||
thumbnail = get_thumb("movies", auto = True), text_bold=True))
|
||||
itemlist.append(Item(channel = item.channel, title = "--- Peliculas ---", folder=False, text_bold=True))
|
||||
|
||||
itemlist.append(Item(channel = item.channel, title = "Novedades", action = "movies",
|
||||
url = host + "pelicula", thumbnail = get_thumb("newest", auto = True)))
|
||||
@@ -37,8 +36,7 @@ def mainlist(item):
|
||||
url = host + "search/", thumbnail = get_thumb("search", auto = True)))
|
||||
|
||||
# SERIES
|
||||
itemlist.append(Item(channel = item.channel, title = "Series", folder=False,
|
||||
thumbnail = get_thumb("tvshows", auto = True), text_bold=True))
|
||||
itemlist.append(Item(channel = item.channel, title = "--- Series ---", folder=False, text_bold=True))
|
||||
|
||||
itemlist.append(Item(channel = item.channel, title = "Todas las Series", action = "shows",
|
||||
url = host + "listar-series", thumbnail = get_thumb("tvshows", auto = True)))
|
||||
@@ -63,6 +61,11 @@ def load_data(url):
|
||||
|
||||
return data
|
||||
|
||||
def redirect_url(url, parameters=None):
|
||||
data = httptools.downloadpage(url, post=parameters)
|
||||
logger.info(data.url)
|
||||
return data.url
|
||||
|
||||
def put_movies(itemlist, item, data, pattern):
|
||||
matches = scrapertools.find_multiple_matches(data, pattern)
|
||||
for link, img, title, rating, plot in matches:
|
||||
@@ -201,7 +204,25 @@ def age(item):
|
||||
def GKPluginLink(hash):
|
||||
hashdata = urllib.urlencode({r'link':hash})
|
||||
json = httptools.downloadpage('https://player4.cuevana2.com/plugins/gkpluginsphp.php', post=hashdata).data
|
||||
return jsontools.load(json)['link'] if json else ''
|
||||
logger.info(jsontools.load(json))
|
||||
|
||||
data = jsontools.load(json) if json else False
|
||||
if data:
|
||||
return data['link'] if 'link' in data else None
|
||||
else:
|
||||
return None
|
||||
|
||||
def RedirectLink(hash):
|
||||
hashdata = urllib.urlencode({r'url':hash})
|
||||
return redirect_url('https://player4.cuevana2.com/r.php', hashdata)
|
||||
|
||||
def OpenloadLink(hash):
|
||||
hashdata = urllib.urlencode({r'h':hash})
|
||||
json = httptools.downloadpage('https://api.cuevana2.com/openload/api.php', post=hashdata).data
|
||||
logger.info("CUEVANA OL JSON %s" % json)
|
||||
data = jsontools.load(json) if json else False
|
||||
|
||||
return data['url'] if data['status'] == 1 else None
|
||||
|
||||
#el pattern esta raro para eliminar los duplicados, de todas formas asi es un lenguaje de programacion verificando su sintaxis
|
||||
def getContentMovie(data, item):
|
||||
@@ -235,29 +256,41 @@ def findvideos(item):
|
||||
pattern = '<iframe width="650" height="450" scrolling="no" src="([^"]+)'
|
||||
subtitles = scrapertools.find_single_match(data, '<iframe width="650" height="450" scrolling="no" src=".*?sub=([^"]+)"')
|
||||
|
||||
title = "[COLOR blue]Servidor [%s][/COLOR]"
|
||||
#itemlist.append(Item(channel = item.channel, title=item.url))
|
||||
for link in scrapertools.find_multiple_matches(data, pattern):
|
||||
#php.*?=(\w+)&
|
||||
#url=(.*?)&
|
||||
if 'player4' in link:
|
||||
# Por si acaso están los dos metodos, de todas maneras esto es corto circuito
|
||||
if r'ir.php' in link:
|
||||
link = scrapertools.find_single_match(link, 'php\?url=(.*?)&').replace('%3A', ':').replace('%2F', '/')
|
||||
logger.info("CUEVANA IR %s" % link)
|
||||
elif r'irgoto.php' in link:
|
||||
link = scrapertools.find_single_match(link, 'php\?url=(.*?)&').replace('%3A', ':').replace('%2F', '/')
|
||||
link = RedirectLink(link)
|
||||
logger.info("CUEVANA IRGOTO %s" % link)
|
||||
elif r'gdv.php' in link:
|
||||
# google drive hace lento la busqueda de links, ademas no es tan buena opcion y es el primero que eliminan
|
||||
continue
|
||||
else:
|
||||
link = scrapertools.find_single_match(link, 'php.*?=(\w+)&')
|
||||
link = GKPluginLink(link)
|
||||
if not link:
|
||||
continue
|
||||
|
||||
title = "[COLOR blue]Servidor [%s][/COLOR]"
|
||||
elif 'openload' in link:
|
||||
link = scrapertools.find_single_match(link, '\?h=(\w+)&')
|
||||
logger.info("CUEVANA OL HASH %s" % link)
|
||||
link = OpenloadLink(link)
|
||||
logger.info("CUEVANA OL %s" % link)
|
||||
|
||||
elif 'youtube' in link:
|
||||
title = "[COLOR yellow]Ver Trailer (%s)[/COLOR]"
|
||||
else: # En caso de que exista otra cosa no implementada, reportar si no aparece pelicula
|
||||
continue
|
||||
|
||||
if not link:
|
||||
continue
|
||||
|
||||
# GKplugin puede devolver multiples links con diferentes calidades, si se pudiera colocar una lista de opciones
|
||||
# personalizadas para Directo, se agradece, por ahora solo devuelve el primero que encuentre
|
||||
if type(link) is list:
|
||||
@@ -265,6 +298,9 @@ def findvideos(item):
|
||||
if r'chomikuj.pl' in link:
|
||||
# En algunas personas la opcion CH les da error 401
|
||||
link += "|Referer=https://player4.cuevana2.com/plugins/gkpluginsphp.php"
|
||||
elif r'vidcache.net' in link:
|
||||
# Para que no salga error 500
|
||||
link += '|Referer=https://player4.cuevana2.com/yourupload.com.php'
|
||||
|
||||
itemlist.append(
|
||||
item.clone(
|
||||
|
||||
@@ -21,6 +21,11 @@ def load_data(url):
|
||||
|
||||
return data
|
||||
|
||||
def redirect_url(url, parameters=None):
|
||||
data = httptools.downloadpage(url, post=parameters)
|
||||
logger.info(data.url)
|
||||
return data.url
|
||||
|
||||
def mainlist(item):
|
||||
itemlist = []
|
||||
|
||||
@@ -33,8 +38,7 @@ def mainlist(item):
|
||||
url = host + "tendencias", thumbnail = get_thumb("hot", auto = True)))
|
||||
itemlist.append(Item(channel = item.channel, title = "Ranking IMDB", action = "moviesIMDB",
|
||||
url = host + "raking-imdb", thumbnail = get_thumb("hot", auto = True) ))
|
||||
itemlist.append(Item(channel = item.channel, title = "Busqueda", folder=False, text_bold=True,
|
||||
thumbnail = get_thumb("search", auto = True)))
|
||||
itemlist.append(Item(channel = item.channel, title = "--- Busqueda ---", folder=False, text_bold=True))
|
||||
itemlist.append(Item(channel = item.channel, title = "Por Letra", action = "letters",
|
||||
url = host, thumbnail = get_thumb("alphabet", auto = True)))
|
||||
itemlist.append(Item(channel = item.channel, title = "Buscar...", action = "search",
|
||||
@@ -149,7 +153,20 @@ def search(item, text):
|
||||
def GKPluginLink(hash):
|
||||
hashdata = urllib.urlencode({r'link':hash})
|
||||
json = httptools.downloadpage('https://player4.cuevana2.com/plugins/gkpluginsphp.php', post=hashdata).data
|
||||
return jsontools.load(json)['link'] if json else ''
|
||||
logger.info(jsontools.load(json))
|
||||
|
||||
data = jsontools.load(json) if json else False
|
||||
if data:
|
||||
return data['link'] if 'link' in data else None
|
||||
else:
|
||||
return None
|
||||
|
||||
def OpenloadLink(hash):
|
||||
hashdata = urllib.urlencode({r'h':hash})
|
||||
json = httptools.downloadpage('http://cuevana2espanol.com/openload/api.php', post=hashdata).data
|
||||
data = jsontools.load(json) if json else False
|
||||
|
||||
return data['url'] if data['status'] == 1 else None
|
||||
|
||||
def getContent(item, data):
|
||||
item.infoLabels["year"] = scrapertools.find_single_match(data, 'class="date">.*?(\d+)</span>')
|
||||
@@ -180,7 +197,10 @@ def findvideos(item):
|
||||
#url=(.*?)&
|
||||
if 'player4' in link:
|
||||
logger.info("CUEVANA LINK %s" % link)
|
||||
if r'ir.php' in link:
|
||||
if r'%2Fopenload%2F' in link:
|
||||
link = scrapertools.find_single_match(link, 'h%3D(\w+)')
|
||||
link = OpenloadLink(link)
|
||||
elif r'ir.php' in link:
|
||||
link = scrapertools.find_single_match(link, 'php.*?=(.*)').replace('%3A', ':').replace('%2F', '/')
|
||||
logger.info("CUEVANA IR %s" % link)
|
||||
elif r'gdv.php' in link:
|
||||
@@ -189,15 +209,16 @@ def findvideos(item):
|
||||
else:
|
||||
link = scrapertools.find_single_match(link, 'php.*?=(\w+)')
|
||||
link = GKPluginLink(link)
|
||||
if not link:
|
||||
continue
|
||||
|
||||
|
||||
title = "[COLOR blue]Servidor [%s][/COLOR]"
|
||||
|
||||
elif 'youtube' in link:
|
||||
title = "[COLOR yellow]Ver Trailer (%s)[/COLOR]"
|
||||
else: # En caso de que exista otra cosa no implementada, reportar si no aparece pelicula
|
||||
continue
|
||||
|
||||
if not link:
|
||||
continue
|
||||
# GKplugin puede devolver multiples links con diferentes calidades, si se pudiera colocar una lista de opciones
|
||||
# personalizadas para Directo, se agradece, por ahora solo devuelve el primero que encuentre
|
||||
if type(link) is list:
|
||||
|
||||
@@ -113,7 +113,6 @@ def lista(item):
|
||||
data_lista = scrapertools.find_single_match(data,
|
||||
'<div class="items">(.+?)<\/div><\/div><div class=.+?>')
|
||||
patron = '<img src="([^"]+)" alt="([^"]+)">.+?<a href="([^"]+)">.+?<div class="texto">(.+?)<\/div>'
|
||||
#scrapedthumbnail,#scrapedtitle, #scrapedurl, #scrapedplot
|
||||
matches = scrapertools.find_multiple_matches(data_lista, patron)
|
||||
for scrapedthumbnail,scrapedtitle, scrapedurl, scrapedplot in matches:
|
||||
if item.title=="Peliculas Animadas":
|
||||
@@ -134,13 +133,13 @@ def episodios(item):
|
||||
itemlist = []
|
||||
infoLabels = {}
|
||||
data = httptools.downloadpage(item.url).data
|
||||
patron = '(?s)<ul class="episodios">(.+?)<\/ul>'
|
||||
patron = '(?s)<ul class="episodios">(.+?)<span>Compartido'
|
||||
data_lista = scrapertools.find_single_match(data,patron)
|
||||
contentSerieName = item.title
|
||||
patron_caps = 'href="([^"]+)".*?'
|
||||
patron_caps += 'src="([^"]+)".*?'
|
||||
patron_caps += 'numerando">([^<]+).*?'
|
||||
patron_caps += 'link_go">.*?>([^<]+)'
|
||||
patron_caps += 'episodiotitle">.*?>([^<]+)'
|
||||
matches = scrapertools.find_multiple_matches(data_lista, patron_caps)
|
||||
for scrapedurl, scrapedthumbnail, scrapedtempepi, scrapedtitle in matches:
|
||||
tempepi=scrapedtempepi.split(" - ")
|
||||
@@ -161,25 +160,26 @@ def findvideos(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
data = httptools.downloadpage(item.url).data
|
||||
patron = '<div id="playex" .+?>(.+?)<\/nav>'
|
||||
data1 = scrapertools.find_single_match(data, patron)
|
||||
patron = "changeLink\('([^']+)'\)"
|
||||
matches = scrapertools.find_multiple_matches(data1, patron)
|
||||
for url64 in matches:
|
||||
url1 =base64.b64decode(url64)
|
||||
if 'danimados' in url1:
|
||||
url = 'https:'+url1.replace('stream/', 'stream_iframe/')
|
||||
id = scrapertools.find_single_match(url, 'iframe/(.*)')
|
||||
url = url.replace(id, base64.b64encode(id))
|
||||
new_data = httptools.downloadpage(url).data
|
||||
new_data = new_data.replace('"',"'")
|
||||
url = scrapertools.find_single_match(new_data, "sources:\s*\[\{file:\s*'([^']+)")
|
||||
if "zkstream" in url or "cloudup" in url:
|
||||
url1 = httptools.downloadpage(url, follow_redirects=False, only_headers=True).headers.get("location", "")
|
||||
else:
|
||||
url1 = url
|
||||
if url1:
|
||||
itemlist.append(item.clone(title='%s',url=url1, action="play"))
|
||||
if "onclick=\"changeLink('" in data:
|
||||
patron = "onclick=.changeLink\('([^']+)'"
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for id in matches:
|
||||
url = devuelve_enlace(base64.b64decode(id))
|
||||
itemlist.append(item.clone(title="Ver en %s",url=url, action="play"))
|
||||
else:
|
||||
patron = 'data-type="([^"]+).*?'
|
||||
patron += 'data-post="([^"]+).*?'
|
||||
patron += 'data-nume="([^"]+).*?'
|
||||
patron += 'server">([^<]+).*?'
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
headers = {"X-Requested-With":"XMLHttpRequest"}
|
||||
for scrapedtype, scrapedpost, scrapednume, scrapedserver in matches:
|
||||
post = "action=doo_player_ajax&type=%s&post=%s&nume=%s" %(scrapedtype, scrapedpost, scrapednume)
|
||||
data1 = httptools.downloadpage(host + "wp-admin/admin-ajax.php", headers=headers, post=post).data
|
||||
url1 = scrapertools.find_single_match(data1, "src='([^']+)")
|
||||
url1 = devuelve_enlace(url1)
|
||||
if url1:
|
||||
itemlist.append(item.clone(title="Ver en %s",url=url1, action="play"))
|
||||
tmdb.set_infoLabels(itemlist)
|
||||
itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server.capitalize())
|
||||
if config.get_videolibrary_support() and len(itemlist) > 0 and item.contentType=="movie" and item.contentChannel!='videolibrary':
|
||||
@@ -193,3 +193,18 @@ def findvideos(item):
|
||||
def play(item):
|
||||
item.thumbnail = item.contentThumbnail
|
||||
return [item]
|
||||
|
||||
|
||||
def devuelve_enlace(url1):
|
||||
if 'danimados' in url1:
|
||||
url = 'https:'+url1.replace('stream/', 'stream_iframe/')
|
||||
id = scrapertools.find_single_match(url, 'iframe/(.*)')
|
||||
url = url.replace(id, base64.b64encode(id))
|
||||
new_data = httptools.downloadpage(url).data
|
||||
new_data = new_data.replace('"',"'")
|
||||
url = scrapertools.find_single_match(new_data, "sources:\s*\[\{file:\s*'([^']+)")
|
||||
if "zkstream" in url or "cloudup" in url:
|
||||
url1 = httptools.downloadpage(url, follow_redirects=False, only_headers=True).headers.get("location", "")
|
||||
else:
|
||||
url1 = url
|
||||
return url1
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
{
|
||||
"id": "diskokosmiko",
|
||||
"name": "Diskokosmiko",
|
||||
"language": ["cast", "lat"],
|
||||
"active": true,
|
||||
"adult": false,
|
||||
"version": 1,
|
||||
"thumbnail": "http://i.imgur.com/EjbfM7p.png?1",
|
||||
"banner": "copiapop.png",
|
||||
"categories": [
|
||||
"movie",
|
||||
"tvshow"
|
||||
],
|
||||
"settings": [
|
||||
{
|
||||
"id": "include_in_global_search",
|
||||
"type": "bool",
|
||||
"label": "Incluir en busqueda global",
|
||||
"default": false,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "diskokosmikouser",
|
||||
"type": "text",
|
||||
"color": "0xFFC52020",
|
||||
"label": "Usuario Diskokosmiko",
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "diskokosmikopassword",
|
||||
"type": "text",
|
||||
"color": "0xFFC52020",
|
||||
"hidden": true,
|
||||
"label": "Password Diskokosmiko",
|
||||
"enabled": "!eq(-1,'')",
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "adult_content",
|
||||
"type": "bool",
|
||||
"color": "0xFFd50b0b",
|
||||
"label": "Mostrar contenido adulto en las búsquedas",
|
||||
"default": false,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "perfil",
|
||||
"type": "list",
|
||||
"label": "Perfil de color",
|
||||
"default": 3,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": [
|
||||
"Sin color",
|
||||
"Perfil 3",
|
||||
"Perfil 2",
|
||||
"Perfil 1"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,366 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
import threading
|
||||
import urllib
|
||||
import xbmc
|
||||
|
||||
from core import downloadtools
|
||||
from core import filetools
|
||||
from core import httptools
|
||||
from core import jsontools
|
||||
from core import scrapertools
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
from platformcode import platformtools
|
||||
|
||||
__perfil__ = config.get_setting('perfil', "diskokosmiko")
|
||||
|
||||
# Fijar perfil de color
|
||||
perfil = [['0xFFFFE6CC', '0xFFFFCE9C', '0xFF994D00', '0xFFFE2E2E', '0xFF088A08'],
|
||||
['0xFFA5F6AF', '0xFF5FDA6D', '0xFF11811E', '0xFFFE2E2E', '0xFF088A08'],
|
||||
['0xFF58D3F7', '0xFF2E9AFE', '0xFF2E64FE', '0xFFFE2E2E', '0xFF088A08']]
|
||||
|
||||
if __perfil__ - 1 >= 0:
|
||||
color1, color2, color3, color4, color5 = perfil[__perfil__ - 1]
|
||||
else:
|
||||
color1 = color2 = color3 = color4 = color5 = ""
|
||||
|
||||
adult_content = config.get_setting("adult_content", "diskokosmiko")
|
||||
|
||||
|
||||
def login(pagina):
|
||||
logger.info()
|
||||
try:
|
||||
dom = pagina.split(".")[0]
|
||||
user = config.get_setting("%suser" %dom, "diskokosmiko")
|
||||
password = config.get_setting("%spassword" %dom, "diskokosmiko")
|
||||
if not user:
|
||||
return False, "Para ver los enlaces de %s es necesario registrarse en %s" %(dom, pagina)
|
||||
data = httptools.downloadpage("http://%s" % pagina).data
|
||||
if re.search(r'(?i)%s' % user, data):
|
||||
return True, ""
|
||||
token = scrapertools.find_single_match(data, 'name="__RequestVerificationToken".*?value="([^"]+)"')
|
||||
post = "__RequestVerificationToken=%s&UserName=%s&Password=%s" % (token, user, password)
|
||||
headers = {'X-Requested-With': 'XMLHttpRequest'}
|
||||
url_log = "http://%s/action/Account/Login" % pagina
|
||||
data = httptools.downloadpage(url_log, post, headers).data
|
||||
if "redirectUrl" in data:
|
||||
logger.info("Login correcto")
|
||||
return True, ""
|
||||
else:
|
||||
logger.error("Error en el login")
|
||||
return False, "Nombre de usuario no válido. Comprueba tus credenciales"
|
||||
except:
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
return False, "Error durante el login. Comprueba tus credenciales"
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
item.text_color = color1
|
||||
logueado, error_message = login("diskokosmiko.mx")
|
||||
if not logueado:
|
||||
itemlist.append(item.clone(title=error_message, action="configuracion", folder=False))
|
||||
else:
|
||||
item.extra = "http://diskokosmiko.mx/"
|
||||
itemlist.append(item.clone(title="DiskoKosmiko", action="", text_color=color2))
|
||||
itemlist.append(item.clone(title=" Búsqueda", action="search", url="http://diskokosmiko.mx/action/SearchFiles"))
|
||||
itemlist.append(item.clone(title=" Colecciones", action="colecciones",
|
||||
url="http://diskokosmiko.mx/action/home/MoreNewestCollections?pageNumber=1"))
|
||||
itemlist.append(item.clone(title=" Búsqueda personalizada", action="filtro",
|
||||
url="http://diskokosmiko.mx/action/SearchFiles"))
|
||||
itemlist.append(item.clone(title=" Mi cuenta", action="cuenta"))
|
||||
itemlist.append(item.clone(action="", title=""))
|
||||
folder_thumb = filetools.join(config.get_data_path(), 'thumbs_disko')
|
||||
files = filetools.listdir(folder_thumb)
|
||||
if files:
|
||||
itemlist.append(
|
||||
item.clone(title="Eliminar caché de imágenes (%s)" % len(files), action="delete_cache", text_color="red"))
|
||||
itemlist.append(item.clone(title="Configuración del canal", action="configuracion", text_color="gold"))
|
||||
return itemlist
|
||||
|
||||
|
||||
def search(item, texto):
|
||||
logger.info()
|
||||
item.post = "Mode=List&Type=Video&Phrase=%s&SizeFrom=0&SizeTo=0&Extension=&ref=pager&pageNumber=1" % texto.replace(
|
||||
" ", "+")
|
||||
try:
|
||||
return listado(item)
|
||||
except:
|
||||
import sys, traceback
|
||||
for line in sys.exc_info():
|
||||
logger.error("%s" % line)
|
||||
logger.error(traceback.format_exc())
|
||||
return []
|
||||
|
||||
|
||||
def configuracion(item):
|
||||
ret = platformtools.show_channel_settings()
|
||||
platformtools.itemlist_refresh()
|
||||
return ret
|
||||
|
||||
|
||||
def listado(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
data_thumb = httptools.downloadpage(item.url, item.post.replace("Mode=List", "Mode=Gallery")).data
|
||||
if not item.post:
|
||||
data_thumb = ""
|
||||
item.url = item.url.replace("/gallery,", "/list,")
|
||||
data = httptools.downloadpage(item.url, item.post).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| |<br>", "", data)
|
||||
|
||||
folder = filetools.join(config.get_data_path(), 'thumbs_disko')
|
||||
patron = 'data-file-id(.*?</p>)</div></div>'
|
||||
bloques = scrapertools.find_multiple_matches(data, patron)
|
||||
for block in bloques:
|
||||
if "adult_info" in block and not adult_content:
|
||||
continue
|
||||
size = scrapertools.find_single_match(block, '<p.*?>([^<]+)</p>')
|
||||
patron = 'class="name"><a href="([^"]+)".*?>([^<]+)<'
|
||||
scrapedurl, scrapedtitle = scrapertools.find_single_match(block, patron)
|
||||
scrapedthumbnail = scrapertools.find_single_match(block, "background-image:url\('([^']+)'")
|
||||
if scrapedthumbnail:
|
||||
try:
|
||||
thumb = scrapedthumbnail.split("-", 1)[0].replace("?", "\?")
|
||||
if data_thumb:
|
||||
url_thumb = scrapertools.find_single_match(data_thumb, "(%s[^']+)'" % thumb)
|
||||
else:
|
||||
url_thumb = scrapedthumbnail
|
||||
scrapedthumbnail = filetools.join(folder, "%s.jpg" % url_thumb.split("e=", 1)[1][-20:])
|
||||
except:
|
||||
scrapedthumbnail = ""
|
||||
if scrapedthumbnail:
|
||||
t = threading.Thread(target=download_thumb, args=[scrapedthumbnail, url_thumb])
|
||||
t.setDaemon(True)
|
||||
t.start()
|
||||
else:
|
||||
scrapedthumbnail = item.extra + "/img/file_types/gallery/movie.png"
|
||||
scrapedurl = item.extra + scrapedurl
|
||||
title = "%s (%s)" % (scrapedtitle, size)
|
||||
if "adult_info" in block:
|
||||
title += " [COLOR %s][+18][/COLOR]" % color4
|
||||
plot = scrapertools.find_single_match(block, '<div class="desc">(.*?)</div>')
|
||||
if plot:
|
||||
plot = scrapertools.decodeHtmlentities(plot)
|
||||
new_item = Item(channel=item.channel, action="findvideos", title=title, url=scrapedurl,
|
||||
thumbnail=scrapedthumbnail, contentTitle=scrapedtitle, text_color=color2,
|
||||
extra=item.extra, infoLabels={'plot': plot}, post=item.post)
|
||||
if item.post:
|
||||
try:
|
||||
new_item.folderurl, new_item.foldername = scrapertools.find_single_match(block,
|
||||
'<p class="folder"><a href="([^"]+)".*?>([^<]+)<')
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
new_item.folderurl = item.url.rsplit("/", 1)[0]
|
||||
new_item.foldername = item.foldername
|
||||
new_item.fanart = item.thumbnail
|
||||
itemlist.append(new_item)
|
||||
next_page = scrapertools.find_single_match(data, 'class="pageSplitter.*?" data-nextpage-number="([^"]+)"')
|
||||
if next_page:
|
||||
if item.post:
|
||||
post = re.sub(r'pageNumber=(\d+)', "pageNumber=" + next_page, item.post)
|
||||
url = item.url
|
||||
else:
|
||||
url = re.sub(r',\d+\?ref=pager', ",%s?ref=pager" % next_page, item.url)
|
||||
post = ""
|
||||
itemlist.append(Item(channel=item.channel, action="listado", title=">> Página Siguiente (%s)" % next_page,
|
||||
url=url, post=post, extra=item.extra))
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
itemlist.append(item.clone(action="play", title="Reproducir/Descargar", server="diskokosmiko"))
|
||||
usuario = scrapertools.find_single_match(item.url, '%s/([^/]+)/' % item.extra)
|
||||
url_usuario = item.extra + "/" + usuario
|
||||
if item.folderurl and not item.folderurl.startswith(item.extra):
|
||||
item.folderurl = item.extra + item.folderurl
|
||||
if item.post:
|
||||
itemlist.append(item.clone(action="listado", title="Ver colección: %s" % item.foldername,
|
||||
url=item.folderurl + "/gallery,1,1?ref=pager", post=""))
|
||||
data = httptools.downloadpage(item.folderurl).data
|
||||
token = scrapertools.find_single_match(data,
|
||||
'data-action="followChanged.*?name="__RequestVerificationToken".*?value="([^"]+)"')
|
||||
collection_id = item.folderurl.rsplit("-", 1)[1]
|
||||
post = "__RequestVerificationToken=%s&collectionId=%s" % (token, collection_id)
|
||||
url = "%s/action/Follow/Follow" % item.extra
|
||||
title = "Seguir Colección: %s" % item.foldername
|
||||
if "dejar de seguir" in data:
|
||||
title = "Dejar de seguir la colección: %s" % item.foldername
|
||||
url = "%s/action/Follow/UnFollow" % item.extra
|
||||
itemlist.append(item.clone(action="seguir", title=title, url=url, post=post, text_color=color5, folder=False))
|
||||
itemlist.append(
|
||||
item.clone(action="colecciones", title="Ver colecciones del usuario: %s" % usuario, url=url_usuario))
|
||||
return itemlist
|
||||
|
||||
|
||||
def colecciones(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
usuario = False
|
||||
data = httptools.downloadpage(item.url).data
|
||||
if "Ver colecciones del usuario" not in item.title and not item.index:
|
||||
data = jsontools.load(data)["Data"]
|
||||
content = data["Content"]
|
||||
content = re.sub(r"\n|\r|\t|\s{2}| |<br>", "", content)
|
||||
else:
|
||||
usuario = True
|
||||
if item.follow:
|
||||
content = scrapertools.find_single_match(data,
|
||||
'id="followed_collections"(.*?)<div id="recommended_collections"')
|
||||
else:
|
||||
content = scrapertools.find_single_match(data,
|
||||
'<div id="collections".*?<div class="collections_list(.*?)<div class="collections_list')
|
||||
content = re.sub(r"\n|\r|\t|\s{2}| |<br>", "", content)
|
||||
patron = '<a class="name" href="([^"]+)".*?>([^<]+)<.*?src="([^"]+)".*?<p class="info">(.*?)</p>'
|
||||
matches = scrapertools.find_multiple_matches(content, patron)
|
||||
index = ""
|
||||
if item.index and item.index != "0":
|
||||
matches = matches[item.index:item.index + 20]
|
||||
if len(matches) > item.index + 20:
|
||||
index = item.index + 20
|
||||
elif len(matches) > 20:
|
||||
matches = matches[:20]
|
||||
index = 20
|
||||
folder = filetools.join(config.get_data_path(), 'thumbs_disko')
|
||||
for url, scrapedtitle, thumb, info in matches:
|
||||
url = item.extra + url + "/gallery,1,1?ref=pager"
|
||||
title = "%s (%s)" % (scrapedtitle, scrapertools.htmlclean(info))
|
||||
try:
|
||||
scrapedthumbnail = filetools.join(folder, "%s.jpg" % thumb.split("e=", 1)[1][-20:])
|
||||
except:
|
||||
try:
|
||||
scrapedthumbnail = filetools.join(folder, "%s.jpg" % thumb.split("/thumbnail/", 1)[1][-20:])
|
||||
thumb = thumb.replace("/thumbnail/", "/")
|
||||
except:
|
||||
scrapedthumbnail = ""
|
||||
if scrapedthumbnail:
|
||||
t = threading.Thread(target=download_thumb, args=[scrapedthumbnail, thumb])
|
||||
t.setDaemon(True)
|
||||
t.start()
|
||||
else:
|
||||
scrapedthumbnail = thumb
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="listado", title=title, url=url,
|
||||
thumbnail=scrapedthumbnail, text_color=color2, extra=item.extra,
|
||||
foldername=scrapedtitle))
|
||||
if not usuario and data.get("NextPageUrl"):
|
||||
url = item.extra + data["NextPageUrl"]
|
||||
itemlist.append(item.clone(title=">> Página Siguiente", url=url, text_color=""))
|
||||
elif index:
|
||||
itemlist.append(item.clone(title=">> Página Siguiente", url=item.url, index=index, text_color=""))
|
||||
return itemlist
|
||||
|
||||
|
||||
def seguir(item):
|
||||
logger.info()
|
||||
data = httptools.downloadpage(item.url, item.post)
|
||||
message = "Colección seguida"
|
||||
if "Dejar" in item.title:
|
||||
message = "La colección ya no se sigue"
|
||||
if data.sucess and config.get_platform() != "plex":
|
||||
platformtools.dialog_notification("Acción correcta", message)
|
||||
|
||||
|
||||
def cuenta(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
if "diskokosmiko" in item.extra:
|
||||
web = "diskokosmiko"
|
||||
logueado, error_message = login("diskokosmiko.mx")
|
||||
if not logueado:
|
||||
itemlist.append(item.clone(title=error_message, action="configuracion", folder=False))
|
||||
return itemlist
|
||||
user = config.get_setting("%suser" % web, "diskokosmiko")
|
||||
user = unicode(user, "utf8").lower().encode("utf8")
|
||||
url = item.extra + "/" + urllib.quote(user)
|
||||
data = httptools.downloadpage(url).data
|
||||
num_col = scrapertools.find_single_match(data, 'name="Has_collections" value="([^"]+)"')
|
||||
if num_col != "0":
|
||||
itemlist.append(item.clone(action="colecciones", url=url, index="0", title="Ver mis colecciones",
|
||||
text_color=color5))
|
||||
else:
|
||||
itemlist.append(item.clone(action="", title="No tienes ninguna colección", text_color=color4))
|
||||
|
||||
num_follow = scrapertools.find_single_match(data, 'name="Follows_collections" value="([^"]+)"')
|
||||
if num_follow != "0":
|
||||
itemlist.append(item.clone(action="colecciones", url=url, index="0", title="Colecciones que sigo",
|
||||
text_color=color5, follow=True))
|
||||
else:
|
||||
itemlist.append(item.clone(action="", title="No sigues ninguna colección", text_color=color4))
|
||||
return itemlist
|
||||
|
||||
|
||||
def filtro(item):
|
||||
logger.info()
|
||||
list_controls = []
|
||||
valores = {}
|
||||
dict_values = None
|
||||
list_controls.append({'id': 'search', 'label': 'Texto a buscar', 'enabled': True, 'color': '0xFFC52020',
|
||||
'type': 'text', 'default': '', 'visible': True})
|
||||
list_controls.append({'id': 'tipo', 'label': 'Tipo de búsqueda', 'enabled': True, 'color': '0xFFFF8000',
|
||||
'type': 'list', 'default': -1, 'visible': True})
|
||||
list_controls[1]['lvalues'] = ['Aplicación', 'Archivo', 'Documento', 'Imagen', 'Música', 'Vídeo', 'Todos']
|
||||
valores['tipo'] = ['Application', 'Archive', 'Document', 'Image', 'Music', 'Video', '']
|
||||
list_controls.append({'id': 'ext', 'label': 'Extensión', 'enabled': True, 'color': '0xFFF4FA58',
|
||||
'type': 'text', 'default': '', 'visible': True})
|
||||
list_controls.append({'id': 'tmin', 'label': 'Tamaño mínimo (MB)', 'enabled': True, 'color': '0xFFCC2EFA',
|
||||
'type': 'text', 'default': '0', 'visible': True})
|
||||
list_controls.append({'id': 'tmax', 'label': 'Tamaño máximo (MB)', 'enabled': True, 'color': '0xFF2ECCFA',
|
||||
'type': 'text', 'default': '0', 'visible': True})
|
||||
# Se utilizan los valores por defecto/guardados
|
||||
if "diskokosmiko" in item.extra:
|
||||
web = "diskokosmiko"
|
||||
valores_guardados = config.get_setting("filtro_defecto_" + web, item.channel)
|
||||
if valores_guardados:
|
||||
dict_values = valores_guardados
|
||||
item.valores = valores
|
||||
return platformtools.show_channel_settings(list_controls=list_controls, dict_values=dict_values,
|
||||
caption="Filtra la búsqueda", item=item, callback='filtrado')
|
||||
|
||||
|
||||
def filtrado(item, values):
|
||||
values_copy = values.copy()
|
||||
if "diskokosmiko" in item.extra:
|
||||
web = "diskokosmiko"
|
||||
# Guarda el filtro para que sea el que se cargue por defecto
|
||||
config.set_setting("filtro_defecto_" + web, values_copy, item.channel)
|
||||
tipo = item.valores["tipo"][values["tipo"]]
|
||||
search = values["search"]
|
||||
ext = values["ext"]
|
||||
tmin = values["tmin"]
|
||||
tmax = values["tmax"]
|
||||
if not tmin.isdigit():
|
||||
tmin = "0"
|
||||
if not tmax.isdigit():
|
||||
tmax = "0"
|
||||
item.valores = ""
|
||||
item.post = "Mode=List&Type=%s&Phrase=%s&SizeFrom=%s&SizeTo=%s&Extension=%s&ref=pager&pageNumber=1" \
|
||||
% (tipo, search, tmin, tmax, ext)
|
||||
item.action = "listado"
|
||||
return listado(item)
|
||||
|
||||
|
||||
def download_thumb(filename, url):
|
||||
lock = threading.Lock()
|
||||
lock.acquire()
|
||||
folder = filetools.join(config.get_data_path(), 'thumbs_disko')
|
||||
if not filetools.exists(folder):
|
||||
filetools.mkdir(folder)
|
||||
lock.release()
|
||||
if not filetools.exists(filename):
|
||||
downloadtools.downloadfile(url, filename, silent=True)
|
||||
return filename
|
||||
|
||||
|
||||
def delete_cache(url):
|
||||
folder = filetools.join(config.get_data_path(), 'thumbs_disko')
|
||||
filetools.rmdirtree(folder)
|
||||
if config.is_xbmc():
|
||||
xbmc.executebuiltin("Container.Refresh")
|
||||
@@ -43,6 +43,28 @@
|
||||
"VOSE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "emergency_urls",
|
||||
"type": "list",
|
||||
"label": "Se quieren guardar Enlaces de Emergencia por si se cae la Web?",
|
||||
"default": 1,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": [
|
||||
"No",
|
||||
"Guardar",
|
||||
"Borrar",
|
||||
"Actualizar"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "emergency_urls_torrents",
|
||||
"type": "bool",
|
||||
"label": "Se quieren guardar Torrents de Emergencia por si se cae la Web?",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": "!eq(-1,'No')"
|
||||
},
|
||||
{
|
||||
"id": "timeout_downloadpage",
|
||||
"type": "list",
|
||||
|
||||
@@ -514,10 +514,10 @@ def listado(item):
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
itemlist_t = [] #Itemlist total de enlaces
|
||||
itemlist_f = [] #Itemlist de enlaces filtrados
|
||||
itemlist_t = [] #Itemlist total de enlaces
|
||||
itemlist_f = [] #Itemlist de enlaces filtrados
|
||||
if not item.language:
|
||||
item.language = ['CAST'] #Castellano por defecto
|
||||
item.language = ['CAST'] #Castellano por defecto
|
||||
matches = []
|
||||
item.category = categoria
|
||||
|
||||
@@ -526,7 +526,7 @@ def findvideos(item):
|
||||
#Bajamos los datos de la página
|
||||
data = ''
|
||||
patron = '<a onclick="eventDownloadTorrent\(.*?\)".?class="linktorrent" href="([^"]+)">'
|
||||
if item.contentType == 'movie':
|
||||
if item.contentType == 'movie': #Es una peli
|
||||
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")
|
||||
@@ -536,43 +536,73 @@ def findvideos(item):
|
||||
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
|
||||
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||
matches = item.emergency_urls[0] #Restauramos matches
|
||||
item.armagedon = True #Marcamos la situación como catastrófica
|
||||
else:
|
||||
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
||||
return item #Devolvemos el Item de la llamada
|
||||
else:
|
||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
if not item.armagedon: #Si es un proceso normal, seguimos
|
||||
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:
|
||||
item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
|
||||
if item.intervencion: #Sí ha sido clausurada judicialmente
|
||||
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error
|
||||
else:
|
||||
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'))
|
||||
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||
matches = item.emergency_urls[0] #Restauramos matches
|
||||
item.armagedon = True #Marcamos la situación como catastrófica
|
||||
else:
|
||||
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
||||
return item #Devolvemos el Item de la llamada
|
||||
else:
|
||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||
|
||||
else: #Es un episodio
|
||||
matches = [item.url]
|
||||
|
||||
#logger.debug("PATRON: " + patron)
|
||||
#logger.debug(matches)
|
||||
#logger.debug(data)
|
||||
|
||||
#Si es un lookup para cargar las urls de emergencia en la Videoteca...
|
||||
if item.videolibray_emergency_urls:
|
||||
item.emergency_urls = []
|
||||
item.emergency_urls.append(matches) #Salvamnos matches...
|
||||
return item #... y nos vamos
|
||||
|
||||
#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
|
||||
for scrapedurl in matches: #leemos los torrents con la diferentes calidades
|
||||
#Generamos una copia de Item para trabajar sobre ella
|
||||
item_local = item.clone()
|
||||
|
||||
#Buscamos si ya tiene tamaño, si no, los buscamos en el archivo .torrent
|
||||
size = scrapertools.find_single_match(item_local.quality, '\s\[(\d+,?\d*?\s\w\s?[b|B])\]')
|
||||
if not size:
|
||||
size = generictools.get_torrent_size(item_local.url) #Buscamos el tamaño en el .torrent
|
||||
if not size and not item.armagedon:
|
||||
size = generictools.get_torrent_size(item_local.url) #Buscamos el tamaño en el .torrent
|
||||
if size:
|
||||
item_local.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item_local.title) #Quitamos size de título, si lo traía
|
||||
item_local.title = '%s [%s]' % (item_local.title, size) #Agregamos size al final del título
|
||||
size = size.replace('GB', 'G B').replace('Gb', 'G b').replace('MB', 'M B').replace('Mb', 'M b')
|
||||
item_local.quality = re.sub(r'\s\[\d+,?\d*?\s\w\s?[b|B]\]', '', item_local.quality) #Quitamos size de calidad, si lo traía
|
||||
item_local.quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final de la calidad
|
||||
item_local.quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final de la calidad
|
||||
|
||||
#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 :
|
||||
if host not in item_local.url and host.replace('https', 'http') not in item_local.url and not item.armagedon:
|
||||
item_local.url = host + item_local.url
|
||||
if item_local.url and not item.armagedon:
|
||||
item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la url del .Torrent ALTERNATIVA
|
||||
if item.armagedon: #Si es catastrófico, lo marcamos
|
||||
item_local.quality = '[/COLOR][COLOR hotpink][E] [COLOR limegreen]%s' % item_local.quality
|
||||
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 y calidad, quitamos etiquetas vacías
|
||||
@@ -583,14 +613,14 @@ def findvideos(item):
|
||||
item_local.quality = re.sub(r'\s?\[COLOR \w+\]\s?\[\/COLOR\]', '', item_local.quality)
|
||||
item_local.quality = item_local.quality.replace("--", "").replace("[]", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
|
||||
|
||||
item_local.alive = "??" #Calidad del link sin verificar
|
||||
item_local.action = "play" #Visualizar vídeo
|
||||
item_local.server = "torrent" #Seridor Torrent
|
||||
item_local.alive = "??" #Calidad del link sin verificar
|
||||
item_local.action = "play" #Visualizar vídeo
|
||||
item_local.server = "torrent" #Seridor Torrent
|
||||
|
||||
itemlist_t.append(item_local.clone()) #Pintar pantalla, si no se filtran idiomas
|
||||
itemlist_t.append(item_local.clone()) #Pintar pantalla, si no se filtran idiomas
|
||||
|
||||
# Requerido para FilterTools
|
||||
if config.get_setting('filter_languages', channel) > 0: #Si hay idioma seleccionado, se filtra
|
||||
if config.get_setting('filter_languages', channel) > 0: #Si hay idioma seleccionado, se filtra
|
||||
itemlist_f = filtertools.get_link(itemlist_f, item_local, list_language) #Pintar pantalla, si no está vacío
|
||||
|
||||
#logger.debug("TORRENT: " + scrapedurl + " / title gen/torr: " + item.title + " / " + item_local.title + " / calidad: " + item_local.quality + " / content: " + item_local.contentTitle + " / " + item_local.contentSerieName)
|
||||
|
||||
@@ -46,6 +46,28 @@
|
||||
"VOSE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "emergency_urls",
|
||||
"type": "list",
|
||||
"label": "Se quieren guardar Enlaces de Emergencia por si se cae la Web?",
|
||||
"default": 1,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": [
|
||||
"No",
|
||||
"Guardar",
|
||||
"Borrar",
|
||||
"Actualizar"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "emergency_urls_torrents",
|
||||
"type": "bool",
|
||||
"label": "Se quieren guardar Torrents de Emergencia por si se cae la Web?",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": "!eq(-1,'No')"
|
||||
},
|
||||
{
|
||||
"id": "include_in_newest_peliculas",
|
||||
"type": "bool",
|
||||
|
||||
@@ -309,10 +309,10 @@ def listado(item):
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
itemlist_t = [] #Itemlist total de enlaces
|
||||
itemlist_f = [] #Itemlist de enlaces filtrados
|
||||
itemlist_t = [] #Itemlist total de enlaces
|
||||
itemlist_f = [] #Itemlist de enlaces filtrados
|
||||
if not item.language:
|
||||
item.language = ['CAST'] #Castellano por defecto
|
||||
item.language = ['CAST'] #Castellano por defecto
|
||||
|
||||
#Bajamos los datos de la página
|
||||
data = ''
|
||||
@@ -324,8 +324,35 @@ def findvideos(item):
|
||||
if not data:
|
||||
logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url + " / DATA: " + data)
|
||||
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
|
||||
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||
link_torrent = item.emergency_urls[0][0] #Guardamos la url del .Torrent
|
||||
link_magnet = item.emergency_urls[1][0] #Guardamos la url del .Magnet
|
||||
item.armagedon = True #Marcamos la situación como catastrófica
|
||||
else:
|
||||
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
||||
return item #Devolvemos el Item de la llamada
|
||||
else:
|
||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||
#data = unicode(data, "utf-8", errors="replace")
|
||||
|
||||
patron_t = '<div class="enlace_descarga".*?<a href="(.*?\.torrent)"'
|
||||
patron_m = '<div class="enlace_descarga".*?<a href="(magnet:?.*?)"'
|
||||
if not item.armagedon: #Si es un proceso normal, seguimos
|
||||
link_torrent = scrapertools.find_single_match(data, patron_t)
|
||||
link_torrent = urlparse.urljoin(item.url, link_torrent)
|
||||
link_torrent = link_torrent.replace(" ", "%20") #sustituimos espacios por %20, por si acaso
|
||||
#logger.info("link Torrent: " + link_torrent)
|
||||
|
||||
link_magnet = scrapertools.find_single_match(data, patron_m)
|
||||
link_magnet = urlparse.urljoin(item.url, link_magnet)
|
||||
#logger.info("link Magnet: " + link_magnet)
|
||||
|
||||
#Si es un lookup para cargar las urls de emergencia en la Videoteca...
|
||||
if (link_torrent or link_magnet) and item.videolibray_emergency_urls:
|
||||
item.emergency_urls = []
|
||||
item.emergency_urls.append([link_torrent]) #Salvamos el enlace de .torrent
|
||||
item.emergency_urls.append([link_magnet]) #Salvamos el enlace de .magnet
|
||||
return item #... y nos vamos
|
||||
|
||||
#Añadimos el tamaño para todos
|
||||
size = scrapertools.find_single_match(item.quality, '\s\[(\d+,?\d*?\s\w\s?[b|B]s)\]')
|
||||
@@ -333,32 +360,28 @@ def findvideos(item):
|
||||
item.title = re.sub('\s\[\d+,?\d*?\s\w[b|B]s\]', '', 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
|
||||
item.quality = re.sub('\s\[\d+,?\d*?\s\w\s?[b|B]s\]', '', item.quality) #Quitamos size de calidad, si lo traía
|
||||
|
||||
patron_t = '<div class="enlace_descarga".*?<a href="(.*?\.torrent)"'
|
||||
link_torrent = scrapertools.find_single_match(data, patron_t)
|
||||
link_torrent = urlparse.urljoin(item.url, link_torrent)
|
||||
link_torrent = link_torrent.replace(" ", "%20") #sustituimos espacios por %20, por si acaso
|
||||
#logger.info("link Torrent: " + link_torrent)
|
||||
|
||||
patron_m = '<div class="enlace_descarga".*?<a href="(magnet:?.*?)"'
|
||||
link_magnet = scrapertools.find_single_match(data, patron_m)
|
||||
link_magnet = urlparse.urljoin(item.url, link_magnet)
|
||||
#logger.info("link Magnet: " + link_magnet)
|
||||
|
||||
if not link_torrent and not link_magnet: #error
|
||||
item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
|
||||
if item.intervencion: #Sí ha sido clausurada judicialmente
|
||||
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error
|
||||
return itemlist #Salimos
|
||||
|
||||
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron_t + " / " + patron_m + " / DATA: " + data)
|
||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log'))
|
||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||
else:
|
||||
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron_t + " / " + patron_m + " / DATA: " + data)
|
||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log'))
|
||||
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||
link_torrent = item.emergency_urls[0][0] #Guardamos la url del .Torrent
|
||||
link_magnet = item.emergency_urls[1][0] #Guardamos la url del .Magnet
|
||||
item.armagedon = True #Marcamos la situación como catastrófica
|
||||
else:
|
||||
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
||||
return item #Devolvemos el Item de la llamada
|
||||
else:
|
||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||
|
||||
#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)
|
||||
|
||||
if not size:
|
||||
if not size and not item.armagedon:
|
||||
size = generictools.get_torrent_size(link_torrent) #Buscamos el tamaño en el .torrent
|
||||
if size:
|
||||
item.quality = '%s [%s]' % (item.quality, size) #Agregamos size al final de calidad
|
||||
@@ -372,7 +395,12 @@ def findvideos(item):
|
||||
if item_local.quality:
|
||||
item_local.quality += " "
|
||||
item_local.quality += "[Torrent]"
|
||||
if item.armagedon: #Si es catastrófico, lo marcamos
|
||||
item_local.quality = '[/COLOR][COLOR hotpink][E] [COLOR limegreen]%s' % item_local.quality
|
||||
item_local.url = link_torrent
|
||||
if item_local.url and not item.armagedon:
|
||||
item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la url del .Torrent ALTERNATIVA
|
||||
|
||||
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
|
||||
|
||||
#Preparamos título y calidad, quitamos etiquetas vacías
|
||||
@@ -411,6 +439,8 @@ def findvideos(item):
|
||||
if item_local.quality:
|
||||
item_local.quality += " "
|
||||
item_local.quality = item_local.quality.replace("[Torrent]", "") + "[Magnet]"
|
||||
if item.armagedon: #Si es catastrófico, lo marcamos
|
||||
item_local.quality = '[/COLOR][COLOR hotpink][E] [COLOR limegreen]%s' % item_local.quality
|
||||
item_local.url = link_magnet
|
||||
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 Magnet
|
||||
item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title) #Quitamos etiquetas vacías
|
||||
|
||||
@@ -46,6 +46,28 @@
|
||||
"VOSE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "emergency_urls",
|
||||
"type": "list",
|
||||
"label": "Se quieren guardar Enlaces de Emergencia por si se cae la Web?",
|
||||
"default": 1,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": [
|
||||
"No",
|
||||
"Guardar",
|
||||
"Borrar",
|
||||
"Actualizar"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "emergency_urls_torrents",
|
||||
"type": "bool",
|
||||
"label": "Se quieren guardar Torrents de Emergencia por si se cae la Web?",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": "!eq(-1,'No')"
|
||||
},
|
||||
{
|
||||
"id": "seleccionar_serie_temporada",
|
||||
"type": "list",
|
||||
|
||||
@@ -427,41 +427,66 @@ def findvideos(item):
|
||||
|
||||
#logger.debug(item)
|
||||
|
||||
timeout_find = timeout
|
||||
if item.videolibray_emergency_urls: #Si se están cacheando enlaces aumentamos el timeout
|
||||
timeout_find = timeout * 2
|
||||
elif item.emergency_urls: #Si se llama desde la Videoteca con enlaces cacheados...
|
||||
timeout_find = timeout / 2 #reducimos el timeout antes de saltar a los enlaces cacheados
|
||||
|
||||
#Bajamos los datos de la página
|
||||
data = ''
|
||||
try:
|
||||
data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url, timeout=timeout).data)
|
||||
data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url, timeout=timeout_find).data)
|
||||
except:
|
||||
pass
|
||||
|
||||
if not data:
|
||||
logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url + " / DATA: " + data)
|
||||
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
|
||||
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||
matches = item.emergency_urls[1] #Guardamos los matches de los .Torrent
|
||||
item.armagedon = True #Marcamos la situación como catastrófica
|
||||
else:
|
||||
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
||||
return item #Devolvemos el Item de la llamada
|
||||
else:
|
||||
return itemlist #salimos
|
||||
data = unicode(data, "utf-8", errors="replace").encode("utf-8")
|
||||
data = scrapertools.find_single_match(data, 'div id="Tokyo" [^>]+>(.*?)</div>') #Seleccionamos la zona de links
|
||||
|
||||
patron = '\/icono_.*?png" title="(?P<lang>.*?)?" [^>]+><\/td><td>(?P<quality>.*?)?<?\/td>.*?<td>(?P<size>.*?)?<\/td><td><a class="link" href="(?P<url>.*?)?"'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
if not item.armagedon: #Si es un proceso normal, seguimos
|
||||
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_findvideos(item, itemlist) #Llamamos al método para el pintado del error
|
||||
return itemlist #Salimos
|
||||
|
||||
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
|
||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log'))
|
||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||
else:
|
||||
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
|
||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log'))
|
||||
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||
matches = item.emergency_urls[1] #Guardamos los matches de los .Torrent
|
||||
item.armagedon = True #Marcamos la situación como catastrófica
|
||||
else:
|
||||
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
||||
return item #Devolvemos el Item de la llamada
|
||||
else:
|
||||
return itemlist #salimos
|
||||
|
||||
#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 recorremos todos los links por calidades
|
||||
if item.videolibray_emergency_urls: #Viene de un lookup desde episodios para cachear enlaces
|
||||
emergency_torrents = []
|
||||
emergency_urls = []
|
||||
i = -1
|
||||
for lang, quality, size, scrapedurl in matches:
|
||||
i += 1
|
||||
temp_epi = ''
|
||||
if scrapertools.find_single_match(quality, '\s?\(Contrase.+?: <font color="[^>]*>(.*?)<\/font>\)'):
|
||||
password = scrapertools.find_single_match(quality, '\s?\(Contrase.+?: <font color="[^>]*>(.*?)<\/font>\)')
|
||||
@@ -500,6 +525,12 @@ def findvideos(item):
|
||||
if (contentSeason != item.contentSeason or contentEpisodeNumber != item.contentEpisodeNumber) and item.contentEpisodeNumber != 0:
|
||||
continue #si no son iguales, lo ignoramos
|
||||
|
||||
#Si es un looup desde episodios para cachear enlaces, lo salvamos en este momento
|
||||
if item.videolibray_emergency_urls:
|
||||
emergency_torrents.append(scrapedurl)
|
||||
emergency_urls.append(matches[i])
|
||||
continue
|
||||
|
||||
#Generamos una copia de Item para trabajar sobre ella
|
||||
item_local = item.clone()
|
||||
|
||||
@@ -527,7 +558,7 @@ def findvideos(item):
|
||||
item_local.quality = '%s [/COLOR][COLOR white][%s h]' % (item_local.quality, scrapertools.find_single_match(item.quality, '(\d+:\d+)'))
|
||||
|
||||
#if size and item_local.contentType != "episode":
|
||||
if not size:
|
||||
if not size and not item.armagedon:
|
||||
size = generictools.get_torrent_size(scrapedurl) #Buscamos el tamaño en el .torrent
|
||||
if size:
|
||||
size = size.replace(".", ",").replace("B,", " B").replace("b,", " b")
|
||||
@@ -544,8 +575,13 @@ def findvideos(item):
|
||||
#Salvamos la url del .torrent
|
||||
if scrapedurl:
|
||||
item_local.url = scrapedurl
|
||||
if item_local.emergency_urls and not item.armagedon:
|
||||
item_local = find_torrent_alt(item_local) #Si hay enlaces de emergencia los usamos como alternativos
|
||||
if item.armagedon: #Si es catastrófico, lo marcamos
|
||||
item_local.url = item.emergency_urls[0][i]
|
||||
item_local.quality = '[/COLOR][COLOR hotpink][E] [COLOR limegreen]%s' % item_local.quality
|
||||
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
|
||||
|
||||
|
||||
#Preparamos título y calidad, quitamos etiquetas vacías
|
||||
item_local.title = re.sub(r'\s?\[COLOR \w+\]\[\[?\s?\]?\]\[\/COLOR\]', '', item_local.title)
|
||||
item_local.title = re.sub(r'\s?\[COLOR \w+\]\s?\[\/COLOR\]', '', item_local.title)
|
||||
@@ -554,19 +590,26 @@ def findvideos(item):
|
||||
item_local.quality = re.sub(r'\s?\[COLOR \w+\]\s?\[\/COLOR\]', '', item_local.quality)
|
||||
item_local.quality = item_local.quality.replace("--", "").replace("[]", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
|
||||
|
||||
item_local.alive = "??" #Calidad del link sin verificar
|
||||
item_local.action = "play" #Visualizar vídeo
|
||||
item_local.server = "torrent" #Seridor Torrent
|
||||
item_local.alive = "??" #Calidad del link sin verificar
|
||||
item_local.action = "play" #Visualizar vídeo
|
||||
item_local.server = "torrent" #Seridor Torrent
|
||||
|
||||
itemlist_t.append(item_local.clone()) #Pintar pantalla, si no se filtran idiomas
|
||||
|
||||
# Requerido para FilterTools
|
||||
if config.get_setting('filter_languages', channel) > 0: #Si hay idioma seleccionado, se filtra
|
||||
if config.get_setting('filter_languages', channel) > 0: #Si hay idioma seleccionado, se filtra
|
||||
itemlist_f = filtertools.get_link(itemlist_f, item_local, list_language) #Pintar pantalla, si no está vacío
|
||||
|
||||
#logger.debug("TORRENT: " + item_local.url + " / title gen/torr: " + item.title + " / " + item_local.title + " / calidad: " + item_local.quality)
|
||||
#logger.debug(item_local)
|
||||
|
||||
if item.videolibray_emergency_urls: #Viene de un lookup desde episodios para cachear enlaces
|
||||
if len(emergency_torrents) > 0:
|
||||
item.emergency_urls = [] #Le damos el formato estandar: lista de listas de tuplas
|
||||
item.emergency_urls.append(emergency_torrents) #Devolvemos las urls de .torrents cacheadas
|
||||
item.emergency_urls.append(emergency_urls) #Devolvemos los matches cacheados
|
||||
return item
|
||||
|
||||
if len(itemlist_f) > 0: #Si hay entradas filtradas...
|
||||
itemlist.extend(itemlist_f) #Pintamos pantalla filtrada
|
||||
else:
|
||||
@@ -651,26 +694,29 @@ def episodios(item):
|
||||
if item.library_playcounts["season %d" % s] < temp_actual_num: #Si menor que actual, es Temp.
|
||||
item.contentType = "season"
|
||||
else:
|
||||
item.contentType = "tvshow" #No es Temporada 1, pero es más baja que la actual. Es Serie
|
||||
item.contentType = "tvshow" #No es Temporada 1, pero es más baja que la actual. Es Serie
|
||||
break
|
||||
s += 1
|
||||
else: #Sí, es Serie
|
||||
else: #Sí, es Serie
|
||||
item.contentType = "tvshow"
|
||||
|
||||
else: #Solo hay una temporada en la Videoteca
|
||||
if temp_actual_num > 1: #es Temporada la actual?
|
||||
else: #Solo hay una temporada en la Videoteca
|
||||
if temp_actual_num > 1: #es Temporada la actual?
|
||||
if item.contentSeason:
|
||||
item.contentType = "season" #Si está informado el num de Temp. se creó como Temporada
|
||||
item.contentType = "season" #Si está informado el num de Temp. se creó como Temporada
|
||||
else:
|
||||
item.contentType = "tvshow" #Si no, es Serie que no tiene Temp. 1
|
||||
else: #Si es Temp. 1, se procesa según el valor de configuración
|
||||
if modo_serie_temp == 0: #Es Temporada
|
||||
item.contentType = "tvshow" #Si no, es Serie que no tiene Temp. 1
|
||||
else: #Si es Temp. 1, se procesa según el valor de configuración
|
||||
if modo_serie_temp == 0: #Es Temporada
|
||||
item.contentType = "season"
|
||||
else: #Es Serie
|
||||
else: #Es Serie
|
||||
item.contentType = "tvshow"
|
||||
else:
|
||||
item.contentType = "list"
|
||||
|
||||
if item.ow_force == '1': #Si viene formazado la reconstrucción de la serie, lo hacemo
|
||||
item.contentType = "tvshow"
|
||||
|
||||
temp_lista = []
|
||||
temp_bucle = 0
|
||||
temp_next_alt = ''
|
||||
@@ -753,7 +799,7 @@ def episodios(item):
|
||||
break #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||
|
||||
if item.contentType == "season":
|
||||
temp_advance = '' #Es la única temporada
|
||||
temp_advance = '' #Es la últica temporada
|
||||
if temp_next and item.library_playcounts: #Permitimos en actualización de Videoteca añadir nuevas temporadas
|
||||
temp_advance = 'forw' #Si hay nueva temporada, pasamos a esa como actual
|
||||
temp_previous = '' #lo limpiamos, por control
|
||||
@@ -910,6 +956,22 @@ def episodios(item):
|
||||
return itemlist
|
||||
|
||||
|
||||
def find_torrent_alt(item):
|
||||
logger.info()
|
||||
|
||||
if not item.emergency_urls:
|
||||
return item
|
||||
|
||||
i = 0
|
||||
for lang, quality, size, scrapedurl in item.emergency_urls[1]: #buscamos la url actual en la lista de matches cacheada
|
||||
if item.url == scrapedurl: #si está ...
|
||||
item.torrent_alt = item.emergency_urls[0][i] #... copiamos la url o la dirección de .torrent local
|
||||
break #... y nos vamos
|
||||
i += 1
|
||||
|
||||
return item
|
||||
|
||||
|
||||
def lookup_idiomas_paginacion(item, scrapedurl, title, lang, list_language):
|
||||
logger.info()
|
||||
estado = True
|
||||
|
||||
@@ -62,6 +62,14 @@
|
||||
"Actualizar"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "emergency_urls_torrents",
|
||||
"type": "bool",
|
||||
"label": "Se quieren guardar Torrents de Emergencia por si se cae la Web?",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": "!eq(-1,'No')"
|
||||
},
|
||||
{
|
||||
"id": "clonenewpct1_channel_default",
|
||||
"type": "list",
|
||||
@@ -70,11 +78,11 @@
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": [
|
||||
"Torrentrapid",
|
||||
"Tumejortorrent",
|
||||
"Torrentlocura",
|
||||
"Tvsinpagar",
|
||||
"Planetatorrent",
|
||||
"Torrentrapid",
|
||||
"Tumejortorrent",
|
||||
"Descargas2020",
|
||||
"Mispelisyseries"
|
||||
]
|
||||
@@ -83,7 +91,7 @@
|
||||
"id": "clonenewpct1_channels_list",
|
||||
"type": "text",
|
||||
"label": "Lista de clones de NewPct1 y orden de uso",
|
||||
"default": "('1', 'torrentrapid', 'http://torrentrapid.com/', 'movie, tvshow, season, episode', 'serie_episodios'), ('1', 'tumejortorrent', 'http://tumejortorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'torrentlocura', 'http://torrentlocura.com/', 'movie, tvshow, season, episode', ''), ('1', 'tvsinpagar', 'http://www.tvsinpagar.com/', 'tvshow, season, episode', ''), ('1', 'planetatorrent', 'http://planetatorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'descargas2020', 'http://descargas2020.com/', 'movie, tvshow, season, episode', ''), ('1', 'mispelisyseries', 'http://mispelisyseries.com/', 'movie', 'search, listado_busqueda')",
|
||||
"default": "('1', 'torrentlocura', 'http://torrentlocura.com/', 'movie, tvshow, season, episode', ''), ('1', 'tvsinpagar', 'http://www.tvsinpagar.com/', 'tvshow, season, episode', ''), ('1', 'planetatorrent', 'http://planetatorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'torrentrapid', 'http://torrentrapid.com/', 'movie, tvshow, season, episode', 'serie_episodios'), ('1', 'tumejortorrent', 'http://tumejortorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'descargas2020', 'http://descargas2020.com/', 'movie, tvshow, season, episode', ''), ('1', 'mispelisyseries', 'http://mispelisyseries.com/', 'movie', 'search, listado_busqueda')",
|
||||
"enabled": true,
|
||||
"visible": false
|
||||
},
|
||||
|
||||
@@ -1237,6 +1237,7 @@ def listado_busqueda(item):
|
||||
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
from core import videolibrarytools
|
||||
itemlist = []
|
||||
itemlist_t = [] #Itemlist total de enlaces
|
||||
itemlist_f = [] #Itemlist de enlaces filtrados
|
||||
@@ -1361,38 +1362,46 @@ def findvideos(item):
|
||||
# Descarga la página
|
||||
data = ''
|
||||
data_servidores = ''
|
||||
enlaces_ver = ''
|
||||
try:
|
||||
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url, timeout=timeout).data)
|
||||
data = data.replace("$!", "#!").replace("'", "\"").replace("ñ", "ñ").replace("//pictures", "/pictures")
|
||||
url_servidores = item.url
|
||||
category_servidores = item.category
|
||||
data_servidores = data #salvamos data para verificar servidores, si es necesario
|
||||
except: #La web no responde. Probemos las urls de emergencia
|
||||
data_servidores = data #salvamos data para verificar servidores, si es necesario
|
||||
data_servidores_stat = False
|
||||
except: #La web no responde. Probemos las urls de emergencia
|
||||
pass
|
||||
|
||||
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";' #Patron para .torrent
|
||||
if not scrapertools.find_single_match(data, patron):
|
||||
patron = '<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"' #Patron para .torrent (planetatorrent)
|
||||
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";' #Patron para .torrent
|
||||
patron_mult = 'torrent:check:status|' + patron
|
||||
if 'planetatorrent' in item.channel_host:
|
||||
patron = '<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"' #Patron para .torrent (planetatorrent)
|
||||
patron_mult += '|<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"'
|
||||
#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
|
||||
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error
|
||||
if item.emergency_urls: #Hay urls de emergencia?
|
||||
item.url = item.emergency_urls[0] #Guardamos la url del .Torrent
|
||||
enlaces_ver = item.emergency_urls[1] #Guardamos los datos iniciales de los Servidores Directos
|
||||
item.armagedon = True #Marcamos la situación como catastrófica
|
||||
else:
|
||||
return itemlist #Salimos
|
||||
if not data or not scrapertools.find_single_match(data, patron) or not videolibrarytools.verify_url_torrent(scrapertools.find_single_match(data, patron)): # Si no hay datos o url, error
|
||||
item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
|
||||
if item.intervencion: #Sí ha sido clausurada judicialmente
|
||||
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error
|
||||
else:
|
||||
logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url + " / PATRON: " + patron + " / DATA: " + data)
|
||||
|
||||
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||
itemlist.append(item.clone(action='', title=item.category + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log'))
|
||||
item.url = item.emergency_urls[0][0] #Guardamos la url del .Torrent
|
||||
try:
|
||||
enlaces_ver = item.emergency_urls[1] #Guardamos los datos iniciales de los Servidores Directos
|
||||
except:
|
||||
pass
|
||||
item.armagedon = True #Marcamos la situación como catastrófica
|
||||
data = 'xyz123' #Para que no haga más preguntas
|
||||
else:
|
||||
logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url + " / DATA: " + data)
|
||||
|
||||
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el vídeo
|
||||
item, data = generictools.fail_over_newpct1(item, patron)
|
||||
|
||||
item, data = generictools.fail_over_newpct1(item, patron_mult)
|
||||
|
||||
if not data: #Si no ha logrado encontrar nada, verificamos si hay servidores
|
||||
cnt_servidores = 0
|
||||
item.category = category_servidores #restauramos valores originales
|
||||
item.category = category_servidores #restauramos valores originales
|
||||
item.url = url_servidores
|
||||
|
||||
# Sistema de scrapeo de servidores creado por Torrentlocula, compatible con otros clones de Newpct1
|
||||
@@ -1414,19 +1423,23 @@ def findvideos(item):
|
||||
#Miramos si ha servidores
|
||||
if not data_servidores: #Si no ha logrado encontrar nada nos vamos
|
||||
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo'))
|
||||
if item.emergency_urls: #Hay urls de emergencia?
|
||||
item.url = str(item.emergency_urls[0]).replace ("'", "").replace ("[", "").replace ("]", "") #Guardamos la url del .Torrent
|
||||
enlaces_ver = item.emergency_urls[1] #Guardamos los datos iniciales de los Servidores Directos
|
||||
item.armagedon = True #Marcamos la situación como catastrófica
|
||||
itemlist.append(item.clone(action='', title=item.category + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log'))
|
||||
if item.videolibray_emergency_urls:
|
||||
return item
|
||||
else:
|
||||
itemlist.append(item.clone(action='', title=item.category + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log'))
|
||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||
|
||||
data = data_servidores #restauramos los datos
|
||||
data_servidores_stat = True #Marcamos como que los hemos usado
|
||||
|
||||
data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8")
|
||||
data = data.replace("$!", "#!").replace("'", "\"").replace("ñ", "ñ").replace("//pictures", "/pictures")
|
||||
|
||||
# patrón para la url torrent
|
||||
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";' #Patron para .torrent
|
||||
if not scrapertools.find_single_match(data, patron):
|
||||
patron = '<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"' #Patron para .torrent (planetatorrent)
|
||||
|
||||
#buscamos el tamaño del .torrent
|
||||
size = scrapertools.find_single_match(data, '<div class="entry-left".*?><a href=".*?span class=.*?>Size:<\/strong>?\s(\d+?\.?\d*?\s\w[b|B])<\/span>')
|
||||
if not size: #Para planetatorrent
|
||||
@@ -1434,8 +1447,8 @@ def findvideos(item):
|
||||
size = size.replace(".", ",") #sustituimos . por , porque Unify lo borra
|
||||
if not size:
|
||||
size = scrapertools.find_single_match(item.quality, '\s?\[(\d+.?\d*?\s?\w\s?[b|B])\]')
|
||||
if not size:
|
||||
size = generictools.get_torrent_size(item.url) #Buscamos el tamaño en el .torrent
|
||||
if not size and not item.armagedon:
|
||||
size = generictools.get_torrent_size(scrapertools.find_single_match(data, patron)) #Buscamos el tamaño en el .torrent
|
||||
if size:
|
||||
item.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
|
||||
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
|
||||
@@ -1443,37 +1456,41 @@ def findvideos(item):
|
||||
item.quality = re.sub(r'\s\[\d+,?\d*?\s\w\s?[b|B]\]', '', item.quality) #Quitamos size de calidad, si lo traía
|
||||
|
||||
#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)
|
||||
if not item.videolibray_emergency_urls:
|
||||
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist)
|
||||
|
||||
#Generamos una copia de Item para trabajar sobre ella
|
||||
item_local = item.clone()
|
||||
|
||||
# obtenemos la url torrent o usamos la de emergencia
|
||||
if not item.armagedon: #Si es un proceso normal, seguimos
|
||||
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";' #Patron para .torrent
|
||||
if not scrapertools.find_single_match(data, patron):
|
||||
patron = '<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"' #Patron para .torrent (planetatorrent)
|
||||
# Verificamos la url torrent o usamos la de emergencia
|
||||
if not item.armagedon:
|
||||
item_local.url = scrapertools.find_single_match(data, patron)
|
||||
if not item_local.url: #error
|
||||
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
|
||||
if item.emergency_urls: #Hay urls de emergencia?
|
||||
item.url = item.emergency_urls[0] #Guardamos la url del .Torrent
|
||||
item.armagedon = True #Marcamos la situación como catastrófica
|
||||
if item_local.url == 'javascript:;':
|
||||
item_local.url = '' #evitamos url vacías
|
||||
item_local.url = item_local.url.replace(" ", "%20") #sustituimos espacios por %20, por si acaso
|
||||
#logger.debug("Patron: " + patron + " url: " + item_local.url)
|
||||
#logger.debug(data)
|
||||
|
||||
if item_local.url and item.emergency_urls: #la url no está verificada
|
||||
item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la url del .Torrent ALTERNATIVA
|
||||
|
||||
if not item_local.url: #error en url?
|
||||
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
|
||||
if item.emergency_urls: #Hay urls de emergencia?
|
||||
item.item_local = item.emergency_urls[0][0] #Guardamos la url del .Torrent
|
||||
item.armagedon = True #Marcamos la situación como catastrófica
|
||||
itemlist.append(item.clone(action='', title=item.category + ': [COLOR hotpink]Usando enlaces de emergencia[/COLOR]'))
|
||||
|
||||
#logger.debug("Patron: " + patron + " url: " + item_local.url)
|
||||
#logger.debug(data)
|
||||
|
||||
#Si es un lookup para cargar las urls de emergencia en la Videoteca...
|
||||
if item.videolibray_emergency_urls:
|
||||
if item.channel_host: del item.channel_host
|
||||
item.emergency_urls = []
|
||||
url = item_local.url
|
||||
if url == 'javascript:;': #No hay torrent...
|
||||
url = '' #... ignorar
|
||||
item.emergency_urls.append([url])
|
||||
item.emergency_urls.append([item_local.url]) #Guardamos el enlace del .torrent
|
||||
#... si no, ejecutamos el proceso normal
|
||||
else:
|
||||
#Ahora pintamos el link del Torrent, si lo hay
|
||||
if item_local.url: # Hay Torrent ?
|
||||
if item_local.url: # Hay Torrent ?
|
||||
if size:
|
||||
quality = '%s [%s]' % (item_local.quality, size) #Agregamos size al final del título
|
||||
else:
|
||||
@@ -1529,9 +1546,12 @@ def findvideos(item):
|
||||
if not item.armagedon: #Si es un proceso normal, seguimos
|
||||
enlaces_ver = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
if not enlaces_ver and item.emergency_urls[1]: #Si no hay enlaces, hay urls de emergencia?
|
||||
enlaces_ver = item.emergency_urls[1] #Guardamos los datos iniciales de los Servidores Directos
|
||||
item.armagedon = True #Activamos el modo catástrofe
|
||||
if not enlaces_ver: #Si no hay enlaces, hay urls de emergencia?
|
||||
try:
|
||||
enlaces_ver = item.emergency_urls[1] #Guardamos los datos iniciales de los Servidores Directos
|
||||
item.armagedon = True #Activamos el modo catástrofe
|
||||
except:
|
||||
pass
|
||||
|
||||
enlaces_descargar = enlaces_ver
|
||||
#logger.debug(enlaces_ver)
|
||||
|
||||
@@ -45,7 +45,7 @@ thumbletras = {'#': 'https://s32.postimg.cc/drojt686d/image.png',
|
||||
audio = {'Latino': '[COLOR limegreen]LATINO[/COLOR]', 'Español': '[COLOR yellow]ESPAÑOL[/COLOR]',
|
||||
'Sub Español': '[COLOR red]SUB ESPAÑOL[/COLOR]'}
|
||||
|
||||
host = 'http://pelisgratis.tv/'
|
||||
host = 'http://pelisgratis.me/'
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
@@ -187,9 +187,9 @@ def findvideos(item):
|
||||
itemlist = []
|
||||
|
||||
data = get_source(item.url)
|
||||
patron = '<div class=TPlayerTb.Current id=(.*?)>.*?src=(.*?) frameborder'
|
||||
data = data.replace("<","<").replace(""",'"').replace(">",">").replace("&","&").replace('\"',"")
|
||||
patron = '<div class=TPlayerTb.*?id=(.*?)>.*?src=(.*?) frameborder'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
base_link = 'https://repros.live/player/ajaxdata'
|
||||
for opt, urls_page in matches:
|
||||
language = scrapertools.find_single_match (data,'TPlayerNv>.*?tplayernv=%s><span>Opción.*?<span>(.*?)</span>' % opt)
|
||||
headers = {'referer':item.url}
|
||||
@@ -197,18 +197,11 @@ def findvideos(item):
|
||||
urls_page = scrapertools.decodeHtmlentities(urls_page)
|
||||
sub_data=httptools.downloadpage(urls_page).data
|
||||
urls_page = scrapertools.find_single_match(sub_data, 'src="(.*?)" ')
|
||||
video_data = httptools.downloadpage(urls_page, headers=headers).data
|
||||
servers = scrapertools.find_multiple_matches(video_data,'data-player="(.*?)" data-embed="(.*?)">')
|
||||
for server, code in servers:
|
||||
post = {'codigo':code}
|
||||
post = urllib.urlencode(post)
|
||||
video_json=jsontools.load(httptools.downloadpage('https://repros.live/player/ajaxdata', post=post).data)
|
||||
url = video_json['url']
|
||||
itemlist.append(item.clone(title='[%s][%s]',
|
||||
url=url,
|
||||
action='play',
|
||||
language=language,
|
||||
))
|
||||
itemlist.append(item.clone(title='[%s][%s]',
|
||||
url=urls_page,
|
||||
action='play',
|
||||
language=language,
|
||||
))
|
||||
itemlist = servertools.get_servers_itemlist(itemlist, lambda x: x.title % (x.server.capitalize(), x.language))
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -450,7 +450,7 @@ def findvideos(item):
|
||||
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]:
|
||||
if cal in parms:
|
||||
url_v = 'https://pelispedia.video/v.php?id=%s&sub=%s&active=%s' % (parms[cal], parms['sub'], cal)
|
||||
title = "Ver video en [HTML5 " + cal + "p]"
|
||||
new_item = item.clone(title=title, url=url_v, action="play", referer=item.url)
|
||||
@@ -505,7 +505,8 @@ def play(item):
|
||||
|
||||
elif item.url.startswith("https://load.pelispedia.vip/embed/"):
|
||||
# 1- Descargar
|
||||
data, ck = gktools.get_data_and_cookie(item)
|
||||
# ~ data, ck = gktools.get_data_and_cookie(item)
|
||||
data, ck_sucuri, ck_cfduid = obtener_data_cookies(item.url, item.referer)
|
||||
|
||||
# 2- Calcular datos
|
||||
gsv = scrapertools.find_single_match(data, '<meta name="google-site-verification" content="([^"]*)"')
|
||||
@@ -519,7 +520,8 @@ def play(item):
|
||||
url = item.url.replace('/embed/', '/stream/') + '/' + token
|
||||
|
||||
# 3- Descargar página
|
||||
data = gktools.get_data_with_cookie(url, ck, item.url)
|
||||
# ~ data = gktools.get_data_with_cookie(url, ck, item.url)
|
||||
data, ck_sucuri, ck_cfduid = obtener_data_cookies(url, item.url, ck_sucuri, ck_cfduid)
|
||||
|
||||
# 4- Extraer enlaces
|
||||
url = scrapertools.find_single_match(data, '<meta (?:name|property)="og:url" content="([^"]+)"')
|
||||
@@ -556,6 +558,39 @@ def obtener_data(url, referer=''):
|
||||
|
||||
return data
|
||||
|
||||
def obtener_data_cookies(url, referer='', ck_sucuri = '', ck_cfduid = ''):
|
||||
|
||||
headers = {}
|
||||
if referer != '': headers['Referer'] = referer
|
||||
if ck_sucuri != '' and ck_cfduid != '': headers['Cookie'] = ck_sucuri + '; __cfduid=' + ck_cfduid
|
||||
elif ck_sucuri != '': headers['Cookie'] = ck_sucuri
|
||||
elif ck_cfduid != '': headers['Cookie'] = '__cfduid=%s' % ck_cfduid
|
||||
|
||||
resp = httptools.downloadpage(url, headers=headers, cookies=False)
|
||||
if ck_cfduid == '': ck_cfduid = obtener_cfduid(resp.headers)
|
||||
|
||||
if "Javascript is required" in resp.data:
|
||||
ck_sucuri = decodificar_cookie(resp.data)
|
||||
logger.info("Javascript is required. Cookie necesaria %s" % ck_sucuri)
|
||||
|
||||
headers['Cookie'] = ck_sucuri
|
||||
if ck_cfduid != '': headers['Cookie'] += '; __cfduid=%s' % ck_cfduid
|
||||
|
||||
resp = httptools.downloadpage(url, headers=headers, cookies=False)
|
||||
if ck_cfduid == '': ck_cfduid = obtener_cfduid(resp.headers)
|
||||
|
||||
return resp.data, ck_sucuri, ck_cfduid
|
||||
|
||||
def obtener_cfduid(headers):
|
||||
ck_name = '__cfduid'
|
||||
ck_value = ''
|
||||
for h in headers:
|
||||
ck = scrapertools.find_single_match(headers[h], '%s=([^;]*)' % ck_name)
|
||||
if ck:
|
||||
ck_value = ck
|
||||
break
|
||||
return ck_value
|
||||
|
||||
|
||||
def rshift(val, n): return val>>n if val >= 0 else (val+0x100000000)>>n
|
||||
|
||||
|
||||
@@ -111,12 +111,22 @@ def search_section(item, data, sectionType):
|
||||
|
||||
itemlist = []
|
||||
for url, thumbnail, title in sectionResultsRE:
|
||||
filtro_list = {"poster_path": scrapertools.find_single_match(thumbnail, "w\w+(/\w+.....)")}
|
||||
|
||||
newitem = item.clone(action = "seasons" if sectionType == "series" else "findvideos",
|
||||
title = title,
|
||||
thumbnail = thumbnail,
|
||||
url = url)
|
||||
if sectionType == "series":
|
||||
newitem.show = title;
|
||||
url = url,
|
||||
infoLabels = {'filtro': filtro_list.items(), 'year': '-'})
|
||||
|
||||
if sectionType == 'series':
|
||||
newitem.show = title
|
||||
newitem.contentType = 'tvshow'
|
||||
newitem.contentSerieName = title
|
||||
else:
|
||||
newitem.contentType = 'movie'
|
||||
newitem.contentTitle = title
|
||||
|
||||
itemlist.append(newitem)
|
||||
|
||||
return itemlist
|
||||
|
||||
@@ -239,7 +239,6 @@ def findvideos(item):
|
||||
|
||||
itemlist = []
|
||||
data = get_source(item.url)
|
||||
|
||||
selector_url = scrapertools.find_multiple_matches(data, 'class=metaframe rptss src=(.*?) frameborder=0 ')
|
||||
|
||||
for lang in selector_url:
|
||||
@@ -259,13 +258,12 @@ def findvideos(item):
|
||||
if language == 'VOSE':
|
||||
sub = scrapertools.find_single_match(url, 'sub=(.*?)&')
|
||||
subs = 'https:%s' % sub
|
||||
|
||||
if 'index' in url:
|
||||
try:
|
||||
file_id = scrapertools.find_single_match(url, 'file=(.*?)&')
|
||||
post = {'link': file_id}
|
||||
post = urllib.urlencode(post)
|
||||
hidden_url = 'https://streamango.poseidonhd.net/repro/plugins/gkpluginsphp.php'
|
||||
hidden_url = 'https://streamango.poseidonhd.io/repro/plugins/gkpluginsphp.php'
|
||||
data_url = httptools.downloadpage(hidden_url, post=post).data
|
||||
dict_vip_url = jsontools.load(data_url)
|
||||
url = dict_vip_url['link']
|
||||
@@ -278,15 +276,16 @@ def findvideos(item):
|
||||
file_id = scrapertools.find_single_match(url, 'h=(\w+)')
|
||||
post = {'h': file_id}
|
||||
post = urllib.urlencode(post)
|
||||
hidden_url = 'https://streamango.poseidonhd.net/repro/openload/api.php'
|
||||
hidden_url = 'https://streamango.poseidonhd.io/repro/openload/api.php'
|
||||
data_url = httptools.downloadpage(hidden_url, post=post, follow_redirects=False).data
|
||||
json_data = jsontools.load(data_url)
|
||||
url = json_data['url']
|
||||
else:
|
||||
file_id = scrapertools.find_single_match(url, 'url=(.*?)&')
|
||||
new_data = httptools.downloadpage('https:'+url).data
|
||||
file_id = scrapertools.find_single_match(new_data, 'value="([^"]+)"')
|
||||
post = {'url': file_id}
|
||||
post = urllib.urlencode(post)
|
||||
hidden_url = 'https://streamango.poseidonhd.net/repro/r.php'
|
||||
hidden_url = 'https://streamango.poseidonhd.io/repro/r.php'
|
||||
data_url = httptools.downloadpage(hidden_url, post=post, follow_redirects=False)
|
||||
url = data_url.headers['location']
|
||||
except:
|
||||
|
||||
@@ -83,6 +83,7 @@ def sub_search(item):
|
||||
data = httptools.downloadpage(item.url + "&_token=" + token, headers=headers).data
|
||||
data_js = jsontools.load(data)["data"]["m"]
|
||||
for js in data_js:
|
||||
js["title"] = quitano(js["title"])
|
||||
itemlist.append(Item(channel = item.channel,
|
||||
action = "findvideos",
|
||||
contentTitle = js["title"],
|
||||
@@ -113,6 +114,7 @@ def peliculas_gen(item):
|
||||
patron += '<p>([^<]+)'
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for scrapedurl, scrapedthumbnail, scrapedyear, scrapedtitle in matches:
|
||||
scrapedtitle = quitano(scrapedtitle)
|
||||
itemlist.append(Item(channel = item.channel,
|
||||
action = "findvideos",
|
||||
contentTitle = scrapedtitle,
|
||||
@@ -136,6 +138,7 @@ def estrenos(item):
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for scrapedurl, scrapedthumbnail, scrapedyear, scrapedtitle in matches:
|
||||
scrapedtitle = scrapedtitle.replace("Película ","")
|
||||
scrapedtitle = quitano(scrapedtitle)
|
||||
itemlist.append(Item(channel = item.channel,
|
||||
action = "findvideos",
|
||||
contentTitle = scrapedtitle,
|
||||
@@ -166,6 +169,7 @@ def peliculas(item):
|
||||
patron += '<p>([^<]+)'
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for scrapedurl, scrapedthumbnail, scrapedyear, scrapedtitle in matches:
|
||||
scrapedtitle = quitano(scrapedtitle)
|
||||
itemlist.append(Item(channel = item.channel,
|
||||
action = "findvideos",
|
||||
contentTitle = scrapedtitle,
|
||||
@@ -301,3 +305,9 @@ def play(item):
|
||||
itemlist = servertools.get_servers_itemlist(itemlist)
|
||||
item.thumbnail = item.contentThumbnail
|
||||
return itemlist
|
||||
|
||||
|
||||
def quitano(title):
|
||||
# Quita el año que muestran en el título en la página, para que funcione bien tmdb
|
||||
t = title.replace(scrapertools.find_single_match(title, '\(\s*\d{4}\)'),"")
|
||||
return t.strip()
|
||||
|
||||
@@ -1,323 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- Channel SeriesBlanco.xyz -*-
|
||||
# -*- Created for Alfa-addon -*-
|
||||
# -*- By the Alfa Develop Group -*-
|
||||
|
||||
import re
|
||||
|
||||
from channels import autoplay
|
||||
from channels import filtertools
|
||||
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://seriesblanco.xyz/'
|
||||
|
||||
IDIOMAS = {'Esp':'Cast', 'es': 'Cast', 'la': 'Lat', 'Latino':'Lat', 'vos': 'VOSE', 'vo': 'VO'}
|
||||
list_language = IDIOMAS.values()
|
||||
list_quality = ['SD', 'Micro-HD-720p', '720p', 'HDitunes', 'Micro-HD-1080p' ]
|
||||
list_servers = ['powvideo','yourupload', 'openload', 'gamovideo', 'flashx', 'clipwatching', 'streamango', 'streamcloud']
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
|
||||
autoplay.init(item.channel, list_servers, list_quality)
|
||||
|
||||
itemlist = []
|
||||
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
title="Nuevos Capitulos",
|
||||
action="new_episodes",
|
||||
thumbnail=get_thumb('new_episodes', auto=True),
|
||||
url=host))
|
||||
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
title="Todas",
|
||||
action="list_all",
|
||||
thumbnail=get_thumb('all', auto=True),
|
||||
url=host + 'listado/',
|
||||
))
|
||||
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
title="Generos",
|
||||
action="section",
|
||||
thumbnail=get_thumb('genres', auto=True),
|
||||
url=host,
|
||||
))
|
||||
|
||||
# itemlist.append(Item(channel=item.channel,
|
||||
# title="A - Z",
|
||||
# action="section",
|
||||
# thumbnail=get_thumb('alphabet', auto=True),
|
||||
# url=host+'listado/', ))
|
||||
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
title="Buscar",
|
||||
action="search",
|
||||
thumbnail=get_thumb('search', auto=True)))
|
||||
|
||||
itemlist = filtertools.show_option(itemlist, item.channel, list_language, list_quality)
|
||||
autoplay.show_option(item.channel, itemlist)
|
||||
|
||||
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 list_all(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
data = get_source(item.url)
|
||||
data = data.replace ("'", '"')
|
||||
patron = '<li><div style=.*?><a href="([^"]+)"><img.*?src="([^"]+)" title="([^"]+)"'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedurl, scrapedthumbnail, scrapedtitle in matches:
|
||||
scrapedtitle = scrapedtitle.strip()
|
||||
url = host + scrapedurl
|
||||
thumbnail = scrapedthumbnail
|
||||
title = scrapertools.decodeHtmlentities(scrapedtitle)
|
||||
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
action='seasons',
|
||||
title=title,
|
||||
url=url,
|
||||
thumbnail=thumbnail,
|
||||
contentSerieName=scrapedtitle,
|
||||
context=filtertools.context(item, list_language, list_quality),
|
||||
))
|
||||
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
|
||||
# #Paginacion
|
||||
|
||||
if itemlist != []:
|
||||
base_page = scrapertools.find_single_match(item.url,'(.*?)?')
|
||||
next_page = scrapertools.find_single_match(data, '</span><a href=?pagina=2>>></a>')
|
||||
if next_page != '':
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
action="lista",
|
||||
title='Siguiente >>>',
|
||||
url=base_page+next_page,
|
||||
thumbnail='https://s16.postimg.cc/9okdu7hhx/siguiente.png',
|
||||
))
|
||||
return itemlist
|
||||
|
||||
|
||||
def section(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
data = get_source(item.url)
|
||||
if item.title == 'Generos':
|
||||
patron = '<li><a href="([^"]+)"><i class="fa fa-bookmark-o"></i> (.*?)</a></li>'
|
||||
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
|
||||
if item.title == 'Generos':
|
||||
url = host + scrapedurl
|
||||
|
||||
title = scrapedtitle
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
action='list_all',
|
||||
title=title,
|
||||
url=url
|
||||
))
|
||||
return itemlist
|
||||
|
||||
def seasons(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
data = get_source(item.url)
|
||||
patron = "<p class='panel-primary btn-primary'> Temporada (\d+)</p>"
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
infoLabels=item.infoLabels
|
||||
id = scrapertools.find_single_match(data, "onclick='loadSeason\((\d+),\d+\);")
|
||||
for scrapedseason in matches:
|
||||
url = item.url
|
||||
title = 'Temporada %s' % scrapedseason
|
||||
contentSeasonNumber = scrapedseason
|
||||
infoLabels['season'] = contentSeasonNumber
|
||||
thumbnail = item.thumbnail
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
action="episodesxseason",
|
||||
title=title,
|
||||
url=url,
|
||||
thumbnail=thumbnail,
|
||||
id=id,
|
||||
contentSeasonNumber=contentSeasonNumber,
|
||||
infoLabels=infoLabels
|
||||
))
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
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 episodios(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
templist = seasons(item)
|
||||
for tempitem in templist:
|
||||
itemlist += episodesxseason(tempitem)
|
||||
return itemlist
|
||||
|
||||
|
||||
def episodesxseason(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
season = item.contentSeasonNumber
|
||||
season_url = '%sajax/visto3.php?season_id=%s&season_number=%s' % (host, item.id, season)
|
||||
data = get_source(season_url)
|
||||
patron = "<a href='([^ ]+)'.*?>.*?\d+x(\d+).*?-([^<]+)<.*?(/banderas.*?)</td>"
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
infoLabels = item.infoLabels
|
||||
for scrapedurl, scraped_episode, scrapedtitle, lang_data in matches:
|
||||
url = host + scrapedurl
|
||||
title = '%sx%s - %s' % (season, scraped_episode, scrapedtitle.strip())
|
||||
infoLabels['episode'] = scraped_episode
|
||||
thumbnail = item.thumbnail
|
||||
title, language = add_language(title, lang_data)
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
action="findvideos",
|
||||
title=title,
|
||||
url=url,
|
||||
thumbnail=thumbnail,
|
||||
language=language,
|
||||
infoLabels=infoLabels
|
||||
))
|
||||
itemlist = filtertools.get_links(itemlist, item, list_language)
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
return itemlist
|
||||
|
||||
def new_episodes(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
data = get_source(item.url)
|
||||
data = data.replace("'", '"')
|
||||
data = scrapertools.find_single_match(data,
|
||||
'<center>Series Online : Capítulos estrenados recientemente</center>.*?</ul>')
|
||||
patron = '<li><h6.*?src="([^"]+)".*?aalt="([^"]+)".*?href="([^"]+)">.*?src="([^"]+)"'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for lang_data, scrapedtitle, scrapedurl, scrapedthumbnail in matches:
|
||||
|
||||
url =host+scrapedurl
|
||||
thumbnail = scrapedthumbnail
|
||||
season_episode = scrapertools.find_single_match(scrapedtitle, '.*? (\d+x\d+) ')
|
||||
scrapedtitle= scrapertools.find_single_match(scrapedtitle, '(.*?) \d+x')
|
||||
title = '%s - %s' % (scrapedtitle, season_episode )
|
||||
title, language = add_language(title, lang_data)
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
action='findvideos',
|
||||
title=title,
|
||||
url=url,
|
||||
thumbnail=thumbnail,
|
||||
language=language,
|
||||
))
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
|
||||
return itemlist
|
||||
|
||||
def add_language(title, string):
|
||||
logger.info()
|
||||
|
||||
languages = scrapertools.find_multiple_matches(string, '/banderas/(.*?).png')
|
||||
|
||||
language = []
|
||||
for lang in languages:
|
||||
|
||||
if 'jap' in lang or lang not in IDIOMAS:
|
||||
lang = 'vos'
|
||||
|
||||
if len(languages) == 1:
|
||||
language = IDIOMAS[lang]
|
||||
title = '%s [%s]' % (title, language)
|
||||
else:
|
||||
language.append(IDIOMAS[lang])
|
||||
title = '%s [%s]' % (title, IDIOMAS[lang])
|
||||
|
||||
return title, language
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
|
||||
data = get_source(item.url)
|
||||
data = data.replace ("'", '"')
|
||||
patron = '<a href=([^ ]+) target="_blank"><img src="/servidores/(.*?).(?:png|jpg)".*?sno.*?'
|
||||
patron += '<span>(.*?)<.*?(/banderas.*?)td'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
|
||||
for scrapedurl, server, quality, lang_data in matches:
|
||||
|
||||
title = server.capitalize()
|
||||
if quality == '':
|
||||
quality = 'SD'
|
||||
title = '%s [%s]' % (title, quality)
|
||||
title, language = add_language(title, lang_data)
|
||||
thumbnail = item.thumbnail
|
||||
|
||||
enlace_id, serie_id, se, ep = scrapertools.find_single_match(scrapedurl,'enlace(\d+)/(\d+)/(\d+)/(\d+)/')
|
||||
|
||||
url = host + 'ajax/load_enlace.php?serie=%s&temp=%s&cap=%s&id=%s' % (serie_id, se, ep, enlace_id)
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
title=title,
|
||||
url=url,
|
||||
action="play",
|
||||
thumbnail=thumbnail,
|
||||
server=server,
|
||||
quality=quality,
|
||||
language=language,
|
||||
infoLabels=item.infoLabels
|
||||
))
|
||||
# Requerido para FilterTools
|
||||
|
||||
itemlist = filtertools.get_links(itemlist, item, list_language)
|
||||
|
||||
# Requerido para AutoPlay
|
||||
|
||||
autoplay.start(itemlist, item)
|
||||
|
||||
return sorted(itemlist, key=lambda it: it.language)
|
||||
|
||||
|
||||
def play(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
data = httptools.downloadpage(item.url).data
|
||||
itemlist = servertools.find_video_items(data=data)
|
||||
for videoitem in itemlist:
|
||||
videoitem.infoLabels = item.infoLabels
|
||||
|
||||
return itemlist
|
||||
|
||||
def search(item, texto):
|
||||
logger.info()
|
||||
if texto != '':
|
||||
item.url = host + 'search.php?q1=%s' % texto
|
||||
return list_all(item)
|
||||
@@ -147,25 +147,24 @@ def findvideos(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
data = httptools.downloadpage(item.url).data
|
||||
|
||||
_sa = scrapertools.find_single_match(data, 'var _sa = (true|false);')
|
||||
_sl = scrapertools.find_single_match(data, 'var _sl = ([^;]+);')
|
||||
sl = eval(_sl)
|
||||
#buttons = scrapertools.find_multiple_matches(data, '<button href="" class="selop" sl="([^"]+)">([^<]+)</button>')
|
||||
|
||||
buttons = scrapertools.find_multiple_matches(data, '<button href="" class="selop" sl="([^"]+)">([^<]+)</button>')
|
||||
for id, title in buttons:
|
||||
new_url = golink(int(id), _sa, sl)
|
||||
data = httptools.downloadpage(new_url).data
|
||||
_x0x = scrapertools.find_single_match(data, 'var x0x = ([^;]+);')
|
||||
x0x = eval(_x0x)
|
||||
#for id, title in buttons:
|
||||
new_url = golink(0, _sa, sl)
|
||||
data = httptools.downloadpage(new_url).data
|
||||
_x0x = scrapertools.find_single_match(data, 'var x0x = ([^;]+);')
|
||||
x0x = eval(_x0x)
|
||||
|
||||
url = resolve(x0x[4], base64.b64decode(x0x[1]))
|
||||
if 'download' in url:
|
||||
url = url.replace('download', 'preview')
|
||||
title = '%s'
|
||||
url = resolve(x0x[4], base64.b64decode(x0x[1]))
|
||||
if 'download' in url:
|
||||
url = url.replace('download', 'preview')
|
||||
title = '%s'
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title=title, url=url, action='play', language='latino',
|
||||
infoLabels=item.infoLabels))
|
||||
itemlist.append(Item(channel=item.channel, title=title, url=url, action='play', language='latino',
|
||||
infoLabels=item.infoLabels))
|
||||
itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server.capitalize())
|
||||
|
||||
# Requerido para FilterTools
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"id": "seriesblancoxyz",
|
||||
"name": "SeriesBlanco.xyz",
|
||||
"id": "seriesmetro",
|
||||
"name": "SeriesMetro",
|
||||
"active": true,
|
||||
"adult": false,
|
||||
"language": ["cast", "lat"],
|
||||
"thumbnail": "https://s22.postimg.cc/nucz720sx/image.png",
|
||||
"language": ["lat", "cast"],
|
||||
"thumbnail": "https://i.postimg.cc/Kzh6DCqD/seriesmetro.png",
|
||||
"banner": "",
|
||||
"categories": [
|
||||
"tvshow",
|
||||
@@ -27,12 +27,17 @@
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": [
|
||||
"No filtrar",
|
||||
"Cast",
|
||||
"Lat",
|
||||
"VOSE",
|
||||
"VO"
|
||||
"No filtrar"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "comprueba_enlaces_num",
|
||||
"type": "list",
|
||||
"label": "Número de enlaces a verificar",
|
||||
"default": 1,
|
||||
"enabled": true,
|
||||
"visible": "eq(-1,true)",
|
||||
"lvalues": [ "5", "10", "15", "20" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
224
plugin.video.alfa/channels/seriesmetro.py
Normal file
224
plugin.video.alfa/channels/seriesmetro.py
Normal file
@@ -0,0 +1,224 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- Channel SeriesMetro -*-
|
||||
# -*- Created for Alfa-addon -*-
|
||||
# -*- By the Alfa Develop Group -*-
|
||||
|
||||
import re
|
||||
|
||||
from channels import autoplay
|
||||
from channels import filtertools
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from core import servertools
|
||||
from core import jsontools
|
||||
from core import tmdb
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
from channelselector import get_thumb
|
||||
|
||||
host = 'https://seriesmetro.com/'
|
||||
|
||||
list_language = []
|
||||
list_quality = []
|
||||
list_servers = ['openload', 'dailymotion']
|
||||
|
||||
__comprueba_enlaces__ = config.get_setting('comprueba_enlaces', 'seriesmetro')
|
||||
__comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', 'seriesmetro')
|
||||
|
||||
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 mainlist(item):
|
||||
logger.info()
|
||||
|
||||
autoplay.init(item.channel, list_servers, list_quality)
|
||||
|
||||
itemlist =[]
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title="Todas", action="list_all", url=host,
|
||||
thumbnail=get_thumb('all', auto=True)))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title="Generos", action="section",
|
||||
thumbnail=get_thumb('genres', auto=True)))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title="Alfabetico", action="section",
|
||||
thumbnail=get_thumb('alphabet', auto=True)))
|
||||
|
||||
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)
|
||||
return itemlist
|
||||
|
||||
def list_all(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
|
||||
data = get_source(item.url)
|
||||
patron = '<div class="post-thumbnail"><a href="([^"]+)" title="([^"]+)">.*?data-src="([^"]+)"'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedurl, scrapedtitle, scrapedthumbnail in matches:
|
||||
url = scrapedurl
|
||||
|
||||
contentSerieName = scrapedtitle
|
||||
action = 'seasons'
|
||||
|
||||
thumbnail = scrapedthumbnail
|
||||
new_item = Item(channel=item.channel, title=scrapedtitle, url=url, thumbnail=thumbnail,
|
||||
contentSerieName=contentSerieName, action=action)
|
||||
|
||||
itemlist.append(new_item)
|
||||
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
|
||||
# Paginacion
|
||||
next_page = scrapertools.find_single_match(data, '<a href="([^"]+)" >Página siguiente')
|
||||
if next_page != '':
|
||||
itemlist.append(Item(channel=item.channel, action="list_all", title='Siguiente >>>',
|
||||
url=next_page, thumbnail='https://s16.postimg.cc/9okdu7hhx/siguiente.png',
|
||||
type=item.type))
|
||||
return itemlist
|
||||
|
||||
|
||||
def section(item):
|
||||
|
||||
itemlist = []
|
||||
|
||||
full_data = get_source(host)
|
||||
|
||||
if item.title == 'Generos':
|
||||
data = scrapertools.find_single_match(full_data, '>Géneros</a>(.*?)</ul>')
|
||||
elif item.title == 'Alfabetico':
|
||||
data = scrapertools.find_single_match(full_data, '<ul id="menu-top"(.*?)</ul>')
|
||||
|
||||
patron = '<a href="([^"]+)">([^<]+)</a>'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
|
||||
if scrapedtitle != 'Series':
|
||||
itemlist.append(Item(channel=item.channel, title=scrapedtitle, url=scrapedurl, action='list_all'))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def seasons(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
data = get_source(item.url)
|
||||
|
||||
patron = 'Temporada (\d+)'
|
||||
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
infoLabels = item.infoLabels
|
||||
if len(matches) > 0:
|
||||
for scrapedseason in matches:
|
||||
title = 'Temporada %s' % scrapedseason
|
||||
infoLabels['season'] = scrapedseason
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action='episodesxseason', url=item.url, title=title,
|
||||
infoLabels=infoLabels))
|
||||
else:
|
||||
infoLabels['season'] = '1'
|
||||
itemlist.append(Item(channel=item.channel, action='episodesxseason', url=item.url, title='Temporada 1',
|
||||
infoLabels=infoLabels, single=True))
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
|
||||
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,
|
||||
extra1='library'))
|
||||
|
||||
return itemlist
|
||||
|
||||
def episodios(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
templist = seasons(item)
|
||||
for tempitem in templist:
|
||||
itemlist += episodesxseason(tempitem)
|
||||
return itemlist
|
||||
|
||||
def episodesxseason(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
season = item.infoLabels['season']
|
||||
full_data = get_source(item.url)
|
||||
|
||||
if item.single:
|
||||
data = scrapertools.find_single_match(full_data, '<strong>Capítulos.*?</strong>(.*?)</ul>')
|
||||
else:
|
||||
data = scrapertools.find_single_match(full_data, 'Temporada %s.*?</strong>(.*?)</ul>' % season)
|
||||
patron = '<a href="([^"]+)">.*?;.?([^<]+)</a>'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
infoLabels = item.infoLabels
|
||||
epi = 1
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
url = scrapedurl
|
||||
contentEpisodeNumber = str(epi)
|
||||
title = '%sx%s - %s ' % (season, contentEpisodeNumber, scrapedtitle)
|
||||
infoLabels['episode'] = contentEpisodeNumber
|
||||
itemlist.append(Item(channel=item.channel, action="findvideos", title=title, url=url,
|
||||
contentSerieName=item.contentSerieName, contentEpisodeNumber=contentEpisodeNumber,
|
||||
infoLabels=infoLabels))
|
||||
epi += 1
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
return itemlist
|
||||
|
||||
def search(item, text):
|
||||
logger.info()
|
||||
|
||||
item.url = item.url + text
|
||||
if text != '':
|
||||
return list_all(item)
|
||||
|
||||
def findvideos(item):
|
||||
|
||||
itemlist = []
|
||||
data = get_source(item.url)
|
||||
patron = 'iframe src="([^&]+)&'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for link in matches:
|
||||
if 'id=' in link:
|
||||
id_type = 'id'
|
||||
ir_type = 'ir'
|
||||
elif 'ud=' in link:
|
||||
id_type = 'ud'
|
||||
ir_type = 'ur'
|
||||
id = scrapertools.find_single_match(link, '%s=(.*)' % id_type)
|
||||
base_link = scrapertools.find_single_match(link, '(.*?)%s=' % id_type)
|
||||
|
||||
ir = id[::-1]
|
||||
referer = base_link+'%s=%s&/' % (id_type, ir)
|
||||
video_data = httptools.downloadpage('%s%s=%s' % (base_link, ir_type, ir), headers={'Referer':referer},
|
||||
follow_redirects=False)
|
||||
url = video_data.headers['location']
|
||||
title = '%s'
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title=title, url=url, action='play',
|
||||
language='', infoLabels=item.infoLabels))
|
||||
|
||||
itemlist = servertools.get_servers_itemlist(itemlist, lambda x: x.title % x.server.capitalize())
|
||||
|
||||
# Requerido para FilterTools
|
||||
|
||||
itemlist = filtertools.get_links(itemlist, item, list_language)
|
||||
|
||||
# Requerido para AutoPlay
|
||||
|
||||
autoplay.start(itemlist, item)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from core import tmdb
|
||||
from core.item import Item
|
||||
from platformcode import logger
|
||||
|
||||
host = 'http://www.sipeliculas.com'
|
||||
host = 'http://www.siestrenos.com'
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
|
||||
@@ -141,8 +141,15 @@ def findvideos(item):
|
||||
hidden_url = get_source('%splayer/rep/%s' % (host, scraped_id), player)
|
||||
url = scrapertools.find_single_match(hidden_url, 'iframe src=.?"([^"]+)"').replace('\\','')
|
||||
lang = get_language(lang_data)
|
||||
itemlist.append(Item(channel=item.channel, title='%s', url=url, action='play', language=lang,
|
||||
infoLabels=item.infoLabels))
|
||||
|
||||
if not config.get_setting('unify'):
|
||||
title = ' %s' % lang
|
||||
else:
|
||||
title = ''
|
||||
|
||||
if url != '':
|
||||
itemlist.append(Item(channel=item.channel, title='%s'+title, url=url, action='play', language=lang,
|
||||
infoLabels=item.infoLabels))
|
||||
|
||||
itemlist = servertools.get_servers_itemlist(itemlist, lambda x: x.title % x.server.capitalize())
|
||||
|
||||
|
||||
@@ -55,8 +55,11 @@ def list_movies(item, silent=False):
|
||||
new_item.path = raiz
|
||||
new_item.thumbnail = new_item.contentThumbnail
|
||||
new_item.text_color = "blue"
|
||||
strm_path = new_item.strm_path.replace("\\", "/").rstrip("/")
|
||||
if '/' in new_item.path:
|
||||
new_item.strm_path = strm_path
|
||||
|
||||
if not filetools.exists(filetools.join(new_item.path, filetools.basename(new_item.strm_path))):
|
||||
if not filetools.exists(filetools.join(new_item.path, filetools.basename(strm_path))):
|
||||
# Si se ha eliminado el strm desde la bilbioteca de kodi, no mostrarlo
|
||||
continue
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ from platformcode import config, logger, platformtools
|
||||
|
||||
|
||||
idio = {'https://cdn.yape.nu//languajes/la.png': 'LAT','https://cdn.yape.nu//languajes/es.png': 'ESP','https://cdn.yape.nu//languajes/en_es.png': 'VOSE'}
|
||||
cali = {'TS Screnner': 'TS Screnner', 'HD 1080p': 'HD 1080p','TS Screener HQ':'TS Screener HQ', 'BR Screnner':'BR Screnner','HD Rip':'HD Rip','DVD Screnner':'DVD Screnner'}
|
||||
cali = {'TS Screnner': 'TS Screnner', 'HD 1080p': 'HD 1080p','TS Screener HQ':'TS Screener HQ', 'BR Screnner':'BR Screnner','HD Rip':'HD Rip','DVD Screnner':'DVD Screnner', 'DVD Rip':'DVD Rip'}
|
||||
|
||||
list_language = idio.values()
|
||||
list_quality = cali.values()
|
||||
|
||||
@@ -187,7 +187,7 @@ def save_movie(item):
|
||||
try:
|
||||
channel = generictools.verify_channel(item.channel)
|
||||
if config.get_setting("emergency_urls", channel) in [1, 3]:
|
||||
item = emergency_urls(item)
|
||||
item = emergency_urls(item, None, json_path)
|
||||
if item_nfo.emergency_urls and not isinstance(item_nfo.emergency_urls, dict):
|
||||
del item_nfo.emergency_urls
|
||||
if not item_nfo.emergency_urls:
|
||||
@@ -396,6 +396,10 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True):
|
||||
emergency_urls_stat = config.get_setting("emergency_urls", channel_alt) #El canal quiere urls de emergencia?
|
||||
emergency_urls_succ = False
|
||||
channel = __import__('channels.%s' % channel_alt, fromlist=["channels.%s" % channel_alt])
|
||||
if serie.torrent_caching_fail: #Si el proceso de conversión ha fallado, no se cachean
|
||||
emergency_urls_stat = 0
|
||||
del serie.torrent_caching_fail
|
||||
|
||||
new_episodelist = []
|
||||
# Obtenemos el numero de temporada y episodio y descartamos los q no lo sean
|
||||
tags = []
|
||||
@@ -410,24 +414,24 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True):
|
||||
|
||||
# Si se ha marcado la opción de url de emergencia, se añade ésta a cada episodio después de haber ejecutado Findvideos del canal
|
||||
if e.emergency_urls and isinstance(e.emergency_urls, dict): del e.emergency_urls #Borramos trazas anterioires
|
||||
json_path = filetools.join(path, ("%s [%s].json" % (season_episode, e.channel)).lower()) #Path del .json del episodio
|
||||
if emergency_urls_stat == 1 and not e.emergency_urls and e.contentType == 'episode': #Guardamos urls de emergencia?
|
||||
json_path = filetools.join(path, ("%s [%s].json" % (season_episode, e.channel)).lower()) #Path del .json del episodio
|
||||
if json_path in ficheros: #Si existe el .json sacamos de ahí las urls
|
||||
if overwrite: #pero solo si se se sobrescriben los .json
|
||||
json_epi = Item().fromjson(filetools.read(json_path)) #Leemos el .json
|
||||
if json_epi.emergency_urls: #si existen las urls de emergencia...
|
||||
e.emergency_urls = json_epi.emergency_urls #... las copiamos
|
||||
else: #y si no...
|
||||
e = emergency_urls(e, channel) #... las generamos
|
||||
e = emergency_urls(e, channel, json_path) #... las generamos
|
||||
else:
|
||||
e = emergency_urls(e, channel) #Si el episodio no existe, generamos las urls
|
||||
e = emergency_urls(e, channel, json_path) #Si el episodio no existe, generamos las urls
|
||||
if e.emergency_urls: #Si ya tenemos urls...
|
||||
emergency_urls_succ = True #... es un éxito y vamos a marcar el .nfo
|
||||
elif emergency_urls_stat == 2 and e.contentType == 'episode': #Borramos urls de emergencia?
|
||||
if e.emergency_urls: del e.emergency_urls
|
||||
emergency_urls_succ = True #... es un éxito y vamos a marcar el .nfo
|
||||
elif emergency_urls_stat == 3 and e.contentType == 'episode': #Actualizamos urls de emergencia?
|
||||
e = emergency_urls(e, channel) #generamos las urls
|
||||
e = emergency_urls(e, channel, json_path) #generamos las urls
|
||||
if e.emergency_urls: #Si ya tenemos urls...
|
||||
emergency_urls_succ = True #... es un éxito y vamos a marcar el .nfo
|
||||
|
||||
@@ -711,22 +715,171 @@ def add_tvshow(item, channel=None):
|
||||
xbmc_videolibrary.sync_trakt_addon(path)
|
||||
|
||||
|
||||
def emergency_urls(item, channel=None):
|
||||
def emergency_urls(item, channel=None, path=None):
|
||||
logger.info()
|
||||
import re
|
||||
"""
|
||||
Llamamos a Findvideos del canal con la variable "item.videolibray_emergency_urls = True" para obtener la variable
|
||||
"item.matches" con la lista de listas de tuplas de los enlaces torrent y de servidores directos para ese episodio o película
|
||||
"item.emergency_urls" con la lista de listas de tuplas de los enlaces torrent y de servidores directos para ese episodio o película
|
||||
En la lista [0] siempre deben ir los enlaces torrents, si los hay. Si se desea cachear los .torrents, la búsqueda va contra esa lista.
|
||||
En la lista dos irán los enlaces de servidores directos, pero también pueden ir enlaces magnet (que no son cacheables)
|
||||
"""
|
||||
|
||||
#lanazamos un "lookup" en el "findvideos" del canal para obtener los enlaces de emergencia
|
||||
try:
|
||||
if channel == None:
|
||||
channel = generictools.verify_channel(item.channel)
|
||||
if channel == None: #Si el llamador no ha aportado la estructura de channel, se crea
|
||||
channel = generictools.verify_channel(item.channel) #Se verifica si es un clon, que devuelva "newpct1"
|
||||
channel = __import__('channels.%s' % channel, fromlist=["channels.%s" % channel])
|
||||
if hasattr(channel, 'findvideos'):
|
||||
item.videolibray_emergency_urls = True
|
||||
item_res = getattr(channel, 'findvideos')(item)
|
||||
del item_res.videolibray_emergency_urls
|
||||
if hasattr(channel, 'findvideos'): #Si el canal tiene "findvideos"...
|
||||
item.videolibray_emergency_urls = True #... se marca como "lookup"
|
||||
item_res = getattr(channel, 'findvideos')(item) #... se procesa
|
||||
del item_res.videolibray_emergency_urls #... y se borra la marca de lookup
|
||||
except:
|
||||
item_res = item.clone()
|
||||
logger.error('ERROR al procesar el episodio')
|
||||
item_res = item.clone() #Si ha habido un error, se devuelve el Item original
|
||||
|
||||
#Si el usuario ha activado la opción "emergency_urls_torrents", se descargarán los archivos .torrent de cada título
|
||||
else: #Si se han cacheado con éxito los enlaces...
|
||||
logger.debug('HOLA')
|
||||
logger.debug(item_res.emergency_urls)
|
||||
try:
|
||||
channel_bis = generictools.verify_channel(item.channel)
|
||||
if config.get_setting("emergency_urls_torrents", channel_bis) and item_res.emergency_urls and path != None:
|
||||
videolibrary_path = config.get_videolibrary_path() #detectamos el path absoluto del título
|
||||
movies = config.get_setting("folder_movies")
|
||||
series = config.get_setting("folder_tvshows")
|
||||
if movies in path:
|
||||
folder = movies
|
||||
else:
|
||||
folder = series
|
||||
videolibrary_path = filetools.join(videolibrary_path, folder)
|
||||
i = 1
|
||||
for url in item_res.emergency_urls[0]: #Recorremos las urls de emergencia...
|
||||
torrents_path = re.sub(r'(?:\.\w+$)', '_%s.torrent' % str(i).zfill(2), path)
|
||||
path_real = caching_torrents(url, torrents_path=torrents_path) #... para descargar los .torrents
|
||||
if path_real: #Si ha tenido éxito...
|
||||
item_res.emergency_urls[0][i-1] = path_real.replace(videolibrary_path, '') #se guarda el "path" relativo
|
||||
i += 1
|
||||
except:
|
||||
item_res = item.clone() #Si ha habido un error, se devuelve el Item original
|
||||
|
||||
#logger.debug(item_res.emergency_urls)
|
||||
return item_res
|
||||
return item_res #Devolvemos el Item actualizado con los enlaces de emergencia
|
||||
|
||||
|
||||
def caching_torrents(url, torrents_path=None, decode_flag=False, timeout=10, lookup=False):
|
||||
if torrents_path != None:
|
||||
logger.info("path = " + torrents_path)
|
||||
else:
|
||||
logger.info()
|
||||
import urllib
|
||||
import re
|
||||
from core import httptools
|
||||
|
||||
"""
|
||||
Descarga en el path recibido el .torrent de la url recibida, y pasa el decode
|
||||
Devuelve el path real del .torrent, o el path vacío si la operación no ha tenido éxito
|
||||
"""
|
||||
|
||||
def decode(text):
|
||||
try:
|
||||
src = tokenize(text)
|
||||
data = decode_item(src.next, src.next())
|
||||
for token in src: # look for more tokens
|
||||
raise SyntaxError("trailing junk")
|
||||
except (AttributeError, ValueError, StopIteration):
|
||||
try:
|
||||
data = data
|
||||
except:
|
||||
data = src
|
||||
|
||||
return data
|
||||
|
||||
def tokenize(text, match=re.compile("([idel])|(\d+):|(-?\d+)").match):
|
||||
i = 0
|
||||
while i < len(text):
|
||||
m = match(text, i)
|
||||
s = m.group(m.lastindex)
|
||||
i = m.end()
|
||||
if m.lastindex == 2:
|
||||
yield "s"
|
||||
yield text[i:i + int(s)]
|
||||
i = i + int(s)
|
||||
else:
|
||||
yield s
|
||||
|
||||
def decode_item(next, token):
|
||||
if token == "i":
|
||||
# integer: "i" value "e"
|
||||
data = int(next())
|
||||
if next() != "e":
|
||||
raise ValueError
|
||||
elif token == "s":
|
||||
# string: "s" value (virtual tokens)
|
||||
data = next()
|
||||
elif token == "l" or token == "d":
|
||||
# container: "l" (or "d") values "e"
|
||||
data = []
|
||||
tok = next()
|
||||
while tok != "e":
|
||||
data.append(decode_item(next, tok))
|
||||
tok = next()
|
||||
if token == "d":
|
||||
data = dict(zip(data[0::2], data[1::2]))
|
||||
else:
|
||||
raise ValueError
|
||||
return data
|
||||
|
||||
#Módulo PRINCIPAL
|
||||
try:
|
||||
if lookup:
|
||||
torrents_path = lookup
|
||||
else:
|
||||
if '.torrent' not in torrents_path:
|
||||
torrents_path += '.torrent' #path para dejar el .torrent
|
||||
|
||||
torrents_path_encode = filetools.encode(torrents_path) #encode utf-8 del path
|
||||
response = httptools.downloadpage(url, timeout=timeout) #Descargamos el .torrent
|
||||
if not response.sucess:
|
||||
logger.error('Archivo .torrent no encontrado: ' + url)
|
||||
torrents_path = ''
|
||||
return torrents_path #Si hay un error, devolvemos el "path" vacío
|
||||
torrent_file = response.data
|
||||
|
||||
if "used CloudFlare" in torrent_file: #Si tiene CloudFlare, usamos este proceso
|
||||
response = httptools.downloadpage("http://anonymouse.org/cgi-bin/anon-www.cgi/" + url.strip(), timeout=timeout)
|
||||
if not response.sucess:
|
||||
logger.error('Archivo .torrent no encontrado: ' + url)
|
||||
torrents_path = ''
|
||||
return torrents_path #Si hay un error, devolvemos el "path" vacío
|
||||
torrent_file = response.data
|
||||
|
||||
if decode_flag:
|
||||
torrent_file = decode(torrent_file) #decodificamos el .torrent
|
||||
|
||||
if not lookup:
|
||||
filetools.write(torrents_path_encode, torrent_file) #Salvamos el .torrent
|
||||
except:
|
||||
torrents_path = '' #Si hay un error, devolvemos el "path" vacío
|
||||
|
||||
#logger.debug(torrents_path)
|
||||
return torrents_path
|
||||
|
||||
|
||||
def verify_url_torrent(url, decode_flag=False, timeout=5):
|
||||
"""
|
||||
Verifica si el archivo .torrent al que apunta la url está disponible, descargándolo en un area temporal
|
||||
Entrada: url
|
||||
Salida: True o False dependiendo del resultado de la operación
|
||||
"""
|
||||
|
||||
if not url or url == 'javascript:;': #Si la url viene vacía...
|
||||
return False #... volvemos con error
|
||||
torrents_path = caching_torrents(url, timeout=timeout, lookup=True) #Descargamos el .torrent, sin decode
|
||||
if torrents_path: #Si ha tenido éxito...
|
||||
return True
|
||||
try:
|
||||
torrents_path = caching_torrents(url, timeout=timeout, lookup=True) #Descargamos el .torrent, sin decode
|
||||
if torrents_path: #Si ha tenido éxito...
|
||||
return True
|
||||
except:
|
||||
return False #en caso de error, False
|
||||
|
||||
@@ -296,6 +296,8 @@ def post_tmdb_listado(item, itemlist):
|
||||
del item_local.extra2
|
||||
if item_local.library_filter_show:
|
||||
del item_local.library_filter_show
|
||||
if item_local.channel_host:
|
||||
del item_local.channel_host
|
||||
|
||||
#Ajustamos el nombre de la categoría
|
||||
if item_local.channel == channel_py:
|
||||
@@ -718,6 +720,8 @@ def post_tmdb_episodios(item, itemlist):
|
||||
del item.from_channel
|
||||
if item.library_filter_show:
|
||||
del item.library_filter_show
|
||||
if item.channel_host:
|
||||
del item.channel_host
|
||||
|
||||
for item_local in itemlist: #Recorremos el Itemlist generado por el canal
|
||||
if item_local.add_videolibrary:
|
||||
@@ -741,7 +745,7 @@ def post_tmdb_episodios(item, itemlist):
|
||||
if item_local.update_next:
|
||||
del item_local.update_next
|
||||
if item_local.channel_host:
|
||||
del item_local.channel_host
|
||||
del item_local.channel_host
|
||||
if item_local.intervencion:
|
||||
del item_local.intervencion
|
||||
if item_local.ow_force:
|
||||
@@ -756,6 +760,8 @@ def post_tmdb_episodios(item, itemlist):
|
||||
del item_local.emergency_urls
|
||||
if item_local.library_filter_show:
|
||||
del item_local.library_filter_show
|
||||
if item_local.extra2:
|
||||
del item_local.extra2
|
||||
#logger.debug(item_local)
|
||||
|
||||
#Ajustamos el nombre de la categoría si es un clone de NewPct1
|
||||
@@ -1034,10 +1040,12 @@ def post_tmdb_findvideos(item, itemlist):
|
||||
|
||||
#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()
|
||||
category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
|
||||
if category:
|
||||
item.category = category
|
||||
|
||||
if item.armagedon: #Es una situación catastrófica?
|
||||
itemlist.append(item.clone(action='', title=item.category + ': [COLOR hotpink]VIDEOTECA: Usando enlaces de emergencia[/COLOR]'))
|
||||
itemlist.append(item.clone(action='', title=item.category + ': [COLOR hotpink]Usando enlaces de emergencia[/COLOR]'))
|
||||
|
||||
#Quitamos el la categoría o nombre del título, si lo tiene
|
||||
if item.contentTitle:
|
||||
@@ -1264,22 +1272,33 @@ def get_torrent_size(url):
|
||||
#Móludo principal
|
||||
size = ""
|
||||
try:
|
||||
torrents_path = config.get_videolibrary_path() + '/torrents' #path para dejar el .torrent
|
||||
#torrents_path = config.get_videolibrary_path() + '/torrents' #path para dejar el .torrent
|
||||
|
||||
if not os.path.exists(torrents_path):
|
||||
os.mkdir(torrents_path) #si no está la carpeta la creamos
|
||||
#if not os.path.exists(torrents_path):
|
||||
# os.mkdir(torrents_path) #si no está la carpeta la creamos
|
||||
|
||||
urllib.URLopener.version = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36 SE 2.X MetaSr 1.0'
|
||||
urllib.urlretrieve(url, torrents_path + "/generictools.torrent") #desacargamos el .torrent a la carpeta
|
||||
torrent_file = open(torrents_path + "/generictools.torrent", "rb").read() #leemos el .torrent
|
||||
#urllib.URLopener.version = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36 SE 2.X MetaSr 1.0'
|
||||
#urllib.urlretrieve(url, torrents_path + "/generictools.torrent") #desacargamos el .torrent a la carpeta
|
||||
#torrent_file = open(torrents_path + "/generictools.torrent", "rb").read() #leemos el .torrent
|
||||
|
||||
response = httptools.downloadpage(url, timeout=2) #Descargamos el .torrent
|
||||
if not response.sucess:
|
||||
size = ''
|
||||
return size #Si hay un error, devolvemos el "size" vacío
|
||||
torrent_file = response.data
|
||||
|
||||
if "used CloudFlare" in torrent_file: #Si tiene CloudFlare, usamos este proceso
|
||||
try:
|
||||
urllib.urlretrieve("http://anonymouse.org/cgi-bin/anon-www.cgi/" + url.strip(),
|
||||
torrents_path + "/generictools.torrent")
|
||||
torrent_file = open(torrents_path + "/generictools.torrent", "rb").read()
|
||||
except:
|
||||
torrent_file = ""
|
||||
#try:
|
||||
# urllib.urlretrieve("http://anonymouse.org/cgi-bin/anon-www.cgi/" + url.strip(),
|
||||
# torrents_path + "/generictools.torrent")
|
||||
# torrent_file = open(torrents_path + "/generictools.torrent", "rb").read()
|
||||
#except:
|
||||
# torrent_file = ""
|
||||
response = httptools.downloadpage("http://anonymouse.org/cgi-bin/anon-www.cgi/" + url.strip())
|
||||
if not response.sucess:
|
||||
size = ''
|
||||
return size #Si hay un error, devolvemos el "size" vacío
|
||||
torrent_file = response.data
|
||||
|
||||
torrent = decode(torrent_file) #decodificamos el .torrent
|
||||
|
||||
@@ -1299,10 +1318,10 @@ def get_torrent_size(url):
|
||||
except:
|
||||
logger.error('ERROR al buscar el tamaño de un .Torrent: ' + str(url))
|
||||
|
||||
try:
|
||||
os.remove(torrents_path + "/generictools.torrent") #borramos el .torrent
|
||||
except:
|
||||
pass
|
||||
#try:
|
||||
# os.remove(torrents_path + "/generictools.torrent") #borramos el .torrent
|
||||
#except:
|
||||
# pass
|
||||
|
||||
#logger.debug(str(url) + ' / ' + str(size))
|
||||
|
||||
@@ -1429,6 +1448,15 @@ def fail_over_newpct1(item, patron, patron2=None, timeout=None):
|
||||
if not item.extra2:
|
||||
item.extra2 = 'z9z8z7z6z5'
|
||||
|
||||
patron_alt = ''
|
||||
verify_torrent = ''
|
||||
if patron is not True and '|' in patron: #Comprobamos si hay dos patrones alternativos
|
||||
try:
|
||||
verify_torrent, patron1, patron_alt = patron.split('|') #Si es así, los separamos y los tratamos
|
||||
patron = patron1
|
||||
except:
|
||||
pass
|
||||
|
||||
#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)
|
||||
@@ -1451,6 +1479,7 @@ def fail_over_newpct1(item, patron, patron2=None, timeout=None):
|
||||
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?
|
||||
@@ -1527,18 +1556,30 @@ def fail_over_newpct1(item, patron, patron2=None, timeout=None):
|
||||
data_alt = scrapertools.find_single_match(data, patron)
|
||||
if not data_alt:
|
||||
data_alt = scrapertools.find_single_match(data_comillas, patron)
|
||||
if data_alt and patron_alt:
|
||||
data_alt = scrapertools.find_single_match(data, patron_alt)
|
||||
if not data_alt and patron_alt:
|
||||
data_alt = scrapertools.find_single_match(data_comillas, patron_alt)
|
||||
if patron2 != None:
|
||||
data_alt = scrapertools.find_single_match(data_alt, patron2)
|
||||
if not data_alt: #no ha habido suerte, probamos con el siguiente canal
|
||||
logger.error("ERROR 02: " + item.action + ": Ha cambiado la estructura de la Web: " + url + " / Patron: " + patron)
|
||||
logger.error("ERROR 02: " + item.action + ": Ha cambiado la estructura de la Web: " + url + " / Patron: " + patron + " / " +patron_alt)
|
||||
web_intervenida(item, data)
|
||||
data = ''
|
||||
continue
|
||||
else:
|
||||
item.url = url #guardamos la url que funciona
|
||||
#Función especial para encontrar en otro clone un .torrent válido
|
||||
if verify_torrent == 'torrent:check:status':
|
||||
from core import videolibrarytools
|
||||
if videolibrarytools.verify_url_torrent(data_alt): #verificamos si el .torrent existe
|
||||
item.url = url #guardamos la url que funciona
|
||||
break #nos vamos, con la nueva url del .torrent verificada
|
||||
data = ''
|
||||
continue #no vale el .torrent, continuamos
|
||||
item.url = url #guardamos la url que funciona, sin verificar
|
||||
break #por fin !!! Este canal parece que funciona
|
||||
else:
|
||||
logger.error("ERROR 02: " + item.action + ": Ha cambiado la estructura de la Web: " + url + " / Patron: " + patron)
|
||||
logger.error("ERROR 02: " + item.action + ": Ha cambiado la estructura de la Web: " + url + " / Patron: " + patron + " / " +patron_alt)
|
||||
web_intervenida(item, data)
|
||||
data = ''
|
||||
continue
|
||||
@@ -1715,6 +1756,8 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F
|
||||
#if it != None: logger.debug(it)
|
||||
if not it:
|
||||
it = Item()
|
||||
item_back = item.clone()
|
||||
it_back = item.clone()
|
||||
ow_force_param = True
|
||||
channel_enabled = False
|
||||
update_stat = 0
|
||||
@@ -1746,10 +1789,10 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F
|
||||
|
||||
#primero tratamos los clones de Newpct1
|
||||
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
|
||||
if not channel_alt:
|
||||
channel_alt = item.channel
|
||||
#if item.url and not it.library_urls:
|
||||
# channel_alt = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').lower() #Salvamos en nombre del canal o clone
|
||||
# if not channel_alt:
|
||||
# channel_alt = item.channel
|
||||
channel = "'%s'" % channel_alt
|
||||
category = ''
|
||||
if channel_alt != 'videolibrary':
|
||||
@@ -1775,6 +1818,31 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F
|
||||
|
||||
if it.emergency_urls:
|
||||
item.emergency_urls = it.emergency_urls #Refrescar desde el .nfo
|
||||
|
||||
#Arreglo temporal para Newpct1
|
||||
if channel in fail_over_list or channel_alt == 'videolibrary':
|
||||
channel_bis = channel_py
|
||||
if not item.url and it.library_urls and channel_alt == 'videolibrary':
|
||||
for canal_vid, url_vid in it.library_urls.items(): #Se recorre "item.library_urls" para buscar canales candidatos
|
||||
canal_vid_alt = "'%s'" % canal_vid
|
||||
if canal_vid_alt in fail_over_list: #Se busca si es un clone de newpct1
|
||||
channel_bis = channel_py
|
||||
channel_alt = canal_vid
|
||||
channel = "'%s'" % channel_alt
|
||||
break
|
||||
else:
|
||||
channel_bis = canal_vid
|
||||
if channel_bis == channel_py and config.get_setting("emergency_urls", channel_bis) == 1 and config.get_setting("emergency_urls_torrents", channel_bis) and item.emergency_urls and item.emergency_urls.get(channel_alt, False):
|
||||
raiz, carpetas_series, ficheros = filetools.walk(path).next()
|
||||
objetivo = '[%s]_01.torrent' % channel_alt
|
||||
encontrado = False
|
||||
for fichero in ficheros:
|
||||
if objetivo in fichero:
|
||||
encontrado = True
|
||||
break
|
||||
if not encontrado:
|
||||
logger.error('REGENERANDO: ' + str(item.emergency_urls))
|
||||
item.emergency_urls.pop(channel_alt, None)
|
||||
|
||||
if item.url: #Viene de actualización de videoteca de series
|
||||
#Analizamos si el canal ya tiene las urls de emergencia: guardar o borrar
|
||||
@@ -1935,6 +2003,21 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F
|
||||
it.update_next = '1'
|
||||
del it.update_next
|
||||
|
||||
#Verificamos que las webs de los canales estén activas antes de borrar los .json, para asegurar que se pueden regenerar
|
||||
i = 0
|
||||
for canal_org_def, canal_des_def, url_total, opt_def, ow_force_def in canal_org_des_list: #pasamos por las "parejas" a borrar
|
||||
try:
|
||||
response = httptools.downloadpage(url_total, only_headers=True)
|
||||
except:
|
||||
pass
|
||||
if not response.sucess:
|
||||
logger.error('Web ' + canal_des_def.upper() + ' INACTIVA. Regla no procesada: ' + str(canal_org_des_list[i]))
|
||||
item = item_back.clone() #Restauro las imágenes inciales
|
||||
it = it_back.clone()
|
||||
item.torrent_caching_fail = True #Marcamos el proceso como fallido
|
||||
return (item, it, False)
|
||||
i += 1
|
||||
|
||||
# Listamos todos los ficheros de la serie, asi evitamos tener que comprobar si existe uno por uno
|
||||
canal_erase_list = []
|
||||
from core import videolibrarytools
|
||||
@@ -1951,44 +2034,29 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F
|
||||
#logger.error(canal_erase + canal_new + archivo + archivo_alt)
|
||||
#Borramos los .json que sean de los canal afectados, incluidos todos los de los clones de newpct1 si éste es el canal
|
||||
if canal_erase in archivo or (ow_force_def == 'emerg' and canal_erase_alt in fail_over_list and archivo_alt in fail_over_list):
|
||||
if canal_des_def and it.contentType == 'movie': #Si es película ...
|
||||
if canal_des_def and it.contentType == 'movie' and not '.torrent' in archivo: #Si es película ...
|
||||
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
|
||||
|
||||
emer_urls = ''
|
||||
if ow_force_def == 'emerg' and opt_def in ['1', '3']: #Si era una op. para añadir/actualizar urls de emergencia ...
|
||||
item_json = videolibrarytools.emergency_urls(item_json) #... ejecutamos "findvideos" del canal para obtenerlas
|
||||
if item_json.emergency_urls: #... si las hay ...
|
||||
emer_urls = item_json.emergency_urls #... lo preparamos para el .json
|
||||
if it.emergency_urls and not isinstance(it.emergency_urls, dict):
|
||||
del it.emergency_urls
|
||||
if not it.emergency_urls: #... lo actualizamos en el .nfo
|
||||
it.emergency_urls = dict() #... iniciamos la variable si no existe
|
||||
it.emergency_urls.update({canal_des_def: True}) #... se marca como activo
|
||||
else:
|
||||
continue #Si no hay url, pasamos al siguiente, sin borrar el .json
|
||||
if ow_force_def == 'emerg' and opt_def == '2': #Si era una operación para borrar urls de emergencia ...
|
||||
emer_urls = '2' #borramos enlaces
|
||||
if it.emergency_urls and not isinstance(it.emergency_urls, dict):
|
||||
del it.emergency_urls
|
||||
if it.emergency_urls and it.emergency_urls.get(item_json.channel, False):
|
||||
it.emergency_urls.pop(item_json.channel, None) #borramos la entrada del .nfo
|
||||
|
||||
json_path_list += [(canal_org_def, canal_des_def, url_total, json_path, title, language, wanted, emer_urls)]
|
||||
filetools.remove(archivo) #Borramos el .json
|
||||
json_path_list += [(canal_org_def, canal_des_def, url_total, json_path, title, language, wanted, ow_force_def, opt_def, archivo)]
|
||||
filetools.remove(archivo) #Borramos el .json y el .torrent
|
||||
logger.error('** BORRAMOS: ' + str(archivo))
|
||||
if ow_force_def == 'del' or ow_force_def == 'emerg': #Si la función es 'del' or 'emerg' ...
|
||||
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 it.nfo: del it.nfo #Borramos variables innecesarias
|
||||
if it.path: del it.path #Borramos variables innecesarias
|
||||
if it.text_color: del it.text_color #Borramos variables innecesarias
|
||||
if item.contentType == "movie" and ".nfo" in archivo: #Para películas
|
||||
archivo_nfo = archivo #Guardamos el path del .nfo para futuro uso
|
||||
if it.ow_force: del it.ow_force
|
||||
filetools.write(archivo, head_nfo + it.tojson()) #escribo el .nfo de la peli
|
||||
if item.contentType != "movie" and "tvshow.nfo" in archivo:
|
||||
archivo_nfo = archivo #Guardamos el path del .nfo para futuro uso
|
||||
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
|
||||
@@ -1996,19 +2064,20 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F
|
||||
item_movie = item.clone()
|
||||
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
|
||||
del item_movie.nfo
|
||||
del item_movie.path
|
||||
if item_movie.update_last: del item_movie.update_last
|
||||
if item_movie.library_playcounts: del item_movie.library_playcounts #Borramos lo que no es necesario en el .json
|
||||
if item_movie.library_urls: del item_movie.library_urls
|
||||
if item_movie.nfo: del item_movie.nfo
|
||||
if item_movie.path: del item_movie.path
|
||||
if item_movie.strm_path: del item_movie.strm_path
|
||||
if item_movie.text_color: del item_movie.text_color
|
||||
if item_movie.channel_host: del item_movie.channel_host
|
||||
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, emer_urls in json_path_list: #pasamos por todos canales
|
||||
for canal_org_def, canal_des_def, url_total, json_path, title, language, wanted, ow_force_def, opt_def, archivo in json_path_list: #pasamos por todos canales
|
||||
logger.error('** ESCRIBIMOS: ' + json_path)
|
||||
item_movie.emergency_urls = False
|
||||
del item_movie.emergency_urls
|
||||
@@ -2019,11 +2088,29 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F
|
||||
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
|
||||
if emer_urls == '2': #si estamos borrando urls de emergencia ...
|
||||
if item_movie.emergency_urls:
|
||||
del item_movie.emergency_urls #... las borramos
|
||||
elif emer_urls: #si estamos añadiendo urls de emergencia ...
|
||||
item_movie.emergency_urls = emer_urls #... las copiamos al .json
|
||||
|
||||
if ow_force_def == 'emerg' and opt_def in ['1', '3']: #Si era una op. para añadir/actualizar urls de emergencia ...
|
||||
item_movie = videolibrarytools.emergency_urls(item_movie, None, archivo) #... ejecutamos "findvideos" del canal para obtenerlas
|
||||
if item_movie.channel_host: del item_movie.channel_host
|
||||
if item_movie.unify: del item_movie.unify
|
||||
if item_movie.extra2: del item_movie.extra2
|
||||
if item_movie.emergency_urls: #... si las hay ...
|
||||
if it.emergency_urls and not isinstance(it.emergency_urls, dict):
|
||||
del it.emergency_urls
|
||||
if not it.emergency_urls: #... lo actualizamos en el .nfo
|
||||
it.emergency_urls = dict() #... iniciamos la variable si no existe
|
||||
it.emergency_urls.update({canal_des_def: True}) #... se marca como activo
|
||||
filetools.write(archivo_nfo, head_nfo + it.tojson()) #actualizo el .nfo de la peli
|
||||
else:
|
||||
logger.error('Error en FINDVIDEOS: ' + archivo + ' / Regla: ' + canal_org_def + ', ' + opt_def + ', ' + ow_force_def)
|
||||
|
||||
if ow_force_def == 'emerg' and opt_def == '2': #Si era una operación para borrar urls de emergencia ...
|
||||
if it.emergency_urls and not isinstance(it.emergency_urls, dict):
|
||||
del it.emergency_urls
|
||||
if it.emergency_urls and it.emergency_urls.get(item_movie.channel, False):
|
||||
it.emergency_urls.pop(item_movie.channel, None) #borramos la entrada del .nfo
|
||||
filetools.write(archivo_nfo, head_nfo + it.tojson()) #actualizo el .nfo de la peli
|
||||
|
||||
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:
|
||||
|
||||
@@ -1061,6 +1061,9 @@ def torrent_client_installed(show_tuple=False):
|
||||
def play_torrent(item, xlistitem, mediaurl):
|
||||
logger.info()
|
||||
import time
|
||||
from core import filetools
|
||||
from core import httptools
|
||||
from core import videolibrarytools
|
||||
|
||||
# Opciones disponibles para Reproducir torrents
|
||||
torrent_options = list()
|
||||
@@ -1090,6 +1093,36 @@ def play_torrent(item, xlistitem, mediaurl):
|
||||
xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, xlistitem) #Preparamos el entorno para evitar error Kod1 18
|
||||
time.sleep(0.5) #Dejamos tiempo para que se ejecute
|
||||
|
||||
#Nuevo método de descarga previa del .torrent. Si da error, miramos si hay alternatica local. Si ya es local, lo usamos
|
||||
url_stat = False
|
||||
videolibrary_path = config.get_videolibrary_path() #Calculamos el path absoluto a partir de la Videoteca
|
||||
if not filetools.exists(videolibrary_path): #Si no existe el path, pasamos al modo clásico
|
||||
url_stat = True
|
||||
elif not filetools.exists(videolibrary_path + 'temp_torrents_Alfa'): #Si no existe la carpeta temporal para .torrents, la creamos
|
||||
filetools.mkdir(videolibrary_path + 'temp_torrents_Alfa')
|
||||
torrents_path = filetools.join(videolibrary_path, 'temp_torrents_Alfa', 'cliente_torrent_Alfa.torrent') #path de descarga temporal
|
||||
|
||||
#identificamos si es una url o un path de archivo. Los Magnets los tratamos de la forma clásica
|
||||
if not item.url.startswith("\\") and not item.url.startswith("/") and not item.url.startswith("magnet:") and not url_stat:
|
||||
timeout = 10
|
||||
if item.torrent_alt:
|
||||
timeout = 5
|
||||
item.url = videolibrarytools.caching_torrents(item.url, torrents_path=torrents_path, timeout=timeout) #Descargamos el .torrent
|
||||
if item.url: url_stat = True
|
||||
|
||||
if not item.url and item.torrent_alt: #Si hay error, se busca un .torrent alternativo
|
||||
item.url = item.torrent_alt #El .torrent alternativo puede estar en una url o en local
|
||||
|
||||
#Si es un archivo .torrent local, actualizamos el path relativo a path absoluto
|
||||
if item.url.startswith("\\") or item.url.startswith("/") and not url_stat: #.torrent alternativo local
|
||||
movies = config.get_setting("folder_movies")
|
||||
series = config.get_setting("folder_tvshows")
|
||||
if item.contentType == 'movie':
|
||||
folder = movies #películas
|
||||
else:
|
||||
folder = series #o series
|
||||
item.url = filetools.join(videolibrary_path, folder, item.url) #dirección del .torrent local en la Videoteca
|
||||
|
||||
mediaurl = urllib.quote_plus(item.url)
|
||||
#Llamada con más parámetros para completar el título
|
||||
if ("quasar" in torrent_options[seleccion][1] or "elementum" in torrent_options[seleccion][1]) and item.infoLabels['tmdb_id']:
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
{
|
||||
"pattern": "https://cloudvideo.tv/embed-([a-z0-9]+).html",
|
||||
"url": "https://cloudvideo.tv/embed-\\1.html"
|
||||
},
|
||||
{
|
||||
"pattern": "https://cloudvideo.tv/([a-z0-9]+)",
|
||||
"url": "https://cloudvideo.tv/embed-\\1.html"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from channels import kbagi
|
||||
from core import httptools
|
||||
from core import jsontools
|
||||
from core import scrapertools
|
||||
from platformcode import logger
|
||||
|
||||
|
||||
def test_video_exists(page_url):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
domain = "diskokosmiko.mx"
|
||||
logueado, error_message = diskokosmiko.login(domain)
|
||||
if not logueado:
|
||||
return False, error_message
|
||||
|
||||
data = httptools.downloadpage(page_url).data
|
||||
if ("File was deleted" or "Not Found" or "File was locked by administrator") in data:
|
||||
return False, "[%s] El archivo no existe o ha sido borrado" %domain
|
||||
|
||||
return True, ""
|
||||
|
||||
|
||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
|
||||
video_urls = []
|
||||
data = httptools.downloadpage(page_url).data
|
||||
host = "http://diskokosmiko.mx"
|
||||
host_string = "diskokosmiko"
|
||||
|
||||
url = scrapertools.find_single_match(data, '<form action="([^"]+)" class="download_form"')
|
||||
if url:
|
||||
url = host + url
|
||||
fileid = url.rsplit("f=", 1)[1]
|
||||
token = scrapertools.find_single_match(data,
|
||||
'<div class="download_container">.*?name="__RequestVerificationToken".*?value="([^"]+)"')
|
||||
post = "fileId=%s&__RequestVerificationToken=%s" % (fileid, token)
|
||||
headers = {'X-Requested-With': 'XMLHttpRequest'}
|
||||
data = httptools.downloadpage(url, post, headers).data
|
||||
data = jsontools.load(data)
|
||||
mediaurl = data.get("DownloadUrl")
|
||||
extension = data.get("Extension")
|
||||
|
||||
video_urls.append([".%s [%s]" % (extension, host_string), mediaurl])
|
||||
|
||||
for video_url in video_urls:
|
||||
logger.info(" %s - %s" % (video_url[0], video_url[1]))
|
||||
|
||||
return video_urls
|
||||
@@ -4,8 +4,8 @@
|
||||
"ignore_urls": [],
|
||||
"patterns": [
|
||||
{
|
||||
"pattern": "flashx.co/([A-z0-9]+)\\.jsp",
|
||||
"url": "https://www.flashx.co/\\1.jsp"
|
||||
"pattern": "flashx.co/([A-z0-9]+)\\.(jsp|html)",
|
||||
"url": "https://www.flashx.co/\\1.\\2"
|
||||
},
|
||||
{
|
||||
"pattern": "flashx.(?:tv|pw|ws|sx|to)/(?:embed.php\\?c=|embed-|playvid-|)([A-z0-9]+)",
|
||||
|
||||
@@ -1,43 +1,42 @@
|
||||
{
|
||||
"active": true,
|
||||
"find_videos": {
|
||||
"ignore_urls": [],
|
||||
"patterns": [
|
||||
{
|
||||
"pattern": "((?:diskokosmiko.mx)/[^\\s'\"]+)",
|
||||
"url": "http://\\1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"free": true,
|
||||
"id": "diskokosmoko",
|
||||
"name": "diskokosmiko",
|
||||
"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/EjbfM7p.png?1",
|
||||
"version": 1
|
||||
}
|
||||
{
|
||||
"active": true,
|
||||
"find_videos": {
|
||||
"ignore_urls": [],
|
||||
"patterns": [
|
||||
{
|
||||
"pattern": "flix555.com/([A-z0-9]+)",
|
||||
"url": "https://flix555.com/\\1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"free": true,
|
||||
"id": "flix555",
|
||||
"name": "flix555",
|
||||
"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": "https://flix555.com/img/logo.png"
|
||||
}
|
||||
48
plugin.video.alfa/servers/flix555.py
Normal file
48
plugin.video.alfa/servers/flix555.py
Normal file
@@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re, base64, urllib, time
|
||||
|
||||
from core import httptools, scrapertools
|
||||
from lib import jsunpack
|
||||
from platformcode import logger, platformtools
|
||||
|
||||
|
||||
def test_video_exists(page_url):
|
||||
resp = httptools.downloadpage(page_url)
|
||||
if resp.code == 404 or '<b>File Not Found</b>' in resp.data:
|
||||
return False, "[flix555] El video no está disponible"
|
||||
return True, ""
|
||||
|
||||
|
||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(page_url).data
|
||||
# ~ logger.info(data)
|
||||
|
||||
post = {}
|
||||
inputs = scrapertools.find_multiple_matches(data, '<input type="(?:hidden|submit)" name="([^"]*)" value="([^"]*)"')
|
||||
for nom, valor in inputs: post[nom] = valor
|
||||
post = urllib.urlencode(post)
|
||||
# ~ logger.info(post)
|
||||
|
||||
espera = scrapertools.find_single_match(data, '<span id="cxc">(\d+)</span>')
|
||||
platformtools.dialog_notification('Cargando flix555', 'Espera de %s segundos requerida' % espera)
|
||||
time.sleep(int(espera))
|
||||
|
||||
data = httptools.downloadpage(page_url, post=post).data
|
||||
# ~ logger.info(data)
|
||||
|
||||
packed = scrapertools.find_single_match(data, "<script type=[\"']text/javascript[\"']>(eval.*?)</script>")
|
||||
unpacked = jsunpack.unpack(packed)
|
||||
# ~ logger.info(unpacked)
|
||||
|
||||
matches = scrapertools.find_multiple_matches(unpacked, 'file\s*:\s*"([^"]*)"\s*,\s*label\s*:\s*"([^"]*)"')
|
||||
if matches:
|
||||
for url, lbl in matches:
|
||||
if not url.endswith('.srt'):
|
||||
itemlist.append(['[%s]' % lbl, url])
|
||||
|
||||
return itemlist
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# --------------------------------------------------------
|
||||
|
||||
import re
|
||||
import urllib
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from platformcode import logger
|
||||
@@ -29,12 +28,14 @@ def get_video_url(page_url, premium = False, user = "", password = "", video_pas
|
||||
headers = {'referer': page_url}
|
||||
for i in range(0, 3):
|
||||
data = httptools.downloadpage(page_url, headers=headers).data
|
||||
data = re.sub(r'"|\n|\r|\t| |<br>|\s{2,}', "", data)
|
||||
if '<input type=hidden' in data:
|
||||
if '゚ω゚ノ' in data:
|
||||
break
|
||||
else:
|
||||
page_url = scrapertools.find_single_match(data, "iframe src=(.*?) scrolling")
|
||||
code = re.findall('<script>\s*゚ω゚(.*?)</script>', data, flags=re.DOTALL)[0]
|
||||
page_url = scrapertools.find_single_match(data, '"iframe" src="([^"]+)')
|
||||
if not page_url:
|
||||
page_url = scrapertools.find_single_match(data, '<input type="hidden" id="link" value="([^"]+)')
|
||||
data = re.sub(r'"|\n|\r|\t| |<br>|\s{2,}', "", data)
|
||||
code = scrapertools.find_single_match(data, '(?s)<script>\s*゚ω゚(.*?)</script>').strip()
|
||||
text_decode = aadecode(code)
|
||||
funcion, clave = re.findall("func\.innerHTML = (\w*)\('([^']*)', ", text_decode, flags=re.DOTALL)[0]
|
||||
# decodificar javascript en campos html hidden
|
||||
|
||||
@@ -7,29 +7,25 @@ from platformcode import logger
|
||||
|
||||
def test_video_exists(page_url):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
|
||||
data = httptools.downloadpage(page_url).data
|
||||
|
||||
if "Not Found" in data or "File Does not Exist" in data:
|
||||
return False, "[Vidto.me] El fichero no existe o ha sido borrado"
|
||||
|
||||
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
|
||||
# Extrae la URL
|
||||
# {file:"http://188.240.220.186/drjhpzy4lqqwws4phv3twywfxej5nwmi4nhxlriivuopt2pul3o4bkge5hxa/video.mp4",label:"240p"}
|
||||
code = scrapertools.find_single_match(data, 'name="code" value="([^"]+)')
|
||||
hash = scrapertools.find_single_match(data, 'name="hash" value="([^"]+)')
|
||||
post = "op=download1&code=%s&hash=%s&imhuman=Proceed+to+video" %(code, hash)
|
||||
data1 = httptools.downloadpage("http://m.vidtome.stream/playvideo/%s" %code, post=post).data
|
||||
video_urls = []
|
||||
media_urls = scrapertools.find_multiple_matches(data, '\{file\s*:\s*"([^"]+)",label\s*:\s*"([^"]+)"\}')
|
||||
for media_url, label in media_urls:
|
||||
media_urls = scrapertools.find_multiple_matches(data1, 'file: "([^"]+)')
|
||||
for media_url in media_urls:
|
||||
ext = scrapertools.get_filename_from_url(media_url)[-4:]
|
||||
video_urls.append(["%s (%s) [vidto.me]" % (ext, label), media_url])
|
||||
|
||||
video_urls.append(["%s [vidto.me]" % (ext), media_url])
|
||||
video_urls.reverse()
|
||||
for video_url in video_urls:
|
||||
logger.info("%s - %s" % (video_url[0], video_url[1]))
|
||||
|
||||
logger.info("%s" % (video_url[0]))
|
||||
return video_urls
|
||||
|
||||
@@ -22,11 +22,12 @@ def test_video_exists(page_url):
|
||||
def get_video_url(page_url, user="", password="", video_password=""):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
video_urls = []
|
||||
data1 = httptools.downloadpage("https://xdrive.cc/geo_ip").data
|
||||
_ip = scrapertools.find_single_match(data1, 'ip":"([^"]+)')
|
||||
data = httptools.downloadpage(page_url).data
|
||||
videourl = scrapertools.find_multiple_matches(data, "src: '([^']+).*?label: '([^']+)")
|
||||
scrapertools.printMatches(videourl)
|
||||
for scrapedurl, scrapedquality in videourl:
|
||||
scrapedquality = scrapedquality.replace("↑","")
|
||||
video_urls.append([scrapedquality + " [xdrive]", scrapedurl])
|
||||
video_urls.sort(key=lambda it: int(it[0].split("P ", 1)[0]))
|
||||
video_id = scrapertools.find_single_match(data, '&video_id=(\d+)')
|
||||
data = httptools.downloadpage("https://xdrive.cc/secure_link?ip=%s&video_id=%s" %(_ip, video_id)).data.replace("\\","")
|
||||
videourl = scrapertools.find_multiple_matches(data, '"([^"]+)"')
|
||||
for scrapedurl in videourl:
|
||||
video_urls.append(["[xdrive]", scrapedurl])
|
||||
return video_urls
|
||||
|
||||
@@ -17,6 +17,7 @@ def update(path, p_dialog, i, t, serie, overwrite):
|
||||
insertados_total = 0
|
||||
|
||||
head_nfo, it = videolibrarytools.read_nfo(path + '/tvshow.nfo')
|
||||
category = serie.category
|
||||
|
||||
# logger.debug("%s: %s" %(serie.contentSerieName,str(list_canales) ))
|
||||
for channel, url in serie.library_urls.items():
|
||||
@@ -28,6 +29,7 @@ def update(path, p_dialog, i, t, serie, overwrite):
|
||||
head_nfo, it = videolibrarytools.read_nfo(path + '/tvshow.nfo') #Refresca el .nfo para recoger actualizaciones
|
||||
if it.emergency_urls:
|
||||
serie.emergency_urls = it.emergency_urls
|
||||
serie.category = category
|
||||
serie, it, overwrite = generictools.redirect_clone_newpct1(serie, head_nfo, it, path, overwrite)
|
||||
except:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user