【发布时间】:2018-02-09 23:19:45
【问题描述】:
这是我要抓取的网页: http://www.nalpdirectory.com/Page.cfm?PageID=34。我想模拟提交表单#resultDisplayOptionsForm 并将#customDisplayNum 设置为All,这将为我带来一个包含所有列出项目的网页。
这是我的代码 sn-p:
def parse(self, response):
yield scrapy.FormRequest.from_response(
response,
formid='resultDisplayOptionsForm',
formdata={'displayNum': '100000'}, #I tried 10, 20, 30 etc. none works
dont_click=True,
#clickdata={'id': 'customizeDisplaySubmitBtn'},
callback=self.after_showAll
)
def after_showAll(self, response):
from scrapy.shell import inspect_response
inspect_response(response, self)
当我检查响应时,它总是显示一个失败的页面。欢迎任何建议。谢谢!
【问题讨论】:
-
我第一次使用
dont_click参数检查某人。 -
“失败的页面”是什么意思?
标签: python html scrapy web-crawler