pipelines.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:scrapy_projects 作者: morefreeze 项目源码 文件源码
def process_item(self, item, spider):
        """save to redis and return item

        :item: crawl item including host port
        :returns: return item or DropItem
        """
        if 'ip' not in item:
            raise DropItem('')
        port = item.get('port', 80)
        host = '%s:%s' % (item['ip'], port)
        self.conn.sadd(self.host_s, host)
        return item
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号