From 3c335f7cea7503336dba1723d2e3a6094efb7eaf Mon Sep 17 00:00:00 2001 From: DiegoT Date: Tue, 23 Oct 2018 21:21:16 +0000 Subject: [PATCH 1/2] xhamster y playpornx fueron corregidos, listado, busqueda, etc. --- plugin.video.alfa/channels/playpornx.py | 38 +++---- plugin.video.alfa/channels/xhamster.py | 139 ++++++++++-------------- 2 files changed, 74 insertions(+), 103 deletions(-) diff --git a/plugin.video.alfa/channels/playpornx.py b/plugin.video.alfa/channels/playpornx.py index 91d726f3..0eb75040 100644 --- a/plugin.video.alfa/channels/playpornx.py +++ b/plugin.video.alfa/channels/playpornx.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import re +import urlparse from core import httptools from core import scrapertools @@ -12,10 +13,12 @@ host = "https://watchfreexxx.net/" def mainlist(item): itemlist = [] - itemlist.append(Item(channel=item.channel, title="Todas", action="lista", - thumbnail='https://s18.postimg.cc/fwvaeo6qh/todas.png', - fanart='https://s18.postimg.cc/fwvaeo6qh/todas.png', - url =host)) + + itemlist.append(Item(channel=item.channel, title="Movies", action="lista", + url = urlparse.urljoin(host, "category/porn-movies/"))) + + itemlist.append(Item(channel=item.channel, title="Scenes", action="lista", + url = urlparse.urljoin(host, "category/xxx-scenes/"))) itemlist.append(Item(channel=item.channel, title="Buscar", action="search", url=host+'?s=', thumbnail='https://s30.postimg.cc/pei7txpa9/buscar.png', @@ -29,34 +32,27 @@ def lista(item): itemlist = [] if item.url == '': item.url = host + data = httptools.downloadpage(item.url).data - data = re.sub(r'"|\n|\r|\t| |
|\s{2,}', "", data) - if item.extra != 'Buscar': - patron = '
.*?href=(.*?)>|\s{2,}', "", data) + + patron = '') + + #Patron + patron = '(?s)
.*?' + patron += '
(.+?)
' + matches = re.compile(patron,re.DOTALL).findall(data) - # Patron #1 - patron = '
' + "([^' - matches = re.compile(patron, re.DOTALL).findall(data) - for scrapedurl, scrapedthumbnail, scrapedtitle in matches: - logger.debug("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") - itemlist.append( - Item(channel=item.channel, action="play", title=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail, - folder=True)) - - # Paginador - patron = "
Próximo
" - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) > 0: - itemlist.append( - Item(channel=item.channel, action="videos", title="Página Siguiente", url=matches[0], thumbnail="", - folder=True, viewmode="movie")) + #Paginador + patron = '(?s)
.*?href="([^"]+)"' + matches = re.compile(patron,re.DOTALL).findall(data) + if len(matches) >0: + itemlist.append( Item(channel=item.channel, action="videos", title="Página Siguiente" , url=matches[0] , thumbnail="" , folder=True, viewmode="movie") ) return itemlist - # SECCION ENCARGADA DE VOLCAR EL LISTADO DE CATEGORIAS CON EL LINK CORRESPONDIENTE A CADA PAGINA - + def categorias(item): logger.info() itemlist = [] - itemlist.append( - Item(channel=item.channel, action="lista", title="Heterosexual", url="http://es.xhamster.com/channels.php")) - itemlist.append( - Item(channel=item.channel, action="lista", title="Transexuales", url="http://es.xhamster.com/channels.php")) - itemlist.append(Item(channel=item.channel, action="lista", title="Gays", url="http://es.xhamster.com/channels.php")) - return itemlist + data = scrapertools.cache_page(item.url) + + data = scrapertools.get_match(data,'(?s)
(.*?)') + + patron = '(?s)
  • .*?([^<]+).*?
  • ' + matches = re.compile(patron,re.DOTALL).findall(data) + for scrapedurl,scrapedtitle in matches: + fullTitle = scrapedtitle.strip() + itemlist.append( Item(channel=item.channel, action="videos" , title=fullTitle , url=scrapedurl)) + + + return itemlist def votados(item): logger.info() itemlist = [] - itemlist.append(Item(channel=item.channel, action="videos", title="Día", - url="http://es.xhamster.com/rankings/daily-top-videos.html", viewmode="movie")) - itemlist.append(Item(channel=item.channel, action="videos", title="Semana", - url="http://es.xhamster.com/rankings/weekly-top-videos.html", viewmode="movie")) - itemlist.append(Item(channel=item.channel, action="videos", title="Mes", - url="http://es.xhamster.com/rankings/monthly-top-videos.html", viewmode="movie")) - itemlist.append(Item(channel=item.channel, action="videos", title="De siempre", - url="http://es.xhamster.com/rankings/alltime-top-videos.html", viewmode="movie")) + itemlist.append( Item(channel=item.channel, action="videos" , title="Día", url=urlparse.urljoin(HOST,"/best/daily"), viewmode="movie")) + itemlist.append( Item(channel=item.channel, action="videos" , title="Semana" , url=urlparse.urljoin(HOST,"/best/weekly"), viewmode="movie")) + itemlist.append( Item(channel=item.channel, action="videos" , title="Mes" , url=urlparse.urljoin(HOST,"/best/monthly"), viewmode="movie")) + itemlist.append( Item(channel=item.channel, action="videos" , title="De siempre" , url=urlparse.urljoin(HOST,"/best/"), viewmode="movie")) return itemlist - -def lista(item): +def vistos(item): logger.info() itemlist = [] - data = scrapertools.downloadpageGzip(item.url) - # data = data.replace("\n","") - # data = data.replace("\t","") - if item.title == "Gays": - data = scrapertools.get_match(data, - '
    ' + item.title + '
    .*?
    (.*?)