I keep getting 403 error when I try to download this link using aiohttp:
http://cfile2.uf.tistory.com/original/996D34465B12921B1AE97C
I want to download http://cfile2.uf.tistory.com/original/996D34465B12921B1AE97C.jpg
but I am unable to. I even tried to add referer but I still get the same error.
Here is my code:
async with aiohttp.ClientSession(headers={'Referer': 'https://tistory.com'}) as cs:
async with cs.get('http://cfile2.uf.tistory.com/original/996D34465B12921B1AE97C.jpg') as r:
if r.status == 200:
img = await r.read()
with open('C:/xxxx/xxxx/xxxx/xxxx/Image/' + 'test.jpg', 'wb') as f:
f.write(img)
print('Downloaded!)