首页 > 解决方案 > Spider 运行但不输出文件

问题描述

为蜘蛛编写了一个代码来搜索网站收集某些信息。蜘蛛运行但不输出所需文件夹中的信息。知道为什么会这样。请看下面的主要代码,我没有包含 URL 链接。


def parse(self, response):        
    prices = response.css('.price::text').extract() 
    titles = response.css('img::attr(alt)').extract() 
    images = response.css('img::attr(data-altimage)').extract() 
        for item in zip(titles, prices, images ):
            scraped_info = {
                'titles' :item[0],
                'prices': item[1],
                'images': item[2],
                }
            yield scraped_info 

标签: pythonweb-crawlerscrapy-spider

解决方案


推荐阅读