[我正在尝试使用curl捕获生成的图像,但是当我运行时
curl https://thispersondoesnotexist.com/ > image.jpg
我得到错误
curl: (92) HTTP/2 stream 0 was not closed cleanly: INTERNAL_ERROR (err 2)
并且下载了0个字节。
添加--http1.1标志无济于事:
curl --http1.1 https://thispersondoesnotexist.com > imagex.jpg
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (52) Empty reply from server
[查看站点,我不知道它是如何将图像实际传输到浏览器的-我在调试器中看到了它,但是它似乎不是我可以实际写的输出。
我不打算经营一个巨魔农场或其他任何东西,这只是一个为面部分析生成一些随机图片的项目。
看起来他们拒绝将curl作为用户代理,因此请转到chrome,打开网络面板,然后重新加载以查看请求。这就是我的样子:
curl 'https://thispersondoesnotexist.com/image' -H 'authority: thispersondoesnotexist.com' -H 'cache-control: max-age=0' -H 'dnt: 1' -H 'upgrade-insecure-requests: 1' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-user: ?1' -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3' -H 'sec-fetch-site: none' -H 'referer: https://thispersondoesnotexist.com/' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en-US,en;q=0.9' --compressed --output image.jpg