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)
评论列表
文章目录