# -*- coding: utf-8 -*- import re import urlparse from core import scrapertools from core import servertools from core.item import Item from platformcode import logger 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")) return itemlist def PorFecha(item): logger.info() # Descarga la pagina data = scrapertools.cache_page(item.url) data = scrapertools.find_single_match(data, '
(.*?)
') logger.info("data=" + data) # Extrae las entradas (carpetas) patron = '(.*?)') logger.info("data=" + data) # Extrae las entradas (carpetas) patron = '(.*?)') logger.info("data=" + data) # Extrae las entradas (carpetas) patron = '(.*?)') logger.info("data=" + data) # Extrae las entradas (carpetas) patron = '(.*?)') patron = '([^([^<]+).*?(.*?)<' matches = re.compile(patron, re.DOTALL).findall(data) itemlist = [] 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 return itemlist