areadocumental: fix
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import urllib
|
import urllib
|
||||||
|
import re
|
||||||
|
|
||||||
from core import httptools
|
from core import httptools
|
||||||
from core import scrapertools
|
from core import scrapertools
|
||||||
@@ -25,7 +26,7 @@ def mainlist(item):
|
|||||||
itemlist.append(item.clone(title="Novedades", action="entradas",
|
itemlist.append(item.clone(title="Novedades", action="entradas",
|
||||||
url= host + "/resultados-reciente.php?buscar=&genero=",
|
url= host + "/resultados-reciente.php?buscar=&genero=",
|
||||||
fanart="http://i.imgur.com/Q7fsFI6.png"))
|
fanart="http://i.imgur.com/Q7fsFI6.png"))
|
||||||
itemlist.append(item.clone(title="Destacados", action="entradas",
|
itemlist.append(item.clone(title="Destacados", action="destacados",
|
||||||
url= host + "/resultados-destacados.php?buscar=&genero=",
|
url= host + "/resultados-destacados.php?buscar=&genero=",
|
||||||
fanart="http://i.imgur.com/Q7fsFI6.png"))
|
fanart="http://i.imgur.com/Q7fsFI6.png"))
|
||||||
itemlist.append(item.clone(title="Categorías", action="cat", url= host + "/index.php",
|
itemlist.append(item.clone(title="Categorías", action="cat", url= host + "/index.php",
|
||||||
@@ -37,6 +38,12 @@ def mainlist(item):
|
|||||||
|
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
def get_source(url):
|
||||||
|
logger.info()
|
||||||
|
data = httptools.downloadpage(url).data
|
||||||
|
data = re.sub(r'\n|\r|\t| |<br>|\s{2,}|"|\(|\)', "", data)
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
def configuracion(item):
|
def configuracion(item):
|
||||||
from platformcode import platformtools
|
from platformcode import platformtools
|
||||||
@@ -95,22 +102,19 @@ def indice(item):
|
|||||||
def cat(item):
|
def cat(item):
|
||||||
logger.info()
|
logger.info()
|
||||||
itemlist = []
|
itemlist = []
|
||||||
data = httptools.downloadpage(item.url).data
|
data = get_source(item.url)
|
||||||
bloque = scrapertools.find_single_match(data, '<ul class="menu">(.*?)</nav>')
|
bloques = scrapertools.find_multiple_matches(data, '</li><li class=dropdown>.*?</ul>')
|
||||||
matches = scrapertools.find_multiple_matches(bloque, "<li>.*?<a href='([^']+)'.*?>(.*?)</a>")
|
for bloque in bloques:
|
||||||
for scrapedurl, scrapedtitle in matches:
|
matches = scrapertools.find_multiple_matches(bloque, "<li><a href=(.*?)>(.*?)<")
|
||||||
scrapedurl = host + "/" + scrapedurl
|
for scrapedurl, scrapedtitle in matches:
|
||||||
if not "span" in scrapedtitle:
|
scrapedurl = host + "/" + scrapedurl
|
||||||
scrapedtitle = "[COLOR gold] **" + scrapedtitle + "**[/COLOR]"
|
if not "TODO" in scrapedtitle:
|
||||||
itemlist.append(item.clone(action="entradas", title=scrapedtitle, url=scrapedurl))
|
itemlist.append(item.clone(action="entradas", title=scrapedtitle, url=scrapedurl))
|
||||||
else:
|
|
||||||
scrapedtitle = scrapertools.htmlclean(scrapedtitle)
|
|
||||||
itemlist.append(item.clone(action="entradas", title=scrapedtitle, url=scrapedurl))
|
|
||||||
|
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
def entradas(item):
|
def destacados(item):
|
||||||
logger.info()
|
logger.info()
|
||||||
itemlist = []
|
itemlist = []
|
||||||
item.text_color = color2
|
item.text_color = color2
|
||||||
@@ -161,6 +165,37 @@ def entradas(item):
|
|||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def entradas(item):
|
||||||
|
logger.info()
|
||||||
|
itemlist = []
|
||||||
|
item.text_color = color2
|
||||||
|
|
||||||
|
data = get_source(item.url)
|
||||||
|
|
||||||
|
patron = 'class=imagen.*?href=(.*?)><img.*?src=(.*?) alt=.*?title=(.*?)/>.*?</h2>(\d{4}) (.*?)<.*?space>(.*?)<'
|
||||||
|
matches = scrapertools.find_multiple_matches(data, patron)
|
||||||
|
for scrapedurl, scrapedthumbnail, scrapedtitle, year, genero, scrapedplot in matches:
|
||||||
|
infolab = {'plot': scrapedplot, 'genre': genero}
|
||||||
|
scrapedurl = host + "/" + scrapedurl
|
||||||
|
scrapedthumbnail = host +'/'+ scrapedthumbnail
|
||||||
|
title = scrapedtitle
|
||||||
|
if not year.isspace() and year != "":
|
||||||
|
infolab['year'] = int(year)
|
||||||
|
|
||||||
|
itemlist.append(item.clone(action="findvideos", title=title, fulltitle=title,
|
||||||
|
url=scrapedurl, thumbnail=scrapedthumbnail, infoLabels=infolab, contentTitle =
|
||||||
|
title))
|
||||||
|
|
||||||
|
next_page = scrapertools.find_single_match(data, '<a class=last>.*?</a></li><li><a href=(.*?)>.*?</a>')
|
||||||
|
next_page = scrapertools.htmlclean(next_page)
|
||||||
|
if next_page:
|
||||||
|
itemlist.append(item.clone(action="entradas", title=">> Página Siguiente", url=host + next_page,
|
||||||
|
text_color=color3))
|
||||||
|
|
||||||
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
logger.info()
|
logger.info()
|
||||||
itemlist = []
|
itemlist = []
|
||||||
|
|||||||
Reference in New Issue
Block a user