diff --git a/channels.json b/channels.json index f1e8d571..d0096f4d 100644 --- a/channels.json +++ b/channels.json @@ -17,13 +17,10 @@ "casacinemainfo": "https://www.casacinema.info", "cb01anime": "https://www.cineblog01.ink", "cinemalibero": "https://www.cinemalibero.best", - "cinemastreaming": "https://cinemastreaming.icu", "documentaristreamingda": "https://documentari-streaming-da.com", "dreamsub": "https://www.dreamsub.stream", "eurostreaming": "https://eurostreaming.pink", - "eurostreaming_video": "https://www.eurostreaming.best", "fastsubita": "http://fastsubita.com", - "ffilms":"https://ffilms.org", "filmigratis": "https://filmigratis.net", "filmgratis": "https://www.filmaltadefinizione.net", "filmontv": "https://www.comingsoon.it", diff --git a/channels/cineblog01.py b/channels/cineblog01.py index df4d39c8..e30d07da 100644 --- a/channels/cineblog01.py +++ b/channels/cineblog01.py @@ -9,9 +9,8 @@ from core import scrapertoolsV2, httptools, servertools, tmdb, support from core.item import Item from lib import unshortenit from platformcode import logger, config -from specials import autoplay -#impostati dinamicamente da getUrl() +#impostati dinamicamente da findhost() host = "" headers = "" @@ -39,14 +38,12 @@ blacklist = ['BENVENUTI', 'Richieste Serie TV', 'CB01.UNO ▶ TROVA L’ @support.menu def mainlist(item): findhost() - film = '' - filmSub = [ + film = [ ('HD', ['', 'menu', 'Film HD Streaming']), ('Generi', ['', 'menu', 'Film per Genere']), ('Anni', ['', 'menu', 'Film per Anno']) ] - tvshow = '/serietv/' - tvshowSub = [ + tvshow = ['/serietv/', ('Aggiornamenti serie tv', ['/serietv/aggiornamento-quotidiano-serie-tv/', 'last']), ('Per Lettera', ['/serietv/', 'menu', 'Serie-Tv per Lettera']), ('Per Genere', ['/serietv/aggiornamento-quotidiano-serie-tv/', 'menu', 'Serie-Tv per Genere']), @@ -56,31 +53,14 @@ def mainlist(item): return locals() +@support.scrape def menu(item): findhost() - itemlist= [] - data = httptools.downloadpage(item.url, headers=headers).data - data = re.sub('\n|\t', '', data) - block = scrapertoolsV2.find_single_match(data, item.args + r'<\/span>.*?(.*?)<\/ul>') - support.log('MENU BLOCK= ',block) - 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='peliculas', - url=host + scrapedurl - ) - ) - - return support.thumb(itemlist) - - - + patronBlock = item.args + r'<\/span>.*?(.*?)<\/ul>' + patronMenu = r'href="?(?P[^">]+)"?>(?P.*?)<\/a>' + action = 'peliculas' + return locals() def newest(categoria): @@ -150,13 +130,11 @@ def last(item): @support.scrape def peliculas(item): - support.log() - if item.contentType == 'movie' or '/serietv/' not in item.url: + if '/serietv/' not in item.url: patron = r'<div class="?card-image"?>.*?<img src="?(?P<thumb>[^" ]+)"? alt.*?<a href="?(?P<url>[^" >]+)(?:\/|")>(?P<title>[^<[(]+)(?:\[(?P<quality>[A-Za-z0-9/-]+)])? (?:\((?P<year>[0-9]{4})\))?.*?<strong>(?P<genre>[^<>&]+).*?DURATA (?P<duration>[0-9]+).*?<br(?: /)?>(?P<plot>[^<>]+)' action = 'findvideos' else: patron = r'div class="card-image">.*?<img src="(?P<thumb>[^ ]+)" alt.*?<a href="(?P<url>[^ >]+)">(?P<title>[^<[(]+)<\/a>.*?<strong><span style="[^"]+">(?P<genre>[^<>0-9(]+)\((?P<year>[0-9]{4}).*?</(?:p|div)>(?P<plot>.*?)</div' - listGroups = ['thumb', 'url', 'title', 'genre', 'year', 'plot'] action = 'episodios' patronBlock=[r'<div class="?sequex-page-left"?>(.*?)<aside class="?sequex-page-right"?>', diff --git a/channels/toonitalia.py b/channels/toonitalia.py index e1bfc373..ccb8cb76 100644 --- a/channels/toonitalia.py +++ b/channels/toonitalia.py @@ -31,18 +31,6 @@ def mainlist(item): return locals() -def search(item, texto): - logger.info("[toonitalia.py] " + item.url + " search " + texto) - item.url = host + "/?s=" + texto - item.args = 'search' - try: - return peliculas(item) - - except: - import sys - for line in sys.exc_info(): - logger.error("%s" % line) - return [] @support.scrape def peliculas(item): @@ -78,6 +66,7 @@ def check(item): itemlist = episodios(item) return itemlist + @support.scrape def episodios(item): anime = True @@ -93,4 +82,3 @@ def episodios(item): def findvideos(item): return support.server(item, item.url if item.contentType != 'movie' else httptools.downloadpage(item.url, headers=headers).data ) - \ No newline at end of file diff --git a/core/support.py b/core/support.py index 2f88cb02..4439bf73 100644 --- a/core/support.py +++ b/core/support.py @@ -94,6 +94,8 @@ def color(text, color): def search(channel, item, texto): log(item.url + " search " + texto) + if 'findhost' in dir(channel): + channel.findhost() item.url = channel.host + "/?s=" + texto try: return channel.peliculas(item) @@ -106,28 +108,23 @@ def search(channel, item, texto): def dbg(): - import webbrowser - webbrowser.open('http://localhost:5555') import web_pdb; + if not web_pdb.WebPdb.active_instance: + import webbrowser + webbrowser.open('http://localhost:5555') web_pdb.set_trace() -def scrape2(item, patron = '', listGroups = [], headers="", blacklist="", data="", patronBlock="", - patronNext="", action="findvideos", addVideolibrary = True, typeContentDict={}, typeActionDict={}): + +def regexDbg(item, patron, headers, data=''): import json, urllib2, webbrowser url = 'https://regex101.com' - html = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True).data.replace("'", '"') - html = re.sub('\n|\t', ' ', html) - - m = re.search(r'\((?!\?)', patron) - n = 0 - dbg() - while m: - patron = patron[:m.end()] + '?P<' + listGroups[n] + '>' + patron[m.end():] - m = re.search(r'\((?!\?)', patron) - n += 1 - + if not data: + html = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True).data.replace("'", '"') + html = re.sub('\n|\t', ' ', html) + else: + html = data headers = {'content-type': 'application/json'} data = { 'regex': patron, @@ -141,7 +138,18 @@ def scrape2(item, patron = '', listGroups = [], headers="", blacklist="", data=" permaLink = json.loads(r)['permalinkFragment'] webbrowser.open(url + "/r/" + permaLink) - return + +def scrape2(item, patron = '', listGroups = [], headers="", blacklist="", data="", patronBlock="", + patronNext="", action="findvideos", addVideolibrary = True, typeContentDict={}, typeActionDict={}): + m = re.search(r'\((?!\?)', patron) + n = 0 + while m: + patron = patron[:m.end()] + '?P<' + listGroups[n] + '>' + patron[m.end():] + m = re.search(r'\((?!\?)', patron) + n += 1 + regexDbg(item, patron, headers) + + def scrape(func): # args is a dict containing the foolowing keys: @@ -182,14 +190,16 @@ def scrape(func): addVideolibrary = args['addVideolibrary'] if 'addVideolibrary' in args else True blacklist = args['blacklist'] if 'blacklist' in args else '' data = args['data'] if 'data' in args else '' - headers = args['headers'] if 'headers' in args else '' patron = args['patron'] if 'patron' in args else args['patronMenu'] if 'patronMenu' in args else '' + headers = args['headers'] if 'headers' in args else func.__globals__['headers'] patronNext = args['patronNext'] if 'patronNext' in args else '' patronBlock = args['patronBlock'] if 'patronBlock' in args else '' typeActionDict = args['type_action_dict'] if 'type_action_dict' in args else {} typeContentDict = args['type_content_dict'] if 'type_content_dict' in args else {} + debug = args['debug'] if 'debug' in args else False if 'pagination' in args: pagination = args['pagination'] if args['pagination'] else 20 else: pagination = '' + log('PATRON= ', patron) if not data: data = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True).data.replace("'", '"') @@ -215,11 +225,14 @@ def scrape(func): matches = scrapertoolsV2.find_multiple_matches_groups(block, patron) log('MATCHES =', matches) + if debug: + regexDbg(item, patron, headers, block) + known_keys = ['url', 'title', 'title2', 'episode', 'thumb', 'quality', 'year', 'plot', 'duration', 'genere', 'rating', 'type', 'lang'] # by greko aggiunto episode lang = '' # aggiunto per gestire i siti con pagine di serietv dove si hanno i video in ita e in subita - pag = item.page if item.page else 1 # pagination + pag = item.page if item.page else 1 # pagination for i, match in enumerate(matches): if pagination and (pag - 1) * pagination > i: continue # pagination @@ -541,7 +554,7 @@ def menu(func): listUrls_extra = [] dictUrl = {} - + # Main options itemlist = [] @@ -551,21 +564,21 @@ def menu(func): if name == 'film': title = 'Film' if name == 'tvshow': title = 'Serie TV' if name == 'anime': title = 'Anime' - + if name == 'search' and dictUrl[name] is not None: menuItem(itemlist, filename, 'Cerca… bold', 'search', host + dictUrl['search']) - + # Make TOP MENU elif name == 'top' and dictUrl[name] is not None: for sub, var in dictUrl['top']: menuItem(itemlist, filename, title = sub + ' italic bold', url = host + var[0] if len(var) > 0 else '', - action = var[1] if len(var) > 1 else 'peliculas', - args=var[2] if len(dictUrl[name]) > 2 else '', + action = var[1] if len(var) > 1 else 'peliculas', + args=var[2] if len(var) > 2 else '', contentType= var[3] if len(var) > 3 else 'movie',) - # Make MAIN MENU + # Make MAIN MENU elif dictUrl[name] is not None: if len(dictUrl[name]) == 0: url = '' else: url = dictUrl[name][0] if type(dictUrl[name][0]) is not tuple and len(dictUrl[name][0]) > 0 else '' @@ -580,26 +593,26 @@ def menu(func): menuItem(itemlist, filename, title = sub + ' submenu' + typo(title,'_ {}'), url = host + var[0] if len(var) > 0 else '', - action = var[1] if len(var) > 1 else 'peliculas', - args=var[2] if len(dictUrl[name]) > 2 else '', + action = var[1] if len(var) > 1 else 'peliculas', + args=var[2] if len(var) > 2 else '', contentType= var[3] if len(var) > 3 else 'movie',) # add search menu for category if 'search' not in args: menuItem(itemlist, filename, 'Cerca ' + title + '… submenu bold', 'search', host, args=name) - + # Make EXTRA MENU (on bottom) for name, var in args.items(): if name not in listUrls and name != 'item': listUrls_extra.append(name) for name in listUrls_extra: - dictUrl[name] = args[name] if name in args else None + dictUrl[name] = args[name] if name in args else None for sub, var in dictUrl[name]: menuItem(itemlist, filename, title = sub + ' ', url = host + var[0] if len(var) > 0 else '', - action = var[1] if len(var) > 1 else 'peliculas', - args=var[2] if len(dictUrl[name]) > 2 else '', - contentType= var[3] if len(var) > 3 else 'movie',) - + action = var[1] if len(var) > 1 else 'peliculas', + args=var[2] if len(var) > 2 else '', + contentType= var[3] if len(var) > 3 else 'movie',) + autoplay.init(item.channel, list_servers, list_quality) autoplay.show_option(item.channel, itemlist) diff --git a/platformcode/launcher.py b/platformcode/launcher.py index ddfa6d63..eb1a9dea 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -31,13 +31,15 @@ def start(): config.verify_directories_created() # controlla se l'utente ha qualche problema di connessione - # se lo ha, non lo fa entrare nell'addon e visualizza un messaggio - # se tutto ok, entra nell'addon + # se lo ha: non lo fa entrare nell'addon + # se ha problemi di DNS avvia ma lascia entrare + # se tutto ok: entra nell'addon from specials.checkhost import test_conn test_conn(is_exit = True, check_dns = True, view_msg = True, lst_urls = [], lst_site_check_dns = [], in_addon = True) - + except: + pass def run(item=None): logger.info() if not item: diff --git a/specials/autoplay.py b/specials/autoplay.py index ec991460..8defa70b 100644 --- a/specials/autoplay.py +++ b/specials/autoplay.py @@ -645,7 +645,7 @@ def get_languages(channel): :return: list ''' logger.info() - list_language = ['No filtrar'] + list_language = ['Non filtrare'] list_controls, dict_settings = channeltools.get_channel_controls_settings(channel) for control in list_controls: try: