python - 使用带有地理定位的请求问题使用 python 进行 Webscraping
问题描述
我目前正在通过请求和使用代理来抓取 amazon.com 网站。
我正在将请求模块与python3一起使用。
我面临的问题是亚马逊根据代理的地理位置向我返回结果,而不是美国 amazon.com 的结果。
我如何确保仅从美国获得针对美国的 amazon.com 的结果?
这是我的代码:
import requests
url = 'https://www.amazon.com/s?k=a%20circuit'
proxy_dict = # Proxy details in the dictionary form
response = requests.get(url, proxies=proxy_dict, timeout=(3, 3))
htmlText = response.text
# I am than saving the details in a text file.
该代码工作正常,但它确实返回代理位置的结果。
我如何确保结果仅适用于美国?Shell 我可能会在 url 上添加一些东西或在标题上添加一些东西?
解决方案
推荐阅读
- apache - 大型提交在中途停止
- javascript - for循环在量角器中不起作用
- r - 遍历字符串向量中的单词并将更改应用于单个单词
- java - Intellijidea如何自动填写bug提示,有哪些快捷键?
- postgresql - 如何使用最大字段获得不同的结果
- c# - Office 365 的 OAuth2 身份验证请求过程将链接转发到 https://login.microsoftonline.com/login.srf
- android - TextView 呈现丑陋的子弹
- 标签
- laravel - 在 laravel 5.4 中调整图像大小的 API
- java - 如何在 JavaFx 中显示按钮中的所有文本
- php - Wordpress 分页数