KoD 0.5 -riscritti molti canali per cambiamenti nella struttura stessa di kod -altre robe carine
79 lines
2.8 KiB
Python
Executable File
79 lines
2.8 KiB
Python
Executable File
# -*- 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.porndish.com'
|
|
|
|
|
|
def mainlist(item):
|
|
logger.info()
|
|
itemlist = []
|
|
itemlist.append( Item(channel=item.channel, title="Nuevos" , action="lista", url=host))
|
|
itemlist.append( Item(channel=item.channel, title="Canal" , action="categorias", url=host))
|
|
itemlist.append( Item(channel=item.channel, title="Buscar", action="search"))
|
|
return itemlist
|
|
|
|
|
|
def search(item, texto):
|
|
logger.info()
|
|
texto = texto.replace(" ", "+")
|
|
item.url = host + "/?s=%s" % texto
|
|
try:
|
|
return lista(item)
|
|
except:
|
|
import sys
|
|
for line in sys.exc_info():
|
|
logger.error("%s" % line)
|
|
return []
|
|
|
|
|
|
def categorias(item):
|
|
logger.info()
|
|
itemlist = []
|
|
data = httptools.downloadpage(item.url).data
|
|
data = re.sub(r"\n|\r|\t| |<br>|<br/>", "", data)
|
|
patron = '<li id="menu-item-\d+".*?'
|
|
patron += '<a href="([^"]+)">([^<]+)<'
|
|
matches = re.compile(patron,re.DOTALL).findall(data)
|
|
for scrapedurl,scrapedtitle in matches:
|
|
scrapedplot = ""
|
|
scrapedurl = urlparse.urljoin(item.url,scrapedurl)
|
|
scrapedthumbnail = ""
|
|
itemlist.append( Item(channel=item.channel, action="lista", title=scrapedtitle, url=scrapedurl,
|
|
fanart=scrapedthumbnail, thumbnail=scrapedthumbnail , plot=scrapedplot) )
|
|
return itemlist
|
|
|
|
|
|
def lista(item):
|
|
logger.info()
|
|
itemlist = []
|
|
data = httptools.downloadpage(item.url).data
|
|
data = re.sub(r"\n|\r|\t| |<br>|<br/>", "", data)
|
|
data = scrapertools.find_single_match(data, 'archive-body">(.*?)<div class="g1-row g1-row-layout-page g1-prefooter">')
|
|
patron = '<article class=.*?'
|
|
patron += 'src="([^"]+)".*?'
|
|
patron += 'title="([^"]+)".*?'
|
|
patron += '<a href="([^"]+)" rel="bookmark">'
|
|
matches = re.compile(patron,re.DOTALL).findall(data)
|
|
for scrapedthumbnail,scrapedtitle,scrapedurl in matches:
|
|
thumbnail = scrapedthumbnail
|
|
plot = ""
|
|
itemlist.append( Item(channel=item.channel, action="findvideos", title=scrapedtitle, url=scrapedurl,
|
|
fanart=thumbnail, thumbnail=thumbnail, plot=plot, contentTitle = scrapedtitle))
|
|
next_page = scrapertools.find_single_match(data, '<a class="g1-delta g1-delta-1st next" href="([^"]+)">Next</a>')
|
|
if next_page:
|
|
next_page = urlparse.urljoin(item.url,next_page)
|
|
itemlist.append( Item(channel=item.channel, action="lista", title="Página Siguiente >>", text_color="blue",
|
|
url=next_page) )
|
|
return itemlist
|
|
|
|
|
|
|
|
|