quotes.py 文件源码

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

项目:base_function 作者: Rockyzsu 项目源码 文件源码
def parse(self, response):
        #print response.url.split('/')
        #sel=HtmlXPathSelector(response)

        content=response.xpath('//div[@class="quote"]')
        for x in  content:
            word= x.xpath('.//span[@class="text"]/text()').extract_first()
            print '\n'
            print word
            yield {'text':word}

        nextPage=response.css('li.next a::attr(href)').extract_first()
        if  nextPage is not None:
            goNext=response.urljoin(nextPage)
            print "Go next: ",goNext
            yield scrapy.Request(url=goNext,callback=self.parse)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号