diff --git a/channels/animeworld.py b/channels/animeworld.py index 1b11d401..2dfa7538 100644 --- a/channels/animeworld.py +++ b/channels/animeworld.py @@ -4,7 +4,7 @@ # thanks to fatshotty # ---------------------------------------------------------- -from core import support, jsontools +from core import httptools, support, jsontools from platformcode import config, logger from lib import js2py @@ -12,53 +12,21 @@ host = support.config.get_channel_url() headers = {} __channel__ = 'animeworld' -cookie = support.match(host, patron=r'document.cookie="([^\s]+)').match -headers = [['Referer', host], ['Cookie', cookie]] +res = httptools.downloadpage(host) +cookie = support.match(res.data, patron=r'document.cookie="([^\s]+)').match +headers = [['Cookie', 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 + return data def order(): # Seleziona l'ordinamento dei risultati return str(support.config.get_setting("order", __channel__)) -# def get_data(item, head=[]): -# global headers -# jstr = '' -# for h in head: -# headers[h[0]] = h[1] -# if not item.count: item.count = 0 -# if not config.get_setting('key', item.channel): -# matches = support.match(item, patron=r'