From 642c0acc41a0f1732f6b58d2378cedf87db09f5b Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Wed, 5 May 2021 20:58:34 +0200 Subject: [PATCH] Miglioria animeworld --- channels/animeworld.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/channels/animeworld.py b/channels/animeworld.py index 2dfa7538..aa43efae 100644 --- a/channels/animeworld.py +++ b/channels/animeworld.py @@ -5,18 +5,24 @@ # ---------------------------------------------------------- from core import httptools, support, jsontools -from platformcode import config, logger -from lib import js2py host = support.config.get_channel_url() -headers = {} - __channel__ = 'animeworld' -res = httptools.downloadpage(host) -cookie = support.match(res.data, patron=r'document.cookie="([^\s]+)').match +cookie = support.config.get_setting('cookie', __channel__) headers = [['Cookie', cookie]] +def get_cookie(): + global cookie, headers + cookie = support.match(host, patron=r'document.cookie="([^\s]+)').match + support.config.set_setting('cookie', cookie, __channel__) + headers = [['Cookie', cookie]] + + +if not cookie: + get_cookie() + + def get_data(item): url = httptools.downloadpage(item.url, headers=headers, follow_redirects=True, only_headers=True).url data = support.match(url, headers=headers, follow_redirects=True).data @@ -115,7 +121,11 @@ def peliculas(item): anime=True # debug =True if item.args not in ['noorder', 'updated'] and not item.url[-1].isdigit(): item.url += order() # usa l'ordinamento di configura canale - # data = get_data(item) + data = support.httptools.downloadpage(item.url, headers=headers).data + if 'AWCookietest' in data: + get_cookie() + data = support.match(item.url).data + if item.args == 'updated': # data = get_data(item) item.contentType='episode' @@ -144,9 +154,8 @@ def peliculas(item): @support.scrape def episodios(item): data = get_data(item) - anime=True + anime = True pagination = 50 - # data = get_data(item) patronBlock= r'