Multiple inheritance in scrapy spiders

喜夏-厌秋 提交于 2019-12-03 03:31:32

You are on the right track, the only thing left is at the end of your parse_product function, you have to yield all the urls extracted by the crawler like so

def parse_product(self, response):
    loader = FlipkartItemLoader(response=response)
    loader.add_value('pid', 'value of pid')
    loader.add_xpath('name', 'xpath to name')
    yield loader.load_item()

    # CrawlSpider defines this method to return all scraped urls.
    yield from self.parse(response)

If you don't have the yield from syntax then just use

for req in self.parse(response):
    yield req
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!