Example #1
0
 def parse_indetail(self,response):
     item = MovieItem()
     item['title'] = response.xpath('//div[@class="title_wrapper"]/h1/text()').extract()[0][:-1]
     item['directors'] = response.xpath('//div[@class="credit_summary_item"]/span[@itemprop="director"]/a/span/text()').extract()[0]
     item['writers'] = response.xpath('//div[@class="credit_summary_item"]/span[@itemprop="creator"]/a/span/text()').extract()
     item['stars'] = response.xpath('//div[@class="credit_summary_item"]/span[@itemprop="actors"]/a/span/text()').extract()
     item['popularity'] = response.xpath('//div[@class="titleReviewBarSubItem"]/div/span/text()').extract()[2][21:-8]
     
     return item
Example #2
0
 def parse_detail(self, response):
     """
     process detail info of book
     :param response:
     :return:
     """
     name = response.css('h2::text').extract_first()
     categories = response.css('.categories button span::text').extract()
     score = response.css('.score::text').extract_first()
     categories = [category.strip() for category in categories] if categories else []
     score = score.strip() if score else None
     yield MovieItem(name=name, categories=categories, score=score)