3

我看过 scrapy docs,但是scrapy可以发送http表单(例如:用户名,密码,....)并解析发送此表单的结果吗?

4

1 回答 1

1

同一页面中有一个示例:http: //scrapy.readthedocs.org/en/latest/topics/request-response.html#passing-additional-data-to-callback-functions

def parse_page1(self, response):
    item = MyItem()
    item['main_url'] = response.url
    request = Request("http://www.example.com/some_page.html",
                      callback=self.parse_page2)
    request.meta['item'] = item
    return request

def parse_page2(self, response):
    item = response.meta['item']
    item['other_url'] = response.url
    return item

您只需将回调参数函数传递给请求,然后在 parse_page2 中解析结果;)

于 2012-07-02T21:37:18.673 回答