def parse(self, response):
item = BookItem()
sel = Selector(response)
e = sel.xpath("//div[@id='wrapper']")
item['name'] = e.xpath("./descendant::h1/descendant::span/text()").extract()
item['author'] = e.xpath("//*[@id='info']/span[1]/a/text()").extract()
item['bookinfo'] = e.xpath("//*[@id='info']/text()").extract()
item['score'] = e.xpath('//*[@id="interest_sectl"]/div/div[2]/strong/text()').extract()
item['commentNum'] = e.xpath('//*[@id="interest_sectl"]/descendant::span[@property = "v:votes"]/text()').extract()
item['fivestar'] = e.xpath('//*[@id="interest_sectl"]/descendant::span[@class = "rating_per"][1]/text()').extract()
item['fourstar'] = e.xpath('//*[@id="interest_sectl"]/descendant::span[@class = "rating_per"][2]/text()').extract()
item['threestar'] = e.xpath('//*[@id="interest_sectl"]/descendant::span[@class = "rating_per"][3]/text()').extract()
item['twostar'] = e.xpath('//*[@id="interest_sectl"]/descendant::span[@class = "rating_per"][4]/text()').extract()
item['onestar'] = e.xpath('//*[@id="interest_sectl"]/descendant::span[@class = "rating_per"][5]/text()').extract()
item['tag'] = response.xpath("//*[@id = 'db-tags-section']/descendant::a/text()").extract()
request = scrapy.Request(response.url + "/comments/hot", callback=self.parse_review) # ???????????
request.meta['item'] = item
return request
# ???????????
评论列表
文章目录