如何给爬虫回调函数添加关键字?

问题描述 投票:0回答:0

我在向爬虫添加关键字时遇到问题。我正在使用

scrapy
flask
crochet
。函数是:

@crochet.run_in_reactor
def scrape_with_crochet(req):
    eventual = crawl_runner.crawl(Spider, output_data = output_data,**req)
    eventual.addCallback(finished_scrape,callbackKeywords = {'stash':5})

如何为

eventual.addCallback
添加关键字。我试过了
eventual.addCallback(finished_scrape,callbackKeywords = {'stash':5})

eventual.addCallback(finished_scrape,cb_kwargs= {'stash':5})
但它们似乎都不起作用。

flask scrapy web-crawler
© www.soinside.com 2019 - 2024. All rights reserved.