From 87b205c50ab0f8873a055411075feca6032617b8 Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Mon, 6 Sep 2021 20:38:19 +0200 Subject: [PATCH] Fix altaCommunity e aggiungi alla videoteca con autoplay attivo su alcuni canali --- channels/altadefinizionecommunity.py | 7 ++++--- core/autoplay.py | 2 +- servers/streamtape.py | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/channels/altadefinizionecommunity.py b/channels/altadefinizionecommunity.py index 1c635286..e29a0cfc 100644 --- a/channels/altadefinizionecommunity.py +++ b/channels/altadefinizionecommunity.py @@ -129,7 +129,9 @@ def registerOrLogin(): @support.scrape def peliculas(item): + import ast json = {} + # debug = True if item.contentType == 'undefined': disabletmdb = True @@ -140,17 +142,16 @@ def peliculas(item): action = 'episodios' if '/load-more-film' not in item.url and '/search' not in item.url: # generi o altri menu, converto - import ast ajax = support.match(item.url, patron='ajax_data\s*=\s*"?\s*([^;]+)', cloudscraper=True).match item.url = host + '/load-more-film?' + support.urlencode(ast.literal_eval(ajax)) + '&page=1' - if not '/search' in item.url: + if '/search' not in item.url: json = support.httptools.downloadpage(item.url, headers=headers, cloudscraper=True).json data = "\n".join(json['data']) else: json = support.httptools.downloadpage(item.url, headers=headers, cloudscraper=True).json data = "\n".join(json['data']) - patron = r'wrapFilm">\s*\s*(?P[0-9]{4})\s*]+>[^<]+\s*(?P[^<]+).*?]+>\s*

(?P[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA-]+))?' + patron = '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>[^"]+)[^>]+>\s*</div>\s*<h3>(?P<title>[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA-]+))?' # paginazione if json.get('have_next'): def fullItemlistHook(itemlist): diff --git a/core/autoplay.py b/core/autoplay.py index 1894c15a..ff546178 100644 --- a/core/autoplay.py +++ b/core/autoplay.py @@ -27,7 +27,7 @@ def start(itemlist, item): :return: try to auto-reproduce, in case of failure it returns the itemlist that it received in the beginning ''' - if item.global_search: + if item.global_search or item.from_action: # from_action means that's a special function calling this (ex: add to videolibrary) return itemlist logger.debug() diff --git a/servers/streamtape.py b/servers/streamtape.py index 0aaba9c1..3ce27083 100644 --- a/servers/streamtape.py +++ b/servers/streamtape.py @@ -18,9 +18,10 @@ def test_video_exists(page_url): referer = {"Referer": page_url} - data = httptools.downloadpage(page_url, headers=referer).data + page = httptools.downloadpage(page_url, headers=referer) + data = page.data - if "Video not found" in data: + if "Video not found" in data or page.code >= 400: return False, config.get_localized_string(70449) % 'Streamtape' return True, ""