From 42d0fddf378ce7d462d80ecbd7270b6c80edced7 Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Fri, 26 Jan 2018 09:02:52 -0500 Subject: [PATCH] vertelenovelas: fix --- plugin.video.alfa/channels/vertelenovelas.py | 55 ++++++++++---------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/plugin.video.alfa/channels/vertelenovelas.py b/plugin.video.alfa/channels/vertelenovelas.py index acaba1a5..df0b926c 100755 --- a/plugin.video.alfa/channels/vertelenovelas.py +++ b/plugin.video.alfa/channels/vertelenovelas.py @@ -11,21 +11,17 @@ from platformcode import logger def mainlist(item): logger.info() - itemlist = [] - itemlist.append(Item(channel=item.channel, title="Catálogo", action="series", url="http://www.vertelenovelas.cc/", + itemlist.append(Item(channel=item.channel, title="Ultimos capítulos", action="ultimos", url="http://www.vertelenovelas.cc/", viewmode="movie")) itemlist.append(Item(channel=item.channel, title="Buscar", action="search")) - return itemlist def search(item, texto): logger.info() - texto = texto.replace(" ", "+") item.url = "http://www.vertelenovelas.cc/ajax/autocompletex.php?q=" + texto - try: return series(item) @@ -37,16 +33,38 @@ def search(item, texto): return [] + +def ultimos(item): + logger.info() + itemlist = [] + data = httptools.downloadpage(item.url).data + patron = '' + matches = re.compile(patron, re.DOTALL).findall(data) + for match in matches: + title = scrapertools.find_single_match(match, '([^<]+)') + if title == "": + title = scrapertools.find_single_match(match, '([^<]+)') + url = urlparse.urljoin(item.url, scrapertools.find_single_match(match, '

  • ([^<]+)' - matches = re.compile(patron, re.DOTALL).findall(data) - for scrapedurl, scrapedtitle in matches: title = scrapertools.htmlclean(scrapedtitle) - plot = "" - thumbnail = "" url = urlparse.urljoin(item.url, scrapedurl) - - logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]") itemlist.append( - Item(channel=item.channel, action="findvideos", title=title, url=url, thumbnail=thumbnail, plot=plot, + Item(channel=item.channel, action="findvideos", title=title, url=url, folder=True, fulltitle=title)) - return itemlist def findvideos(item): logger.info() data = httptools.downloadpage(item.url).data - pattern = 'data-id="([^"]+)"' list_servers = re.compile(pattern, re.DOTALL).findall(data) - - logger.debug("llist_servers %s" % list_servers) list_urls = [] - for _id in list_servers: post = "id=%s" % _id data = httptools.downloadpage("http://www.vertelenovelas.cc/goto/", post=post).data list_urls.append(scrapertools.find_single_match(data, 'document\.location = "([^"]+)";')) - from core import servertools itemlist = servertools.find_video_items(data=", ".join(list_urls)) for videoitem in itemlist: # videoitem.title = item.title videoitem.channel = item.channel - return itemlist