[英]request.get doesn't work in python scraper
Hi I am trying to make this basic scraper work, where it should go to a website fill "City" and "area" ,search for restaurants and return the html page. 嗨,我正在尝试使这个基本的刮板工作,应该在网站上填写“城市”和“区域”,搜索餐厅并返回html页面。
This is the code i'm using 这是我正在使用的代码
payload = OrderedDict([('cityId','NewYork'),('area','Centralpark')])
req = requests.get("http://www.somewebsite.com",params=payload)
f = req.content
soup = BeautifulSoup((f))
And Here is how the Source HTML looks like 这是Source HTML的样子
When I'm checking the resulting soup variable it doesn't have the search results , instead it contains the data from the first page only,which has the form for entering city and area value (ie www.somewebsite.com, what i want is results of www.somewebsite.com?cityId=NewYork&area=centralPark
).So Is there anything that i have to pass with that params to explicitly press the search button or is there any other way to make it work. 当我检查结果汤变量时,它没有搜索结果,而是仅包含第一页中的数据,该页具有用于输入城市和区域值的形式(例如,www.somewebsite.com,我想要的是是www.somewebsite.com?cityId=NewYork&area=centralPark
结果。因此,我必须通过该参数传递任何内容以明确按下搜索按钮,或者是否有其他方法可以使其工作。
您首先需要检查是否可以通过Web浏览器访问URL并获得正确的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.