From f04f584b392b25a816bd5d94394eb19bb572bab3 Mon Sep 17 00:00:00 2001 From: mac12m99 Date: Sat, 30 Mar 2019 15:33:25 +0100 Subject: [PATCH] fix cineblog01 and some changes to support --- plugin.video.alfa/channels/cineblog01.py | 321 ++++------------------- plugin.video.alfa/channels/support.py | 38 ++- 2 files changed, 77 insertions(+), 282 deletions(-) diff --git a/plugin.video.alfa/channels/cineblog01.py b/plugin.video.alfa/channels/cineblog01.py index 1e972ef9..d93edc7d 100644 --- a/plugin.video.alfa/channels/cineblog01.py +++ b/plugin.video.alfa/channels/cineblog01.py @@ -6,7 +6,7 @@ import re import urlparse -from channels import autoplay, filtertools +from channels import autoplay, filtertools, support from core import scrapertoolsV2, httptools, servertools, tmdb from core.item import Item from lib import unshortenit @@ -24,13 +24,13 @@ headers = [['Referer', host]] IDIOMAS = {'Italiano': 'IT'} list_language = IDIOMAS.values() list_servers = ['openload', 'streamango', 'wstream'] -list_quality = ['HD', 'SD'] +list_quality = ['HD', 'default'] __comprueba_enlaces__ = config.get_setting('comprueba_enlaces', 'cineblog01') __comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', 'cineblog01') #esclusione degli articoli 'di servizio' -blacklist = ['BENVENUTI ', 'Richieste Serie TV', 'CB01.UNO ▶ TROVA L’INDIRIZZO UFFICIALE ', 'Aggiornamento Quotidiano Serie TV', 'OSCAR 2019 ▶ CB01.UNO: Vota il tuo film preferito! 🎬'] +blacklist = ['BENVENUTI', 'Richieste Serie TV', 'CB01.UNO ▶ TROVA L’INDIRIZZO UFFICIALE ', 'Aggiornamento Quotidiano Serie TV', 'OSCAR 2019 ▶ CB01.UNO: Vota il tuo film preferito! 🎬'] def mainlist(item): @@ -39,79 +39,34 @@ def mainlist(item): autoplay.init(item.channel, list_servers, list_quality) # Main options - itemlist = [Item(channel=item.channel, - action="video", - title="[B]Film[/B]", - url=host, - contentType="movie"), - Item(channel=item.channel, - action="menu", - title="[B] > Film HD[/B]", - extra='Film HD Streaming', - url=host, - contentType="movie"), - Item(channel=item.channel, - action="menu", - title="[B] > Film per Genere[/B]", - extra='Film per Genere', - url=host, - contentType="movie"), - Item(channel=item.channel, - action="menu", - title="[B] > Film per Anno[/B]", - extra='Film per Anno', - url=host, - contentType="movie"), - Item(channel=item.channel, - action="search", - title="[COLOR blue] > Cerca Film[/COLOR]", - contentType="movie", - url=host,), - - Item(channel=item.channel, - action="video", - title="[B]Serie TV[/B]", - url=host + '/serietv/', - contentType="episode"), - Item(channel=item.channel, - action="menu", - title="[B] > Serie-Tv per Lettera[/B]", - extra='Serie-Tv per Lettera', - url=host + '/serietv/', - contentType="episode"), - Item(channel=item.channel, - action="menu", - title="[B] > Serie-Tv per Genere[/B]", - extra='Serie-Tv per Genere', - url=host + '/serietv/', - contentType="episode"), - Item(channel=item.channel, - action="menu", - title="[B] > Serie-Tv per Anno[/B]", - extra='Serie-Tv per Anno', - url=host + '/serietv/', - contentType="episode"), - Item(channel=item.channel, - action="search", - title="[COLOR blue] > Cerca Serie TV[/COLOR]", - contentType="episode", - url=host + '/serietv/'), - ] + itemlist = [] + support.menu(itemlist, '[B]Film[/B]', 'peliculas', host) + support.menu(itemlist, '[B] > HD [/B]', 'menu', host, args="Film HD Streaming") + support.menu(itemlist, '[B] > Per genere [/B]', 'menu', host, args="Film per Genere") + support.menu(itemlist, '[B] > Per anno [/B]', 'menu', host, args="Film per Anno") + support.menu(itemlist, '[COLOR blue] > Cerca [/COLOR]', 'search', host) + + support.menu(itemlist, '[B]Serie TV[/B]', 'peliculas', host + '/serietv/', contentType='episode') + support.menu(itemlist, '[B] > Per lettera[/B]', 'menu', host + '/serietv/', contentType='episode', args="Serie-Tv per Lettera") + support.menu(itemlist, '[B] > Per genere[/B]', 'menu', host + '/serietv/', contentType='episode', args="Serie-Tv per Genere") + support.menu(itemlist, '[B] > Per Anno[/B]', 'menu', host + '/serietv/', contentType='episode', args="Serie-Tv per Anno") + support.menu(itemlist, '[COLOR blue] > Cerca [/COLOR]', 'search', host + '/serietv/', contentType='episode') autoplay.show_option(item.channel, itemlist) # auto thumb - itemlist=thumb(itemlist) + itemlist = thumb(itemlist) return itemlist + def menu(item): itemlist= [] data = httptools.downloadpage(item.url, headers=headers).data - data = re.sub('\n|\t','',data) - block = scrapertoolsV2.get_match(data, item.extra + r'<\/span>.*?(.*?)<\/ul>') + data = re.sub('\n|\t', '', data) + block = scrapertoolsV2.get_match(data, item.args + r'<\/span>.*?(.*?)<\/ul>') logger.info('MENU BLOCK= '+block) - patron = r'href=([^>]+)>(.*?)<\/a>' + patron = r'href="?([^">]+)"?>(.*?)<\/a>' matches = re.compile(patron, re.DOTALL).findall(block) for scrapedurl, scrapedtitle in matches: itemlist.append( @@ -119,18 +74,19 @@ def menu(item): channel=item.channel, title=scrapedtitle, contentType=item.contentType, - action='video', + action='peliculas', url=host + scrapedurl ) ) return itemlist + def search(item, text): logger.info("[cineblog01.py] " + item.url + " search " + text) try: item.url = item.url + "/?s=" + text - return video(item) + return peliculas(item) # Continua la ricerca in caso di errore except: @@ -139,179 +95,47 @@ def search(item, text): logger.error("%s" % line) return [] + def newest(categoria): logger.info("[cineblog01.py] newest") itemlist = [] item = Item() - if categoria == "peliculas": - item.url = host + '/lista-film-ultimi-100-film-aggiunti/' - item.extra = "movie" - try: - # Carica la pagina - data = httptools.downloadpage(item.url).data - logger.info("[cineblog01.py] DATA: "+data) - blocco = scrapertoolsV2.get_match(data, r'Ultimi 100 film aggiunti:.*?<\/td>') - patron = r']+)>([^<]+)<\/a>' - matches = re.compile(patron, re.DOTALL).findall(blocco) - - for scrapedurl, scrapedtitle in matches: - itemlist.append( - Item(channel=item.channel, - action="findvideos", - contentType="movie", - fulltitle=scrapedtitle, - show=scrapedtitle, - title=scrapedtitle, - text_color="azure", - url=scrapedurl, - extra=item.extra, - viewmode="movie_with_plot")) - except: - import sys - for line in sys.exc_info(): - logger.error("{0}".format(line)) - return [] - return itemlist + item.url = host + '/lista-film-ultimi-100-film-aggiunti/' + return support.scrape(item, r']+)>([^<([]+)(?:\[([A-Z]+)\])?\s\(([0-9]{4})\)<\/a>', + ['url', 'title', 'quality', 'year'], + patron_block=r'Ultimi 100 film aggiunti:.*?<\/td>') -def video(item): - logger.info("[cineblog01.py] video") - itemlist = [] - - data = httptools.downloadpage(item.url, headers=headers).data - data = re.sub('\n|\t','',data) - # block = scrapertoolsV2.get_match(data, r'
(.*?)