From 3e699940c5209f1945da282cfe93f17d84b57fcc Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Wed, 1 Aug 2018 17:37:34 -0500 Subject: [PATCH] goodpelis: nuevo canal --- plugin.video.alfa/channels/goodpelis.json | 54 ++++ plugin.video.alfa/channels/goodpelis.py | 354 ++++++++++++++++++++++ 2 files changed, 408 insertions(+) create mode 100644 plugin.video.alfa/channels/goodpelis.json create mode 100644 plugin.video.alfa/channels/goodpelis.py diff --git a/plugin.video.alfa/channels/goodpelis.json b/plugin.video.alfa/channels/goodpelis.json new file mode 100644 index 00000000..e068d4be --- /dev/null +++ b/plugin.video.alfa/channels/goodpelis.json @@ -0,0 +1,54 @@ +{ + "id": "goodpelis", + "name": "GoodPelis", + "active": true, + "adult": false, + "language": ["lat"], + "thumbnail": "http://goodpelis.net/wp-content/uploads/2017/11/Logo-GP.png", + "banner": "", + "categories": [ + "movie" + ], + "settings": [ + { + "id": "include_in_global_search", + "type": "bool", + "label": "Incluir en busqueda global", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_latino", + "type": "bool", + "label": "Incluir en Novedades - Latino", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_peliculas", + "type": "bool", + "label": "Incluir en Novedades - Peliculas", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_infantiles", + "type": "bool", + "label": "Incluir en Novedades - Infantiles", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_terror", + "type": "bool", + "label": "Incluir en Novedades - Terror", + "default": true, + "enabled": true, + "visible": true + } + ] +} diff --git a/plugin.video.alfa/channels/goodpelis.py b/plugin.video.alfa/channels/goodpelis.py new file mode 100644 index 00000000..c7aa3349 --- /dev/null +++ b/plugin.video.alfa/channels/goodpelis.py @@ -0,0 +1,354 @@ +# -*- coding: utf-8 -*- +# -*- Channel GoodPelis -*- +# -*- Created for Alfa-addon -*- +# -*- By the Alfa Develop Group -*- + +import re + +from core import httptools +from core import scrapertools +from core import servertools +from core import tmdb +from core.item import Item +from platformcode import config, logger +from channelselector import get_thumb + +host = 'https://goodpelis.net/' + + +def mainlist(item): + logger.info() + + itemlist = [] + + itemlist.append(item.clone(title="Peliculas", + action="menu_peliculas", + thumbnail=get_thumb('movies', auto=True), + )) + + # itemlist.append(item.clone(title="Series", + # action="menu_series", + # thumbnail=get_thumb('tvshows', auto=True), + # )) + + itemlist.append(item.clone(title="Buscar", action="search", + thumbnail=get_thumb('search', auto=True), + url=host + '?s=' + )) + + return itemlist + + +def menu_peliculas(item): + logger.info() + + itemlist = [] + + itemlist.append(item.clone(title="Todas", + action="list_all", + thumbnail=get_thumb('all', auto=True), + url=host + 'page/1/?s' + )) + + itemlist.append(item.clone(title="Generos", + action="seccion", + url=host + 'page/1/?s', + thumbnail=get_thumb('genres', auto=True), + seccion='generos-pelicula' + )) + + itemlist.append(item.clone(title="Por Año", + action="seccion", + url=host + 'page/1/?s', + thumbnail=get_thumb('year', auto=True), + seccion='fecha-estreno' + )) + + itemlist.append(item.clone(title="Calidad", + action="seccion", + url=host + 'page/1/?s', + thumbnail=get_thumb('quality', auto=True), + seccion='calidad' + )) + + return itemlist + + +def menu_series(item): + logger.info() + + itemlist = [] + + itemlist.append(item.clone(title="Todas", + action="list_all", thumbnail=get_thumb('all', auto=True), + url=host + 'series/page/1/', + )) + + itemlist.append(item.clone(title="Generos", + action="seccion", + url=host + 'series/page/1/', + thumbnail=get_thumb('genres', auto=True), + seccion='generos-serie' + )) + + itemlist.append(item.clone(title="Por Año", + action="seccion", + url=host + 'series/page/1/', + thumbnail=get_thumb('year', auto=True), + seccion='series-lanzamiento' + )) + + return itemlist + + +def list_all(item): + logger.info() + + itemlist = [] + data = get_source(item.url) + patron = 'class=item.*?
(.*?)<') + title = contentTitle + ' (%s)' % quality + + year = scrapedyear + + if 'series' in item.url or 'series' in url: + action = 'seasons' + contentSerieName = contentTitle + quality = '' + new_item = Item(channel=item.channel, + action=action, + title=title, + url=url, + thumbnail=thumbnail, + plot=plot, + quality=quality, + infoLabels={'year': year} + ) + if 'series' not in item.url: + new_item.contentTitle = contentTitle + else: + new_item.contentSerieName = contentSerieName + if 'temporada' not in url: + itemlist.append(new_item) + + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + # Paginacion + + if itemlist != []: + next_page = scrapertools.find_single_match(data, + '
Siguiente') + if next_page != '': + itemlist.append(Item(channel=item.channel, + action="list_all", + title='Siguiente >>>', + url=next_page, + )) + return itemlist + + +def seccion(item): + logger.info() + itemlist = [] + data = get_source(item.url) + if item.seccion == 'generos-pelicula': + patron = '
  • (.*?<\/a> .*?)<\/span><\/li>' + elif item.seccion == 'generos-serie': + patron = '
  • (.*?<\/a> .*?)<\/span><\/li>' + elif item.seccion in ['fecha-estreno', 'series-lanzamiento']: + patron = '
  • (.*?)<\/a>' % host + elif item.seccion == 'calidad': + patron = '
  • (.*?)<\/a>' % host + matches = re.compile(patron, re.DOTALL).findall(data) + for scrapedurl, scrapedtitle in matches: + thumbnail = '' + if 'generos' in item.seccion: + cantidad = scrapertools.find_single_match(scrapedtitle, '(\d+)') + title = scrapertools.find_single_match(scrapedtitle, '(.*?)<') + url = scrapedurl + title = scrapertools.decodeHtmlentities(title) + title = title + ' (%s)' % cantidad + elif item.seccion in ['series-lanzamiento', 'fecha-estreno', 'calidad']: + title = scrapedtitle + url = '%s%s%s' % (host, item.seccion, scrapedurl) + + itemlist.append(item.clone(action='list_all', + title=title, + url=url, + thumbnail=thumbnail + )) + return itemlist + + +def seasons(item): + logger.info() + + itemlist = [] + + data = get_source(item.url) + patron = '.*?- Temporada (.*?)<\/span>' + matches = re.compile(patron, re.DOTALL).findall(data) + + for temporada in matches: + title = 'Temporada %s' % temporada + contentSeasonNumber = temporada + item.infoLabels['season'] = contentSeasonNumber + itemlist.append(item.clone(action='episodiosxtemp', + title=title, + contentSeasonNumber=contentSeasonNumber + )) + + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + if config.get_videolibrary_support() and len(itemlist) > 0: + itemlist.append(Item(channel=item.channel, + title='[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]', + url=item.url, + action="add_serie_to_library", + extra="episodios", + contentSerieName=item.contentSerieName, + contentSeasonNumber=contentSeasonNumber + )) + + return itemlist + + +def episodios(item): + logger.info() + + itemlist = [] + data = get_source(item.url) + + patron = '
  • %s.*?x.*?(\d+)<\/div>.*? (.*?)<\/a>.*?<\/i>' % temporada + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedep, scrapedurl, scrapedtitle in matches: + title = temporada + 'x%s %s' % (scrapedep, scrapedtitle) + url = scrapedurl + contentEpisodeNumber = scrapedep + item.infoLabels['episode'] = contentEpisodeNumber + itemlist.append(item.clone(action='findvideos', + title=title, + url=url, + contentEpisodeNumber=contentEpisodeNumber, + )) + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + return itemlist + + +def findvideos(item): + logger.info() + url_list = [] + itemlist = [] + duplicados = [] + data = get_source(item.url) + src = data + patron = '<(?:iframe|IFRAME).*?(?:src|SRC)=(.*?) (?:scrolling|frameborder|FRAMEBORDER)' + matches = re.compile(patron, re.DOTALL).findall(data) + + for url in matches: + lang = 'LAT' + quality = item.quality + title = '[%s] [%s]' + if url != '': + itemlist.append(item.clone(title=title, url=url, action='play', language=lang)) + + itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % (i.server, i.language)) + + if item.infoLabels['mediatype'] == 'movie': + if config.get_videolibrary_support() and len(itemlist) > 0 and item.extra != 'findvideos': + itemlist.append(Item(channel=item.channel, + title='[COLOR yellow]Añadir esta pelicula a la videoteca[/COLOR]', + url=item.url, + action="add_pelicula_to_library", + extra="findvideos", + contentTitle=item.contentTitle + )) + + return itemlist + + +def search(item, texto): + logger.info() + texto = texto.replace(" ", "+") + item.url = item.url + texto + try: + if texto != '': + return list_all(item) + else: + return [] + except: + import sys + for line in sys.exc_info(): + logger.error("%s" % line) + return [] + + +def newest(categoria): + logger.info() + itemlist = [] + item = Item() + try: + if categoria in ['peliculas', 'latino']: + item.url = host + 'page/1/?s' + + elif categoria == 'infantiles': + item.url = host + 'category/animacion/' + + elif categoria == 'terror': + item.url = host + 'category/terror/' + + itemlist = list_all(item) + if itemlist[-1].title == 'Siguiente >>>': + itemlist.pop() + except: + import sys + for line in sys.exc_info(): + logger.error("{0}".format(line)) + return [] + + return itemlist + + +def get_source(url): + logger.info() + data = httptools.downloadpage(url).data + data = re.sub(r'"|\n|\r|\t| |
    |\s{2,}', "", data) + return data