Python是否可以从邮政请求中获得请求有效载荷?
我正在尝试将此URL的名称和价格进行封存 https://pricempire.com/search.com/search 请求包。当我加载站点时,有一个名为项目的帖子请求,在请求有效载荷中有一个称为Captchatoken的属性,基本上我想捕获此属性并使用它来为其他页面创建请求。我一直在使用硒来刮擦名称和价格,但是要加载每页需要20秒钟的时间非常慢。因此,我的目标是在请求有效载荷中捕获Captchatoken,看起来像这样:
json_data = {
'page': 1,
'priceMin': 0,
'orderBy': 'price_desc',
'captchaToken': 'aaabbbcccxxxzzzyyy',
'priceMax': 200000,
'collections': [],
'weaponIds': [],
'wears': [],
'priceProvider': 'buff163',
}
加快网站的刮擦。但是我不知道是否可能,从我的研究中,我不知道这个问题的答案。
I'm trying to webscrape the names and prices for this URL https://pricempire.com/search via the requests package. When I load the site there is a POST request called items and inside the request payload there is a attribute called captchaToken, basically I want to capture this attribute and use it to create requests for the other pages. I've been using Selenium to scrape the names and prices but it is very slow having to take 20 seconds to load each page. So my goal is to capture the captchaToken in the request payload which looks like this:
json_data = {
'page': 1,
'priceMin': 0,
'orderBy': 'price_desc',
'captchaToken': 'aaabbbcccxxxzzzyyy',
'priceMax': 200000,
'collections': [],
'weaponIds': [],
'wears': [],
'priceProvider': 'buff163',
}
to speed up scraping of the site. But I don't know if its possible and from my research I don't know the answer to this question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在POST请求中,您必须添加服务器作为
有效载荷
作为JSON响应和CAPTCHA令牌
的数据也是有效载荷数据的一部分。这是一个示例,如何从API中获取数据(名称,价格)为邮政方法。输出:
In post request, you have to add data which is sent by the server as
payload
as json response andcaptcha Token
is also a part of payload data. Here is an example how to pull data (name, price) from api calls json response as post method.Output: