spoof user agent to firefox, fixes 403's

This commit is contained in:
hgw 2023-10-02 02:14:36 +00:00
parent f20031b673
commit b92499cf7f
1 changed files with 2 additions and 1 deletions

View File

@ -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')