diff --git a/channels.json b/channels.json index 4f0963c6..3f78cb2a 100644 --- a/channels.json +++ b/channels.json @@ -2,7 +2,6 @@ "direct": { "altadefinizione01": "https://www.altadefinizione01.plus", "altadefinizione01_link": "https://altadefinizione01.travel", - "altadefinizionecommunity": "https://altadefinizionecommunity.me", "animealtadefinizione": "https://www.animealtadefinizione.it", "animeforce": "https://www.animeforce.it", "animeleggendari": "https://animezeus.com", @@ -14,21 +13,21 @@ "casacinema": "https://www.casacinema.page", "cb01anime": "https://www.cineblog01.red", "cineblog01": "https://cb01.uno", - "cinemalibero": "https://cinemalibero.rocks", + "cinemalibero": "https://cinemalibero.digital", "cinetecadibologna": "http://cinestore.cinetecadibologna.it", "discoveryplus": "https://www.discoveryplus.com", "dreamsub": "https://dreamsub.stream", "dsda": "https://www.dsda.press", - "eurostreaming": "https://eurostreaming.bar", + "eurostreaming": "https://eurostreaming.red", "filmigratis": "https://filmigratis.org", "guardaseriecam": "https://guardaserie.cam", "guardaserieclick": "https://www.guardaserie.builders", - "guardaserieicu": "https://guardaserie.wales", + "guardaserieicu": "https://guardaserie.cymru", "hd4me": "https://hd4me.net", "ilcorsaronero": "https://ilcorsaronero.link", - "ilgeniodellostreaming": "https://ilgeniodellostreaming.dog", + "ilgeniodellostreaming": "https://ilgeniodellostreaming.ltd", "ilgeniodellostreaming_cam": "https://ilgeniodellostreaming.city", - "italiaserie": "https://italiaserie.guru", + "italiaserie": "https://italiaserie.golf", "mediasetplay": "https://www.mediasetplay.mediaset.it", "mondoserietv": "https://mondoserietv.club", "paramount": "https://www.paramountnetwork.it", @@ -47,6 +46,7 @@ }, "findhost": { "altadefinizioneclick": "https://altadefinizione-nuovo.click", + "altadefinizionecommunity": "https://altaregistrazione.net", "animealtadefinizione": "https://www.animealtadefinizione.it", "filmpertutti": "https://filmpertuttiii.nuovo.live", "streamingcommunity": "https://streamingcommunity-nuovo.link" diff --git a/channels/altadefinizioneclick.py b/channels/altadefinizioneclick.py index a0aaced3..af1b03dd 100644 --- a/channels/altadefinizioneclick.py +++ b/channels/altadefinizioneclick.py @@ -1,107 +1,41 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------ -# Canale per altadefinizioneclick +# Canale per Altadefinizione Click # ---------------------------------------------------------- -""" - Eccezioni che non superano il test del canale: - - indicare le eccezioni - - Novità. Indicare in quale/i sezione/i è presente il canale: - - film - - Avvisi: - - Eventuali avvisi per i tester - - Ulteriori info: - - -""" -from platformcode.logger import debug from core import support -from core.item import Item -from platformcode import config +from platformcode import config, logger def findhost(url): - data = support.httptools.downloadpage(url).data - host = support.scrapertools.find_single_match(data, '
\s*\s*\s*(?:(?P[^<]+)[^>]+>)?(?:(?P[^<>]+))?.+?href="(?P[^"]+)".+?src="(?P[^"]+)".+?

[^>]+>(?P.+?)[ ]?(?:|\[(?P<lang>[^\]]+)\])?</a>.*?(?:IMDB\:</strong>[ ](?P<rating>.+?)<|</div>)' - - if item.args == 'az': - patron = r'<img style="[^"]+" src="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+>[^>]+>[^>]+><a href="(?P<url>[^"]+)" [^>]+>(?P<title>[^<\[]+)(?:\[(?P<lang>[^\]]+)\]\s*)?<'\ - r'[^>]+>[^>]+>[^>]+>[^>]+>\s*(?P<year>\d{4})[^>]+>[^>]+>\s*(?P<quality>[^<]+).*?<span class="label">(?P<ratting>[^<]+)<' - patronBlock ='' - - elif item.args == 'search': - patronBlock = r'<section id="lastUpdate">(?P<block>.*?)(?:<div class="row ismobile">|<section)' - patron = r'<a href="(?P<url>[^"]+)">\s*<div class="wrapperImage">(?:\s*<span class="year">(?P<year>[^<]+)<\/span>)?(?:\s*<span class="hd">(?P<quality>[^<]+)<\/span>)?[^>]+>\s*<img[^s]+src="(?P<thumb>[^"]+)"(?:(?:[^>]+>){5}\s*(?P<rating>[^<]+))?(?:[^>]+>){4}(?P<title>[^<]+)' - - if not item.args: - # patronBlock = r'(?:ULTIMI INSERITI|Serie TV)(?P<block>.*?)</section' - patronBlock = r'({})(?P<block>.*?)</section'.format('ULTIMI INSERITI' if item.contentType == 'movie' else 'Serie TV') - - # nella pagina "CERCA", la voce "SUCCESSIVO" apre la maschera di inserimento dati - patronNext = r'<a class="next page-numbers" href="([^"]+)">' + tvshow = ['/serie-tv/tvshow', + ('Generi', ['/serie-tv/tvshow', 'genres', 'genres']), + ('Anni', ['/serie-tv/tvshow', 'genres', 'year'])] return locals() -@support.scrape -def genres(item): - action = 'peliculas' - patronMenu = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)<' - - if item.args == 'genres': - patronBlock = r'<ul class="listSubCat" id="Film">(?P<block>.*)<ul class="listSubCat" id="Anno">' - elif item.args == 'years': - patronBlock = r'<ul class="listSubCat" id="Anno">(?P<block>.*)<ul class="listSubCat" id="Qualita">' - elif item.args == 'quality': - patronBlock = r'<ul class="listSubCat" id="Qualita">(?P<block>.*)</li>\s*?</ul>\s*?</div>\s*?</div>\s*?</div>\s*?<a' - elif item.args == 'lucky': # sono i titoli random nella pagina - patronBlock = r'<h3 class="titleSidebox dado">FILM RANDOM</h3>(?P<block>.*)</section>' - patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<[]+)(?:\[(?P<lang>.+?)\])?<' - action = 'findvideos' - elif item.args == 'az': - blacklist = ['FILM 4K IN STREAMING'] - patron = r'<a title="(?P<title>[^"]+)" href="(?P<url>[^"]+)"' - item.args = 'az' - if not item.args == 'az': - item.args = 'genres' - - return locals() def search(item, texto): - support.info("search ", texto) + logger.debug("search ", texto) item.args = 'search' - item.url = host + "?s=" + texto + item.url = host + "/search?s={}&f={}&page=1".format(texto, item.contentType) try: return peliculas(item) # Continua la ricerca in caso di errore @@ -111,87 +45,107 @@ def search(item, texto): support.logger.error("%s" % line) return [] -def newest(categoria): - support.info(categoria) - itemlist = [] - item = Item() - try: - if categoria == "peliculas": - item.args = 'news' - item.contentType = 'movie' - item.url = host + "/nuove-uscite/" - item.action = "peliculas" - itemlist = peliculas(item) - - if itemlist[-1].action == "peliculas": - itemlist.pop() - - # Continua la ricerca in caso di errore - except: - import sys - for line in sys.exc_info(): - from platformcode import logger - logger.error("{0}".format(line)) - return [] - - return itemlist - - -def check(item): - item.contentType = 'tvshow' - def get_season(pageData, seas_url, season): - data = '' - episodes = support.match(pageData if pageData else seas_url, patronBlock=patron_episode, patron=patron_option).matches - for episode_url, episode in episodes: - # episode_url = support.urlparse.urljoin(item.url, episode_url) - # if '-' in episode: episode = episode.split('-')[0].zfill(2) + 'x' + episode.split('-')[1].zfill(2) - title = season + "x" + episode.zfill(2) + ' - ' + item.fulltitle - data += title + '|' + episode_url + '\n' - return data - - patron_season = '<div class="[^"]+" id="seasonsModal"[^>]+>(.*?)</ul>' - patron_episode = '<div class="[^"]+" id="episodesModal"[^>]+>(.*?)</ul>' - patron_option = r'<a href="([^"]+?)".*?>(?:Stagione |Episodio )([^<]+?)</a>' - - url = support.match(item, patron=r'<iframe id="iframeVid" width="[^"]+" height="[^"]+" src="([^"]+)" allowfullscreen').match - seasons = support.match(url, patronBlock=patron_season, patron=patron_option) - if not seasons.match: - item.contentType = 'movie' - return findvideos(item) - - data = '' - - import sys - if sys.version_info[0] >= 3: from concurrent import futures - else: from concurrent_py2 import futures - with futures.ThreadPoolExecutor() as executor: - thL = [] - for i, season in enumerate(seasons.matches): - thL.append(executor.submit(get_season, seasons.data if i == 0 else '', season[0], season[1])) - for res in futures.as_completed(thL): - if res.result(): - data += res.result() - item.data = data - return episodios(item) @support.scrape -def episodios(item): - data = item.data +def genres(item): + logger.debug(item) + data = support.httptools.downloadpage(item.url, cloudscraper=True).data + blacklist= ['Film', 'Serie TV'] - patron = r'(?P<season>\d+)x(?P<episode>\d+)\s*-\s*(?P<title>[^\|]+)\|(?P<url>[^ ]+)' - action = 'findvideos' + if item.args == 'genres': + categories ={} + res = support.match(host + '/cerca', patron=r'for="cat-(\d+)[^>]+>([^<]+)').matches + for _id, name in res: + categories[name] = _id - def itemlistHook(itemlist): - itemlist.sort(key=lambda item: (item.infoLabels['season'], item.infoLabels['episode'])) - return itemlist + patronBlock = r'{}<span></span>(?P<block>.*?)</ul>\s*</li'.format('Film' if item.contentType == 'movie' else 'Serie TV') + patronMenu = r'<a href="[^"]+">(?P<title>[^<]+)' + + def itemHook(it): + it.cat_id = categories[it.fulltitle] + return it + + if item.args == 'year': + patron = r'value="(?P<year_id>[^"]+)"[^>]*>(?P<title>\d+)' + patronBlock = r'Anno</option>(?P<block>.*?</select>)' + + elif item.args == 'quality': + patronMenu = r'quality/(?P<quality_id>[^"]+)">(?P<title>[^<]+)' + patronBlock = r'Risoluzione(?P<block>.*?)</ul>' + action = 'peliculas' + return locals() + + +@support.scrape +def peliculas(item): + item.quality = 'HD' + json = {} + params ={'type':item.contentType, 'anno':item.year_id, 'quality':item.quality_id, 'cat':item.cat_id, 'order':order} + + + if item.contentType == 'movie': + action = 'findvideos' + else: + action = 'episodios' + if not item.page: item.page = 1 + try: + # support.dbg() + if item.args in ['search']: + page = support.httptools.downloadpage(item.url, headers=headers) + if page.json: + data = "\n".join(page.json['data']) + else: + data = page.data + else: + params['page'] = item.page + + url = '{}/load-more-film?{}'.format(host, support.urlencode(params)) + json = support.httptools.downloadpage(url, headers=headers).json + data = "\n".join(json['data']) + except: + data = ' ' + + patron = r'wrapFilm">\s*<a href="(?P<url>[^"]+)">[^>]+>(?P<year>\d+)(?:[^>]+>){2}(?P<rating>[^<]+)(?:[^>]+>){4}\s*<img src="(?P<thumb>[^"]+)(?:[^>]+>){3}(?P<title>[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA-]+))?' + # patron = r'wrapFilm">\s*<a href="(?P<url>[^"]+)">[^>]+>(?P<year>\d+)(?:[^>]+>){2}(?P<rating>[^<]+)(?:[^>]+>){2}(?P<quality>[^<]+)(?:[^>]+>){2}\s*<img src="(?P<thumb>[^"]+)(?:[^>]+>){3}(?P<title>[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA-]+))?' + + # paginazione + if json.get('have_next') or 'have_next_film=true' in data: + def fullItemlistHook(itemlist): + cat_id = support.match(data, patron=r''''cat':"(\d+)"''').match + if cat_id: item.cat_id = cat_id + item.page += 1 + support.nextPage(itemlist, item, function_or_level='peliculas') + return itemlist return locals() -def findvideos(item): - support.info('findvideos', item) - return support.hdpass_get_servers(item) -# def play(item): -# if 'hdpass' in item.url: -# return support.hdpass_get_url(item) -# return [item] +@support.scrape +def episodios(item): + logger.debug(item) + # debug = True + data = item.data + patron = r'class="playtvshow "\s+data-href="(?P<url>[^"]+)' + + def itemHook(it): + spl = it.url.split('/')[-2:] + it.infoLabels['season'] = int(spl[0])+1 + it.infoLabels['episode'] = int(spl[1])+1 + it.url = it.url.replace('/watch-unsubscribed', '/watch-external') + it.title = '{}x{:02d} - {}'.format(it.contentSeason, it.contentEpisodeNumber, it.fulltitle) + return it + + return locals() + + +def findvideos(item): + itemlist = [] + playWindow = support.match(item, patron='(?:playWindow|iframe)" (?:href|src)="([^"]+)').match + if host in playWindow: + url = support.match(playWindow, patron='allowfullscreen[^<]+src="([^"]+)"').match + else: + url = playWindow + itemlist.append(item.clone(action='play', url=url, quality='')) + + + return support.server(item, itemlist=itemlist) diff --git a/channels/altadefinizionecommunity.py b/channels/altadefinizionecommunity.py index a2f4543b..49740139 100644 --- a/channels/altadefinizionecommunity.py +++ b/channels/altadefinizionecommunity.py @@ -8,12 +8,13 @@ from platformcode import config, platformtools, logger from core import scrapertools, httptools -# def findhost(url): -# return support.match(url, patron=r'<a href="([^"]+)/\w+">Accedi').match +def findhost(url): + global register_url + register_url = url + return support.match(url, patron=r'<a href="([^"]+)/\w+">Accedi').match +host = config.get_channel_url(findhost) -host = config.get_channel_url() -register_url = 'https://altaregistrazione.net' headers = {'Referer': host, 'x-requested-with': 'XMLHttpRequest'} order = ['', 'i_piu_visti', 'i_piu_votati', 'i_piu_votati_dellultimo_mese', 'titolo_az', 'voto_imdb_piu_alto'][config.get_setting('order', 'altadefinizionecommunity')] @@ -23,32 +24,159 @@ def mainlist(item): logger.debug(item) film = ['/type/movie', - # Voce Menu,['url','action','args',contentType] - ('Generi', ['/type/movie', 'genres', 'genres']), - ('Anni', ['/type/movie', 'genres', 'year']), - # ('Qualità', ['', 'genres', 'quality']), - ] + ('Generi', ['/type/movie', 'genres', 'genres']), + ('Anni', ['/type/movie', 'genres', 'year']),] tvshow = ['/serie-tv/tvshow', - # Voce Menu,['url','action','args',contentType] - ('Generi', ['/serie-tv/tvshow', 'genres', 'genres']), - ('Anni', ['/serie-tv/tvshow', 'genres', 'year']), - # ('Qualità', ['', 'genres', 'quality']), - ] - - # altri = [ - # # ('A-Z', ['/lista-film', 'genres', 'letters']), - # ('Qualità', ['', 'genres', 'quality']), - # ('Anni', ['/anno', 'genres', 'years']) - # ] + ('Generi', ['/serie-tv/tvshow', 'genres', 'genres']), + ('Anni', ['/serie-tv/tvshow', 'genres', 'year'])] return locals() +def search(item, text): + logger.debug("search ", text) + + item.args = 'search' + item.url = host + "/search?s={}&f={}&page=1".format(text, item.contentType) + try: + return peliculas(item) + + # Continua la ricerca in caso di errore + except: + import sys + for line in sys.exc_info(): + support.logger.error("%s" % line) + return [] + + +@support.scrape +def genres(item): + logger.debug(item) + data = support.httptools.downloadpage(item.url).data + blacklist= ['Film', 'Serie TV'] + + if item.args == 'genres': + categories ={} + res = support.match(host + '/cerca', patron=r'for="cat-(\d+)[^>]+>([^<]+)').matches + for _id, name in res: + categories[name] = _id + + patronBlock = r'{}<span></span>(?P<block>.*?)</ul>\s*</li'.format('Film' if item.contentType == 'movie' else 'Serie TV') + patronMenu = r'<a href="[^"]+">(?P<title>[^<]+)' + + def itemHook(it): + it.cat_id = categories[it.fulltitle] + return it + + if item.args == 'year': + patron = r'value="(?P<year_id>[^"]+)"[^>]*>(?P<title>\d+)' + patronBlock = r'Anno</option>(?P<block>.*?</select>)' + + elif item.args == 'quality': + patronMenu = r'quality/(?P<quality_id>[^"]+)">(?P<title>[^<]+)' + patronBlock = r'Risoluzione(?P<block>.*?)</ul>' + + action = 'peliculas' + return locals() + + +@support.scrape +def peliculas(item): + item.quality = 'HD' + json = {} + params ={'type':item.contentType, 'anno':item.year_id, 'quality':item.quality_id, 'cat':item.cat_id, 'order':order} + + + if item.contentType == 'movie': + action = 'findvideos' + else: + action = 'episodios' + if not item.page: item.page = 1 + try: + # support.dbg() + if item.args in ['search']: + page = support.httptools.downloadpage(item.url, headers=headers) + if page.json: + data = "\n".join(page.json['data']) + else: + data = page.data + else: + params['page'] = item.page + + url = '{}/load-more-film?{}'.format(host, support.urlencode(params)) + json = support.httptools.downloadpage(url, headers=headers).json + data = "\n".join(json['data']) + except: + data = ' ' + + patron = r'wrapFilm">\s*<a href="(?P<url>[^"]+)">[^>]+>(?P<year>\d+)(?:[^>]+>){2}(?P<rating>[^<]+)(?:[^>]+>){4}\s*<img src="(?P<thumb>[^"]+)(?:[^>]+>){3}(?P<title>[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA-]+))?' + # patron = r'wrapFilm">\s*<a href="(?P<url>[^"]+)">[^>]+>(?P<year>\d+)(?:[^>]+>){2}(?P<rating>[^<]+)(?:[^>]+>){2}(?P<quality>[^<]+)(?:[^>]+>){2}\s*<img src="(?P<thumb>[^"]+)(?:[^>]+>){3}(?P<title>[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA-]+))?' + + # paginazione + if json.get('have_next') or 'have_next_film=true' in data: + def fullItemlistHook(itemlist): + cat_id = support.match(data, patron=r''''cat':"(\d+)"''').match + if cat_id: item.cat_id = cat_id + item.page += 1 + support.nextPage(itemlist, item, function_or_level='peliculas') + return itemlist + + return locals() + + +@support.scrape +def episodios(item): + logger.debug(item) + # debug = True + data = item.data + patron = r'class="playtvshow "\s+data-href="(?P<url>[^"]+)' + + def itemHook(it): + spl = it.url.split('/')[-2:] + it.infoLabels['season'] = int(spl[0])+1 + it.infoLabels['episode'] = int(spl[1])+1 + it.url = it.url.replace('/watch-unsubscribed', '/watch-external') + it.title = '{}x{:02d} - {}'.format(it.contentSeason, it.contentEpisodeNumber, it.fulltitle) + return it + + return locals() + + +def findvideos(item): + itemlist = [] + resolve_url(item) + + itemlist.append(item.clone(action='play', url=support.match(item.url, patron='allowfullscreen[^<]+src="([^"]+)"', cloudscraper=True).match, quality='')) + + return support.server(item, itemlist=itemlist) + + +def play(item): + if host in item.url: # intercetto il server proprietario + if registerOrLogin(): + return support.get_jwplayer_mediaurl(support.httptools.downloadpage(item.url, cloudscraper=True).data, 'Diretto') + else: + platformtools.play_canceled = True + return [] + else: + return [item] + + +def resolve_url(item): + registerOrLogin() + if '/watch-unsubscribed' not in item.url and '/watch-external' not in item.url: + playWindow = support.match(support.httptools.downloadpage(item.url, cloudscraper=True).data, patron='playWindow" href="([^"]+)') + video_url = playWindow.match + item.data = playWindow.data + item.url = video_url.replace('/watch-unsubscribed', '/watch-external') + return item + + def login(): r = support.httptools.downloadpage(host, cloudscraper=True) Token = support.match(r.data, patron=r'name=\s*"_token"\s*value=\s*"([^"]+)', cloudscraper=True).match - if 'id="logged"' in r.text: + if 'id="logged"' in r.data: logger.info('Già loggato') else: logger.info('Login in corso') @@ -58,11 +186,11 @@ def login(): 'password':config.get_setting('password', channel='altadefinizionecommunity')} r = support.httptools.downloadpage(host + '/login', post=post, headers={'referer': host}, cloudscraper=True) - if not r.status_code in [200, 302] or 'Email o Password non validi' in r.text: + if not r.status_code in [200, 302] or 'Email o Password non validi' in r.data: platformtools.dialog_ok('AltadefinizioneCommunity', 'Username/password non validi') return False - return 'id="logged"' in r.text + return 'id="logged"' in r.data def registerOrLogin(): @@ -129,135 +257,3 @@ def registerOrLogin(): return False return True - - -@support.scrape -def peliculas(item): - json = {} - params ={'type':item.contentType, 'anno':item.year_id, 'quality':item.quality_id, 'order':order} - - # if item.contentType == 'undefined': - # action = 'check' - if item.contentType == 'movie': - action = 'findvideos' - else: - action = 'episodios' - if not item.page: item.page = 1 - if item.args == 'search': - page = support.httptools.downloadpage(item.url, headers=headers, cloudscraper=True) - if page.json: - data = "\n".join(page.json['data']) - else: - data = page.data - else: - params['page'] = item.page - - url = '{}/load-more-film?{}'.format(host, support.urlencode(params)) - json = support.httptools.downloadpage(url, headers=headers, cloudscraper=True).json - data = "\n".join(json['data']) - - patron = r'wrapFilm">\s*<a href="(?P<url>[^"]+)">\s*<span class="year">(?P<year>[0-9]{4})</span>\s*(?:<span[^>]+>[^<]+</span>)?\s*<span class="qual">(?P<quality>[^<]+).*?<img src="(?P<thumbnail>[^"]+)[^>]+>.*?<h3>(?P<title>[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA-]+))?' - # paginazione - if json.get('have_next'): - def fullItemlistHook(itemlist): - item.page += 1 - support.nextPage(itemlist, item, function_or_level='peliculas') - return itemlist - - return locals() - - -def search(item, texto): - logger.debug("search ", texto) - - item.args = 'search' - item.url = host + "/search?s={}&f={}&page=1".format(texto, item.contentType) - try: - return peliculas(item) - # Continua la ricerca in caso di errore - except: - import sys - for line in sys.exc_info(): - support.logger.error("%s" % line) - return [] - - -@support.scrape -def genres(item): - logger.debug(item) - data = support.httptools.downloadpage(item.url, cloudscraper=True).data - blacklist= ['Film', 'Serie TV'] - - patronBlock = r'{}<span></span>(?P<block>.*?)</ul>\s*</li'.format('Film' if item.contentType == 'movie' else 'Serie TV') - patronMenu = r'<a href="(?P<url>[^"]+)">(?P<title>[^<]+)' - - if item.args == 'year': - patron = r'value="(?P<year_id>[^"]+)">(?P<title>\d+)' - patronBlock = r'Anno</option>(?P<block>.*?</select>)' - elif item.args == 'quality': - patronMenu = r'quality/(?P<quality_id>[^"]+)">(?P<title>[^<]+)' - patronBlock = r'Risoluzione(?P<block>.*?)</ul>' - # elif item.args == 'years': - # item.contentType = 'undefined' - # patronBlock = r'ANNO(?P<block>.*?</section>)' - # else: - # patronBlock = ('Film' if item.contentType == 'movie' else 'Serie TV') + r'<span></span></a>\s+<ul class="dropdown-menu(?P<block>.*?)active-parent-menu' - action = 'peliculas' - return locals() - - -@support.scrape -def episodios(item): - logger.debug(item) - # debug = True - data = item.data - patron = r'class="playtvshow "\s+data-href="(?P<url>[^"]+)' - - def itemHook(it): - spl = it.url.split('/')[-2:] - it.infoLabels['season'] = int(spl[0])+1 - it.infoLabels['episode'] = int(spl[1])+1 - it.url = it.url.replace('/watch-unsubscribed', '/watch-external') - it.title = '{}x{:02d} - {}'.format(it.contentSeason, it.contentEpisodeNumber, it.fulltitle) - return it - - return locals() - - -# def check(item): -# resolve_url(item) -# if '/tvshow' in item.url: -# item.contentType = 'tvshow' -# return episodios(item) -# else: -# item.contentType = 'movie' -# return findvideos(item) - - -def findvideos(item): - itemlist = [] - resolve_url(item) - - itemlist.append(item.clone(action='play', url=support.match(item.url, patron='allowfullscreen[^<]+src="([^"]+)"', cloudscraper=True).match, quality='')) - - return support.server(item, itemlist=itemlist) - - -def play(item): - if host in item.url: # intercetto il server proprietario - if registerOrLogin(): - return support.get_jwplayer_mediaurl(support.httptools.downloadpage(item.url, cloudscraper=True).data, 'Diretto') - else: - platformtools.play_canceled = True - return [] - else: - return [item] - - -def resolve_url(item): - if '/watch-unsubscribed' not in item.url and '/watch-external' not in item.url: - playWindow = support.match(support.httptools.downloadpage(item.url, cloudscraper=True).data, patron='playWindow" href="([^"]+)') - video_url = playWindow.match - item.data = playWindow.data - item.url = video_url.replace('/watch-unsubscribed', '/watch-external') - return item diff --git a/core/tmdb.py b/core/tmdb.py index 30f50302..b94acff1 100644 --- a/core/tmdb.py +++ b/core/tmdb.py @@ -938,7 +938,7 @@ class Tmdb(object): result = cls.get_json(url) if not isinstance(result, dict): result = ast.literal_eval(result.decode('utf-8')) - list_genres = result["genres"] + list_genres = result.get("genres", {}) for i in list_genres: cls.dic_genres[language][search_type][str(i["id"])] = i["name"] diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index d2b385d6..590c2e10 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -378,7 +378,11 @@ def render_items(itemlist, parent_item): set_view_mode(itemlist[0], parent_item) - xbmcplugin.endOfDirectory(_handle, succeeded=True, updateListing=False, cacheToDisc=False) + cacheToDisc = False + if (parent_item.action == 'findvideos' and config.get_setting('autoplay')) or parent_item.action == 'search': + cacheToDisc = True + + xbmcplugin.endOfDirectory(_handle, succeeded=True, updateListing=False, cacheToDisc=cacheToDisc) logger.debug('END render_items') @@ -416,11 +420,13 @@ def getCurrentView(item=None, parent_item=None): item = Item().fromurl(info) if info else Item() parent_actions = ['peliculas', 'novedades', 'search', 'get_from_temp', 'newest', 'discover_list', 'new_search', 'channel_search'] + addons = 'addons' if config.get_setting('touch_view') else '' + if parent_item.action == 'findvideos' or (parent_item.action in ['channel_search', 'new_search'] and parent_item.infoLabels['tmdb_id']): - return 'server', 'addons' if config.get_setting('touch_view') else '' + return 'server', addons elif parent_item.action == 'mainlist': - return 'channel', 'addons' if config.get_setting('touch_view') else '' + return 'channel', addons elif (item.contentType in ['movie'] and parent_item.action in parent_actions) \ or (item.channel in ['videolibrary'] and parent_item.action in ['list_movies']) \ @@ -439,13 +445,13 @@ def getCurrentView(item=None, parent_item=None): return 'episode', 'tvshows' elif parent_item.action in ['getmainlist', '']: - return 'home', 'addons' + return 'home', addons elif parent_item.action in ['filterchannels']: - return 'channels', 'addons' + return 'channels', addons else: - return 'menu', 'addons' if config.get_setting('touch_view') else '' + return 'menu', addons def set_view_mode(item, parent_item): diff --git a/servers/hdmario.py b/servers/hdmario.py index 10be4d95..7edda32a 100644 --- a/servers/hdmario.py +++ b/servers/hdmario.py @@ -130,9 +130,9 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= page = httptools.downloadpage(page_url) data = page.data - logger.debug(data) + # logger.debug(data) from lib import jsunpack_js2py - unpacked = jsunpack_js2py.unpack(scrapertools.find_single_match(data, '<script type="text/javascript">\n*\s*\n*(eval.*)')) + unpacked = jsunpack_js2py.unpack(scrapertools.find_single_match(data, '(eval.*?)</')) # p,a,c,k,e,d data -> xhr.setRequestHeader secureProof = scrapertools.find_single_match(unpacked, """X-Secure-Proof['"]\s*,\s*['"]([^"']+)""") logger.debug('X-Secure-Proof=' + secureProof) diff --git a/servers/streamtape.py b/servers/streamtape.py index 3e31bc98..1ec57d35 100644 --- a/servers/streamtape.py +++ b/servers/streamtape.py @@ -21,7 +21,7 @@ def test_video_exists(page_url): page = httptools.downloadpage(page_url, headers=referer) data = page.data - if "Video not found" in data or page.code >= 400: + if "Video not found" in data or page.code >= 400 or 'Streamtape - Error' in data: return False, config.get_localized_string(70449) % 'Streamtape' return True, ""