1. Use python3"s requests module to download pictures with a size of 0?
2. My original code is as follows:
url =" https://www.wifi588.net/2025d."
headers =
{"authority":"www.wifi588.net",
" method":"GET",
"path":"/2025d6f1c179018205f04027361f1a49.jpg",
" scheme":"https",
"accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng, / ;
"accept-encoding":"",
" accept-language":"zh-CN,zh;q=0.9",
"cache-control":"max-age=0",
" cookie":"__cfduid=db035e73b552e0770b0d8f80ec68f1ab91521898939",
"if-none-match":"f4ee63a404f4332cce122986030578f2",
" upgrade-insecure-requests":"1",
"user-agent":"Mozilla/5.0 (Windows NT 6.1; Win64; X64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36"
}
response = requests.get (url,headers=headers)
name = url.split ("/") [- 1]
file_name = "f:/pic/ {}" .format (name)
with open (file_name, "wb") as f:
f.write(response.content)
f.close()
this is the request header I opened with F12 in the browser as follows:
I have constructed headers, completely according to the request header of the browser, but there is still a problem with the downloaded data. I really can"t find a solution. Thank you.