# -*- coding: utf-8 -*-
import re
import urlparse
from channelselector import get_thumbnail_path
from core import logger
from core import scrapertools
from core import servertools
from core.item import Item
from core.tmdb import Tmdb
from servers.decrypters import expurl
def agrupa_datos(data):
## Agrupa los datos
data = re.sub(r'\n|\r|\t| |
|', '', data)
data = re.sub(r'\s+', ' ', data)
data = re.sub(r'>\s<', '><', data)
return data
def mainlist(item):
logger.info()
thumb_buscar = get_thumbnail_path() + "thumb_search.png"
itemlist = []
itemlist.append(Item(channel=item.channel, title="Últimas agregadas", action="agregadas",
url="http://www.descargacineclasico.net/", viewmode="movie_with_plot"))
itemlist.append(Item(channel=item.channel, title="Listado por género", action="porGenero",
url="http://www.descargacineclasico.net/"))
itemlist.append(
Item(channel=item.channel, title="Buscar", action="search", url="http://www.descargacineclasico.net/",
thumbnail=thumb_buscar))
return itemlist
def porGenero(item):
logger.info()
itemlist = []
data = scrapertools.cache_page(item.url)
logger.info("data=" + data)
patron = '
'
data = re.compile(patron, re.DOTALL).findall(data)
patron = '.*?href="([^"]+).*?>([^<]+)'
matches = re.compile(patron, re.DOTALL).findall(data[0])
for url, genero in matches:
itemlist.append(
Item(channel=item.channel, action="agregadas", title=genero, url=url, viewmode="movie_with_plot"))
return itemlist
def search(item, texto):
logger.info()
'''
texto_get = texto.replace(" ","%20")
texto_post = texto.replace(" ","+")
item.url = "http://pelisadicto.com/buscar/%s?search=%s" % (texto_get,texto_post)
'''
texto = texto.replace(" ", "+")
item.url = "http://www.descargacineclasico.net/?s=" + texto
try:
return agregadas(item)
# Se captura la excepci?n, para no interrumpir al buscador global si un canal falla
except:
import sys
for line in sys.exc_info():
logger.error("%s" % line)
return []
def agregadas(item):
logger.info()
itemlist = []
'''
# Descarga la pagina
if "?search=" in item.url:
url_search = item.url.split("?search=")
data = scrapertools.cache_page(url_search[0], url_search[1])
else:
data = scrapertools.cache_page(item.url)
logger.info("data="+data)
'''
data = scrapertools.cache_page(item.url)
logger.info("data=" + data)
# Extrae las entradas
fichas = re.sub(r"\n|\s{2}", "", scrapertools.get_match(data, '(.*?)wp-pagenavi'))
#
#
patron = '([^<]+)' # plot
matches = re.compile(patron, re.DOTALL).findall(fichas)
for url, title, thumbnail, plot in matches:
title = title[0:title.find("Descargar y ver Online")]
url = urlparse.urljoin(item.url, url)
thumbnail = urlparse.urljoin(url, thumbnail)
itemlist.append(Item(channel=item.channel, action="findvideos", title=title + " ", fulltitle=title, url=url,
thumbnail=thumbnail, plot=plot, show=title))
# Paginación
try:
#
patron_nextpage = r'