From c76c8696bc66437fdffb52f87a15b338df3b93cc Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 12 Aug 2020 17:33:09 +0200 Subject: Fix manganelo images not downloading (cloudflare ddos protection) --- plugins/manganelo.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'plugins/manganelo.py') diff --git a/plugins/manganelo.py b/plugins/manganelo.py index b19d3e9..a577d4b 100755 --- a/plugins/manganelo.py +++ b/plugins/manganelo.py @@ -32,7 +32,16 @@ if len(sys.argv) < 2: def download_file(url, save_path): file_size = 0 - with requests.get(url, stream=True) as response: + headers = { + "accept-language": "en-US,en;q=0.9", + "accept": "image/webp,image/apng,image/*,*/*;q=0.8", + "sec-fetch-site": "cross-site", + "sec-fetch-mode": "no-cors", + "sec-fetch-dest": "image", + "referer": "https://manganelo.com/", + "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36" + } + with requests.get(url, stream=True, headers=headers) as response: if not response.ok: return 0 with open(save_path, "wb") as file: -- cgit v1.2.3