在python-scrapy的帮助下解析ajax表单请求时需要帮助

时间:2022-08-26 11:23:53

Even though I am new to scrapy framework, I am able to write good spiders using scrapy. Recently I came across this page, where by entering address, and on submit I have to capture the latitude and longitude. Could any one help?

尽管我是scrapy框架的新手,但我能够使用scrapy编写好的蜘蛛。最近我遇到了这个页面,通过输入地址,提交时我必须捕获纬度和经度。有人可以帮忙吗?

This code works for normal post requests:

此代码适用于普通的帖子请求:

return [FormRequest.from_response(response,
                    formdata={'username': 'john', 'password': 'secret'},
                    callback=self.after_login)]

But what about the ajax based form requests, like the above.

但是基于ajax的表单请求如上所述。

1 个解决方案

#1


0  

This site uses Google Maps Geocode to fetch the data, so it's more easy to just use Google's API's.

该网站使用谷歌地图地理编码来获取数据,因此使用谷歌的API更容易。

It was requesting:

它要求:

Request URL:http://maps.googleapis.com/maps/api/js/GeocodeService.Search?4s12%20Street%2C%20New%20York%2C%20NY&7sUS&9sen-US&callback=_xdc_._8xnwgc&token=93301

You might as well just sign up for the Google Maps API and query them yourself :)

您也可以注册Google Maps API并自行查询:)

#1


0  

This site uses Google Maps Geocode to fetch the data, so it's more easy to just use Google's API's.

该网站使用谷歌地图地理编码来获取数据,因此使用谷歌的API更容易。

It was requesting:

它要求:

Request URL:http://maps.googleapis.com/maps/api/js/GeocodeService.Search?4s12%20Street%2C%20New%20York%2C%20NY&7sUS&9sen-US&callback=_xdc_._8xnwgc&token=93301

You might as well just sign up for the Google Maps API and query them yourself :)

您也可以注册Google Maps API并自行查询:)