我提出 2 个请求。一个通过chrome隐身浏览器:https ://market.yandex.ru/catalog--smartfony/16814639/list?hid=91491&glfilter=16816262:16816264&onstock=1
另一种是卷曲。
curl --location --request GET 'https://market.yandex.ru/catalog--smartfony/16814639/list?hid=91491&glfilter=16816262:16816264&onstock=1' --header 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' --header 'Accept-Encoding: gzip, deflate, br' --header 'Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7' --header 'Connection: keep-alive' --header 'Host: market.yandex.ru' --header 'Sec-Fetch-Dest: document' --header 'Sec-Fetch-Mode: navigate' --header 'Sec-Fetch-Site: none' --header 'Upgrade-Insecure-Requests: 1' --header 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36'
在第一种情况下,答案是 302。在第二种情况下,403。标题和其他一切都是一样的。有什么问题?
浪费了一些灾难性的时间来提取数据。脚本对我不起作用的原因是什么,我没有完全弄清楚。很可能是证书有问题。它是从系统 python 下启动的,一切正常。
卷曲从来没有奏效。正如我发现的那样,这只狗很可能被埋在 https、证书或 http2 中。但是python脚本有效。
为了让 curl 工作,您需要添加:
我还注意到这是 curl 极其奇怪的行为,因为在设置标志时
-v
,日志显示http1.1
使用了 ,tlsv1.3
。