# -*- coding: utf-8 -*- #------------------------------------------------------------ import urlparse,urllib2,urllib,re import os, sys from platformcode import config, logger from core import scrapertools from core.item import Item from core import servertools from core import httptools host = 'https://www.youporn.com' def mainlist(item): logger.info() itemlist = [] itemlist.append( Item(channel=item.channel, title="Nuevas", action="lista", url=host + "/browse/time/")) itemlist.append( Item(channel=item.channel, title="Mas Vistas", action="lista", url=host + "/browse/views/")) itemlist.append( Item(channel=item.channel, title="Mejor valorada", action="lista", url=host + "/top_rated/")) itemlist.append( Item(channel=item.channel, title="Canal", action="categorias", url=host + "/channels/most_popular/")) itemlist.append( Item(channel=item.channel, title="Pornstars", action="catalogo", url=host + "/pornstars/most_popular/")) itemlist.append( Item(channel=item.channel, title="Categorias", action="categorias", url=host + "/categories/alphabetical/")) itemlist.append( Item(channel=item.channel, title="Buscar", action="search")) return itemlist def search(item, texto): logger.info() texto = texto.replace(" ", "+") item.url = host + "/search/?query=%s" % texto try: return lista(item) except: import sys for line in sys.exc_info(): logger.error("%s" % line) return [] def catalogo(item): logger.info() itemlist = [] data = httptools.downloadpage(item.url).data data = re.sub(r"\n|\r|\t| |
", "", data) data1 = scrapertools.get_match(data,'>Most Popular Pornstars<(.*?)') patron = '", "", data) if item.title == "Canal": data = scrapertools.get_match(data,'>All(.*?)') if item.title == "Categorias": data = scrapertools.get_match(data,'
(.*?)>Popular by Country') patron = '", "", data) patron = '