From 8390669bcc1d5a03a469058aa4e49190e9b30f6f Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Fri, 15 Mar 2019 18:07:39 +0100 Subject: [PATCH] CB01 Channel completely rewritten --- plugin.video.alfa/channels/cineblog01.json | 47 +- plugin.video.alfa/channels/cineblog01.py | 534 +++++++++------------ 2 files changed, 263 insertions(+), 318 deletions(-) diff --git a/plugin.video.alfa/channels/cineblog01.json b/plugin.video.alfa/channels/cineblog01.json index cd4a4b8c..8a7786b5 100644 --- a/plugin.video.alfa/channels/cineblog01.json +++ b/plugin.video.alfa/channels/cineblog01.json @@ -1,11 +1,11 @@ { - "id": "cineblog01", - "name": "Cineblog01", + "id": "cb01", + "name": "CB01", "language": ["ita"], "active": true, "adult": false, - "thumbnail": "https://raw.githubusercontent.com/Zanzibar82/images/master/posters/cineblog01.png", - "banner": "https://raw.githubusercontent.com/Zanzibar82/images/master/posters/cineblog01.png", + "thumbnail": "cb01.png", + "banner": "cb01.png", "categories": [ "tvshow", "movie","cult","top channels" @@ -26,6 +26,43 @@ "default": true, "enabled": true, "visible": true - } + }, + { + "id": "include_in_newest_peliculas", + "type": "bool", + "label": "Includi in novità - Film", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "comprueba_enlaces", + "type": "bool", + "label": "Verifica se i link esistono", + "default": false, + "enabled": true, + "visible": true + }, + { + "id": "comprueba_enlaces_num", + "type": "list", + "label": "Numero de link da verificare", + "default": 1, + "enabled": true, + "visible": "eq(-1,true)", + "lvalues": [ "5", "10", "15", "20" ] + }, + { + "id": "filter_languages", + "type": "list", + "label": "Mostra link in lingua...", + "default": 0, + "enabled": true, + "visible": true, + "lvalues": [ + "Non filtrare", + "IT" + ] + } ] } diff --git a/plugin.video.alfa/channels/cineblog01.py b/plugin.video.alfa/channels/cineblog01.py index f92f266c..bbe42c98 100644 --- a/plugin.video.alfa/channels/cineblog01.py +++ b/plugin.video.alfa/channels/cineblog01.py @@ -3,10 +3,11 @@ # Kodi on Demand - Kodi Addon # Canale per cineblog01 # ------------------------------------------------------------ + import re import urlparse -from channels import autoplay +from channels import autoplay, filtertools from core import scrapertools, httptools, servertools, tmdb from core.item import Item from lib import unshortenit @@ -20,11 +21,16 @@ permUrl = httptools.downloadpage('https://www.cb01.uno/', follow_redirects=False host = 'https://www.'+permUrl['location'].replace('https://www.google.it/search?q=site:', '') headers = [['Referer', host]] +IDIOMAS = {'Italiano': 'IT'} +list_language = IDIOMAS.values() list_servers = ['openload', 'streamango', 'wstream'] list_quality = ['HD', 'SD'] +__comprueba_enlaces__ = config.get_setting('comprueba_enlaces', 'cineblog01') +__comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', 'cineblog01') + #esclusione degli articoli 'di servizio' -blacklist = ['Aggiornamento Quotidiano Serie TV', 'Richieste Serie TV', 'CB01.UNO ▶ TROVA L’INDIRIZZO UFFICIALE', 'COMING SOON!', '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): @@ -34,69 +40,125 @@ def mainlist(item): # Main options itemlist = [Item(channel=item.channel, - action="peliculas", - title="[COLOR azure]Novita'[/COLOR]", + action="video", + title="[B]Film[/B]", url=host, - extra="movie", + contentType="movie", thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png"), Item(channel=item.channel, - action="peliculas", - title="[COLOR azure]Alta Definizione [HD][/COLOR]", - url="%s/tag/film-hd-altadefinizione/" % host, - extra="movie", + action="menu", + title="[B] > Menù HD[/B]", + extra='Film HD Streaming', + url=host, + contentType="movie", thumbnail="http://jcrent.com/apple%20tv%20final/HD.png"), Item(channel=item.channel, - action="menuhd", - title="[COLOR azure]Menù HD[/COLOR]", + action="menu", + title="[B] > Film per Genere[/B]", + extra='Film per Genere', url=host, - extra="movie", - thumbnail="http://files.softicons.com/download/computer-icons/disks-icons-by-wil-nichols/png/256x256/Blu-Ray.png"), - Item(channel=item.channel, - action="menugeneros", - title="[COLOR azure]Per Genere[/COLOR]", - url=host, - extra="movie", + contentType="movie", thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png"), Item(channel=item.channel, - action="menuanyos", - title="[COLOR azure]Per Anno[/COLOR]", + action="menu", + title="[B] > Film per Anno[/B]", + extra='Film per Anno', url=host, - extra="movie", + contentType="movie", thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png"), Item(channel=item.channel, action="search", - title="[COLOR yellow]Cerca Film[/COLOR]", - extra="movie", + title="[COLOR blue] > Cerca Film[/COLOR]", + contentType="movie", + url=host, thumbnail="http://dc467.4shared.com/img/fEbJqOum/s7/13feaf0c8c0/Search"), + Item(channel=item.channel, - action="listserie", - title="[COLOR azure]Serie Tv - Novita'[/COLOR]", - url="%s/serietv/" % host, - extra="tvshow", + action="video", + title="[B]Serie TV[/B]", + url=host + '/serietv/', + contentType="episode", + thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png"), + Item(channel=item.channel, + action="menu", + title="[B] > Serie-Tv per Lettera[/B]", + extra='Serie-Tv per Lettera', + url=host + '/serietv/', + contentType="episode", + thumbnail="http://jcrent.com/apple%20tv%20final/HD.png"), + Item(channel=item.channel, + action="menu", + title="[B] > Serie-Tv per Genere[/B]", + extra='Serie-Tv per Genere', + url=host + '/serietv/', + contentType="episode", + thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png"), + Item(channel=item.channel, + action="menu", + title="[B] > Serie-Tv per Anno[/B]", + extra='Serie-Tv per Anno', + url=host + '/serietv/', + contentType="episode", thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png"), Item(channel=item.channel, action="search", - title="[COLOR yellow]Cerca Serie Tv[/COLOR]", - extra="tvshow", - thumbnail="http://dc467.4shared.com/img/fEbJqOum/s7/13feaf0c8c0/Search")] + title="[COLOR blue] > Cerca Serie TV[/COLOR]", + contentType="episode", + url=host + '/serietv/', + thumbnail="http://dc467.4shared.com/img/fEbJqOum/s7/13feaf0c8c0/Search"), + + ] autoplay.show_option(item.channel, itemlist) return itemlist +def menu(item): + itemlist= [] + data = httptools.downloadpage(item.url, headers=headers).data + data = re.sub('\n|\t','',data) + block = scrapertools.get_match(data, item.extra + r'<\/span>.*?(.*?)<\/ul>') + patron = r'href="([^"]+)">(.*?)<\/a>' + matches = re.compile(patron, re.DOTALL).findall(block) + for scrapedurl, scrapedtitle in matches: + itemlist.append( + Item( + channel=item.channel, + title=scrapedtitle, + contentType=item.contentType, + action='video', + 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) + + # Continua la ricerca in caso di errore + except: + import sys + for line in sys.exc_info(): + logger.error("%s" % line) + return [] def newest(categoria): logger.info("[cineblog01.py] newest") itemlist = [] item = Item() - if categoria == "film": + 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 - blocco = scrapertools.get_match(data, 'Ultimi 100 film aggiunti:.*?<\/div>') - patron = '([^<]+)<\/a>' + logger.info("[cineblog01.py] DATA: "+data) + blocco = scrapertools.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: @@ -119,305 +181,136 @@ def newest(categoria): return itemlist -def peliculas(item): - logger.info("[cineblog01.py] peliculas") +def video(item): + logger.info("[cineblog01.py] video") itemlist = [] - if item.url == "": - item.url = host + data = httptools.downloadpage(item.url, headers=headers).data + data = re.sub('\n|\t','',data) + block = scrapertools.get_match(data, r'
(.*?)