Update peliculasrey.py
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
import urlparse
|
||||
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from core import servertools
|
||||
from core import tmdb
|
||||
from core.item import Item
|
||||
from platformcode import logger, config
|
||||
|
||||
@@ -16,117 +16,54 @@ def mainlist(item):
|
||||
|
||||
itemlist = []
|
||||
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 = "filtro",
|
||||
title = "Año de Lanzamiento",
|
||||
category = "lanzamiento"
|
||||
))
|
||||
itemlist.append(Item(channel = item.channel,
|
||||
action = "filtro",
|
||||
title = "Idiomas",
|
||||
category = "idioma"
|
||||
))
|
||||
itemlist.append(Item(channel = item.channel,
|
||||
action = "filtro",
|
||||
title = "Por calidad",
|
||||
category = "calidades"
|
||||
))
|
||||
itemlist.append(Item(channel = item.channel,
|
||||
action = "filtro",
|
||||
title = "Por género",
|
||||
category = "generos"
|
||||
))
|
||||
itemlist.append(Item(channel=item.channel, action="search", title="Buscar...", url=host))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def PorFecha(item):
|
||||
logger.info()
|
||||
|
||||
# Descarga la pagina
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = scrapertools.find_single_match(data, '<section class="lanzamiento">(.*?)</section>')
|
||||
|
||||
# Extrae las entradas (carpetas)
|
||||
patron = '<a href="([^"]+).*?title="([^"]+)'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
def filtro(item):
|
||||
logger.info(item.category)
|
||||
itemlist = []
|
||||
|
||||
patron1 = '<section class="%s">(.*?)</section>' %item.category
|
||||
patron2 = '<a href="([^"]+).*?title="([^"]+)'
|
||||
data = httptools.downloadpage(host).data
|
||||
data = scrapertools.find_single_match(data, patron1)
|
||||
matches = scrapertools.find_multiple_matches(data, patron2)
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
title = scrapedtitle.strip()
|
||||
thumbnail = ""
|
||||
plot = ""
|
||||
url = urlparse.urljoin(item.url, scrapedurl)
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="peliculas", title=title, url=url, thumbnail=thumbnail, plot=plot,
|
||||
fulltitle=title, viewmode="movie"))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def Idiomas(item):
|
||||
logger.info()
|
||||
|
||||
# Descarga la pagina
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = scrapertools.find_single_match(data, '<section class="idioma">(.*?)</section>')
|
||||
|
||||
# Extrae las entradas (carpetas)
|
||||
patron = '<a href="([^"]+).*?title="([^"]+)'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
itemlist = []
|
||||
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
title = scrapedtitle.strip()
|
||||
thumbnail = ""
|
||||
plot = ""
|
||||
url = urlparse.urljoin(item.url, scrapedurl)
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="peliculas", title=title, url=url, thumbnail=thumbnail, plot=plot,
|
||||
fulltitle=title, viewmode="movie"))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def calidades(item):
|
||||
logger.info()
|
||||
|
||||
# Descarga la pagina
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = scrapertools.find_single_match(data, '<section class="calidades">(.*?)</section>')
|
||||
|
||||
# Extrae las entradas (carpetas)
|
||||
patron = '<a href="([^"]+).*?title="([^"]+)'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
itemlist = []
|
||||
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
title = scrapedtitle.strip()
|
||||
thumbnail = ""
|
||||
plot = ""
|
||||
url = urlparse.urljoin(item.url, scrapedurl)
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="peliculas", title=title, url=url, thumbnail=thumbnail, plot=plot,
|
||||
fulltitle=title, viewmode="movie"))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def generos(item):
|
||||
logger.info()
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = scrapertools.find_single_match(data, '<section class="generos">(.*?)</section>')
|
||||
patron = '<a href="([^"]+).*?title="([^"]+)'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
itemlist = []
|
||||
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
title = scrapedtitle.strip()
|
||||
thumbnail = ""
|
||||
plot = ""
|
||||
url = urlparse.urljoin(item.url, scrapedurl)
|
||||
if "Adulto" in title and config.get_setting("adult_mode") == 0:
|
||||
if "Adulto" in scrapedtitle and config.get_setting("adult_mode") == 0:
|
||||
continue
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="peliculas", title=title, url=url, thumbnail=thumbnail, plot=plot,
|
||||
fulltitle=title, viewmode="movie"))
|
||||
|
||||
Item(channel=item.channel, action="peliculas", title=scrapedtitle.strip(), url=scrapedurl,
|
||||
viewmode="movie"))
|
||||
return itemlist
|
||||
|
||||
|
||||
|
||||
def search(item, texto):
|
||||
logger.info()
|
||||
texto = texto.replace(" ", "+")
|
||||
item.url = host + "?s=" + texto
|
||||
|
||||
try:
|
||||
# return buscar(item)
|
||||
return peliculas(item)
|
||||
# Se captura la excepción, para no interrumpir al buscador global si un canal falla
|
||||
except:
|
||||
@@ -138,21 +75,20 @@ def search(item, texto):
|
||||
|
||||
def peliculas(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
# Descarga la pagina
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
|
||||
tabla_pelis = scrapertools.find_single_match(data,
|
||||
'class="section col-17 col-main grid-125 overflow clearfix">(.*?)</div></section>')
|
||||
patron = '<img src="([^"]+)" alt="([^"]+).*?href="([^"]+)'
|
||||
|
||||
matches = re.compile(patron, re.DOTALL).findall(tabla_pelis)
|
||||
itemlist = []
|
||||
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for scrapedthumbnail, scrapedtitle, scrapedurl in matches:
|
||||
year = scrapertools.find_single_match(scrapedtitle, "[0-9]{4}")
|
||||
fulltitle = scrapedtitle.replace(scrapertools.find_single_match(scrapedtitle, '\([0-9]+\)' ), "")
|
||||
itemlist.append(Item(channel = item.channel,
|
||||
item.infoLabels['year'] = year
|
||||
itemlist.append(item.clone(channel = item.channel,
|
||||
action = "findvideos",
|
||||
title = scrapedtitle,
|
||||
url = scrapedurl,
|
||||
@@ -160,7 +96,7 @@ def peliculas(item):
|
||||
plot = "",
|
||||
fulltitle = fulltitle
|
||||
))
|
||||
|
||||
tmdb.set_infoLabels(itemlist, True)
|
||||
next_page = scrapertools.find_single_match(data, 'rel="next" href="([^"]+)')
|
||||
if next_page != "":
|
||||
itemlist.append(
|
||||
@@ -172,31 +108,30 @@ def peliculas(item):
|
||||
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
patron = 'hand" rel="([^"]+).*?title="(.*?)".*?<span>([^<]+)</span>.*?</span><span class="q">(.*?)<'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
itemlist = []
|
||||
encontrados = []
|
||||
itemtemp = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
patron = 'hand" rel="([^"]+).*?title="(.*?)".*?<span>([^<]+)</span>.*?</span><span class="q">(.*?)<'
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for scrapedurl, server_name, language, quality in matches:
|
||||
if scrapedurl in encontrados:
|
||||
continue
|
||||
encontrados.append(scrapedurl)
|
||||
language = language.strip()
|
||||
quality = quality.strip()
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
mq = "(" + quality + ")"
|
||||
if "http" in quality:
|
||||
quality = mq = ""
|
||||
titulo = "%s (" + language + ") " + mq
|
||||
itemlist.append(item.clone(channel=item.channel,
|
||||
action = "play",
|
||||
extra = "",
|
||||
fulltitle = item.fulltitle,
|
||||
title = "%s (" + language + ") (" + quality + ")",
|
||||
thumbnail = item.thumbnail,
|
||||
title = titulo,
|
||||
url = scrapedurl,
|
||||
folder = False,
|
||||
language = language,
|
||||
quality = quality
|
||||
))
|
||||
tmdb.set_infoLabels(itemlist, True)
|
||||
itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server.capitalize())
|
||||
if itemlist:
|
||||
itemlist.append(Item(channel=item.channel))
|
||||
|
||||
Reference in New Issue
Block a user