doubanBookSpider.py 文件源码

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

项目:doubanBook 作者: YangShuqing 项目源码 文件源码
def parse(self, response):
        selector = Selector(response)
        books = selector.xpath('//div[@class="info"]/h2/a/@href').extract()
        for book in books:
            print book
            yield Request(book, callback=self.parse_item)

        nextPage = selector.xpath('//span[@class="next"]/a/@href').extract()
        if nextPage:
            print nextPage[0]
            yield Request(self.url+nextPage[0],callback=self.parse)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号