我有這段代碼。當我使用yyield要求futher鏈接,然後我得到這個errror在scrapy python中獲取錯誤與收益
Spider must return Request, BaseItem or None, got 'dict'
我試圖verything但我無法擺脫錯誤
代碼是在這裏
def parse_items(self, response):
hxs = HtmlXPathSelector(response)
sites = hxs.select("//li[contains(concat(' ', @class, ' '), ' mod-searchresult-entry ')]")
items = []
for site in sites[:2]:
item = SeekItem()
item['title'] = myfilter(site.select('dl/dd/h2/a').select("string()").extract())
item['link_url'] = myfilter(site.select('dl/dd/h2/em').select("string()").extract())
item['description'] = myfilter(site.select('dl/dd/p').select("string()").extract())
if item['link_url']:
yield Request(urljoin('http://www.seek.com.au/', item['link_url']),
meta = item,
callback = self.parseItemDescription)
yield item
def parseItemDescription(self, response):
item = response.meta
hxs = HtmlXPathSelector(response)
sites = hxs.select("//li[contains(concat(' ', @class, ' '), ' mod-searchresult-entry ')]")
item['description'] = "mytest"
return item
謝謝哥們,那完美的工作 – user1896360