Update peliculasrey.py

This commit is contained in:
Intel1
2017-08-28 16:21:34 -05:00
committed by GitHub
parent 84494748de
commit ca0ec5770f

View File

@@ -9,18 +9,18 @@ from core import servertools
from core.item import Item
from platformcode import logger, config
host = "http://www.peliculasrey.com/"
def mainlist(item):
logger.info()
itemlist = []
itemlist.append(
Item(channel=item.channel, action="PorFecha", title="Año de Lanzamiento", url="http://www.peliculasrey.com"))
itemlist.append(Item(channel=item.channel, action="Idiomas", title="Idiomas", url="http://www.peliculasrey.com"))
itemlist.append(
Item(channel=item.channel, action="calidades", title="Por calidad", url="http://www.peliculasrey.com"))
itemlist.append(Item(channel=item.channel, action="generos", title="Por género", url="http://www.peliculasrey.com"))
itemlist.append(Item(channel=item.channel, action="search", title="Buscar...", url="http://www.peliculasrey.com"))
itemlist.append(Item(channel=item.channel, action="peliculas", title="Recientes", url=host))
itemlist.append(Item(channel=item.channel, action="PorFecha", title="Año de Lanzamiento", url=host))
itemlist.append(Item(channel=item.channel, action="Idiomas", title="Idiomas", url=host))
itemlist.append(Item(channel=item.channel, action="calidades", title="Por calidad", url=host))
itemlist.append(Item(channel=item.channel, action="generos", title="Por género", url=host))
itemlist.append(Item(channel=item.channel, action="search", title="Buscar...", url=host))
return itemlist
@@ -31,7 +31,6 @@ def PorFecha(item):
# Descarga la pagina
data = httptools.downloadpage(item.url).data
data = scrapertools.find_single_match(data, '<section class="lanzamiento">(.*?)</section>')
logger.info("data=" + data)
# Extrae las entradas (carpetas)
patron = '<a href="([^"]+).*?title="([^"]+)'
@@ -43,7 +42,6 @@ def PorFecha(item):
thumbnail = ""
plot = ""
url = urlparse.urljoin(item.url, scrapedurl)
logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]")
itemlist.append(
Item(channel=item.channel, action="peliculas", title=title, url=url, thumbnail=thumbnail, plot=plot,
fulltitle=title, viewmode="movie"))
@@ -57,7 +55,6 @@ def Idiomas(item):
# Descarga la pagina
data = httptools.downloadpage(item.url).data
data = scrapertools.find_single_match(data, '<section class="idioma">(.*?)</section>')
logger.info("data=" + data)
# Extrae las entradas (carpetas)
patron = '<a href="([^"]+).*?title="([^"]+)'
@@ -69,7 +66,6 @@ def Idiomas(item):
thumbnail = ""
plot = ""
url = urlparse.urljoin(item.url, scrapedurl)
logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]")
itemlist.append(
Item(channel=item.channel, action="peliculas", title=title, url=url, thumbnail=thumbnail, plot=plot,
fulltitle=title, viewmode="movie"))
@@ -83,7 +79,6 @@ def calidades(item):
# Descarga la pagina
data = httptools.downloadpage(item.url).data
data = scrapertools.find_single_match(data, '<section class="calidades">(.*?)</section>')
logger.info("data=" + data)
# Extrae las entradas (carpetas)
patron = '<a href="([^"]+).*?title="([^"]+)'
@@ -95,7 +90,6 @@ def calidades(item):
thumbnail = ""
plot = ""
url = urlparse.urljoin(item.url, scrapedurl)
logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]")
itemlist.append(
Item(channel=item.channel, action="peliculas", title=title, url=url, thumbnail=thumbnail, plot=plot,
fulltitle=title, viewmode="movie"))
@@ -106,12 +100,8 @@ def calidades(item):
def generos(item):
logger.info()
# Descarga la pagina
data = httptools.downloadpage(item.url).data
data = scrapertools.find_single_match(data, '<section class="generos">(.*?)</section>')
logger.info("data=" + data)
# Extrae las entradas (carpetas)
patron = '<a href="([^"]+).*?title="([^"]+)'
matches = re.compile(patron, re.DOTALL).findall(data)
itemlist = []
@@ -121,7 +111,6 @@ def generos(item):
thumbnail = ""
plot = ""
url = urlparse.urljoin(item.url, scrapedurl)
logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]")
if "Adulto" in title and config.get_setting("adult_mode") == 0:
continue
itemlist.append(
@@ -134,7 +123,7 @@ def generos(item):
def search(item, texto):
logger.info()
texto = texto.replace(" ", "+")
item.url = "http://www.peliculasrey.com/?s=" + texto
item.url = host + "?s=" + texto
try:
# return buscar(item)
@@ -152,7 +141,6 @@ def peliculas(item):
# Descarga la pagina
data = httptools.downloadpage(item.url).data
logger.info("data=" + data)
data = re.sub(r"\n|\r|\t|\s{2}|&nbsp;", "", data)
tabla_pelis = scrapertools.find_single_match(data,
@@ -163,13 +151,11 @@ def peliculas(item):
itemlist = []
for scrapedthumbnail, scrapedtitle, scrapedurl in matches:
logger.debug("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]")
itemlist.append(Item(channel=item.channel, action="findvideos", title=scrapedtitle, url=scrapedurl,
thumbnail=scrapedthumbnail, plot="", fulltitle=scrapedtitle))
next_page = scrapertools.find_single_match(data, 'rel="next" href="([^"]+)')
if next_page != "":
# itemlist.append( Item(channel=item.channel, action="peliculas" , title=">> Página siguiente" , url=item.url+next_page, folder=True, viewmode="movie"))
itemlist.append(
Item(channel=item.channel, action="peliculas", title=">> Página siguiente", url=next_page, folder=True,
viewmode="movie"))
@@ -180,40 +166,46 @@ def peliculas(item):
def findvideos(item):
logger.info()
# Descarga la pagina
data = httptools.downloadpage(item.url).data
# logger.info("data="+data)
# Extrae las entradas (carpetas)
patron = 'hand" rel="([^"]+).*?title="(.*?)".*?<span>([^<]+)</span>.*?</span><span class="q">(.*?)<'
matches = re.compile(patron, re.DOTALL).findall(data)
itemlist = []
itemtemp = []
for scrapedurl, nombre_servidor, idioma, calidad in matches:
idioma = idioma.strip()
calidad = calidad.strip()
title = "Ver en " + nombre_servidor + " (" + idioma + ") (Calidad " + calidad + ")"
url = scrapedurl
thumbnail = ""
plot = ""
logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]")
itemlist.append(Item(channel=item.channel, action="play", title=title, url=url, thumbnail=thumbnail, plot=plot,
folder=False))
return itemlist
def play(item):
logger.info("url=" + item.url)
itemlist = servertools.find_video_items(data=item.url)
for videoitem in itemlist:
videoitem.title = item.title
videoitem.fulltitle = item.fulltitle
videoitem.thumbnail = item.thumbnail
videoitem.channel = item.channel
if "youapihd" in nombre_servidor.lower():
nombre_servidor = "gvideo"
if "pelismundo" in scrapedurl:
data = httptools.downloadpage(scrapedurl, add_referer = True).data
patron = 'sources.*?}],'
bloque = scrapertools.find_single_match(data, patron)
patron = 'file.*?"([^"]+)".*?label:"([^"]+)"'
match = scrapertools.find_multiple_matches(bloque, patron)
for scrapedurl1, scrapedlabel1 in match:
itemtemp.append([scrapedlabel1, scrapedurl1])
itemtemp.sort(key=lambda it: int(it[0].replace("p", "")))
for videoitem in itemtemp:
itemlist.append(Item(channel = item.channel,
action = "play",
extra = "hdvids",
fulltitle = item.title,
server = "directo",
thumbnail = item.thumbnail,
title = "Ver en " + nombre_servidor + " (" + idioma + ") (Calidad " + videoitem[0] + ")",
url = videoitem[1]
))
else:
itemlist.append(Item(channel=item.channel,
action = "play",
extra = "",
fulltitle = item.title,
server = "",
title = "Ver en " + nombre_servidor + " (" + idioma + ") (Calidad " + calidad + ")",
thumbnail = item.thumbnail,
url = scrapedurl,
folder = False
))
itemlist = servertools.get_servers_itemlist(itemlist)
return itemlist