From b92499cf7f2f389eeb334c6badda24e6945ee4c5 Mon Sep 17 00:00:00 2001 From: hgw Date: Mon, 2 Oct 2023 02:14:36 +0000 Subject: [PATCH] spoof user agent to firefox, fixes 403's --- banter/banter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/banter/banter.py b/banter/banter.py index 0c77beb..51e0df3 100755 --- a/banter/banter.py +++ b/banter/banter.py @@ -26,7 +26,8 @@ def main(imgPath, delay, ASCIIWIDTH, COLORCHAR, FILLER, fileType): print('URL') print('Downloading image to ' + "/home/node/app/image." + fileType) #wget.download(imgPath, "/home/node/app/image." + fileType) - imagefile = requests.get(imgPath) + headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0) Gecko/20100101 Firefox/101.0'} + imagefile = requests.get(imgPath, headers=headers) open("/home/node/app/image." + fileType, "wb").write(imagefile.content) if fileType == "png": print('PNG')