From 4d6d447cba363b574a1104f7c5c0c197d5671937 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Fri, 6 Aug 2021 11:40:38 +0200 Subject: [PATCH] =?UTF-8?q?Altadefinizione=20Community:=20=20-=20Fix=20Ric?= =?UTF-8?q?erca=20=20-=20Fix=20Generi=20/=20Qualit=C3=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channels/altadefinizionecommunity.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/channels/altadefinizionecommunity.py b/channels/altadefinizionecommunity.py index 08f598f5..aed08925 100644 --- a/channels/altadefinizionecommunity.py +++ b/channels/altadefinizionecommunity.py @@ -15,7 +15,7 @@ def findhost(url): host = config.get_channel_url(findhost) register_url = 'https://altaregistrazione.com' -headers = [['Referer', host], ['x-requested-with', 'XMLHttpRequest']] +headers = {'Referer': host, 'x-requested-with': 'XMLHttpRequest'} cf = cloudscraper.create_scraper() @@ -132,13 +132,17 @@ def registerOrLogin(): @support.scrape def peliculas(item): # debug = True + json = {} support.info(item) 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*([^;]+)").match + ajax = support.match(item.url, patron='ajax_data\s*=\s*"?\s*([^;]+)').match item.url = host + '/load-more-film?' + support.urlencode(ast.literal_eval(ajax)) + '&page=1' - json = support.httptools.downloadpage(item.url, headers=headers).json - data = "\n".join(json['data']) + if not '/search' in item.url: + json = support.httptools.downloadpage(item.url, headers=headers).json + data = "\n".join(json['data']) + else: + data = support.httptools.downloadpage(item.url, headers=headers).data patron = r'wrapFilm">\s*\s*(?P[0-9]{4})\s*]+>[^<]+\s*(?P[^<]+).*?]+>\s*

(?P[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA-]+))?' # paginazione @@ -149,14 +153,16 @@ def peliculas(item): page = str(int(spl[-1])+1) support.nextPage(itemlist, item, next_page='='.join((url, page)), function_or_level='peliculas') return itemlist + return locals() def search(item, texto): support.info("search ", texto) + # support.dbg() item.args = 'search' - item.url = host + "/search?s={0}&page=1".format(texto) + item.url = host + "/search?s={}&page=1".format(texto) try: return peliculas(item) # Continua la ricerca in caso di errore @@ -170,6 +176,7 @@ def search(item, texto): @support.scrape def genres(item): support.info(item) + data = cf.get(item.url).text patronMenu = r'<a href="(?P<url>[^"]+)">(?P<title>[^<]+)' if item.args == 'quality':