示例#1
0
 def parse_item(self, response):
     i = CafeItem()
     i["url"] = response.url
     i["brand"] = "Parlor Coffee"
     i["name"] = clean_str(response.xpath('//h2[@itemprop="name"]/text()').extract()[0])
     desc = list_to_clean_str(response.xpath('//span[@itemprop="description"]/p[1]//text()').extract())
     if len(desc) == 0:
         desc = list_to_clean_str(response.xpath('//span[@itemprop="description"]//div//text()').extract())
     i["description"] = desc
     i["size"] = list_to_clean_str(response.xpath('//span[@itemprop="description"]/p[2]//text()').extract())
     i["image"] = response.xpath('//div[@class="image_about"]/@style').extract()[0]
     i["price"] = clean_str(response.xpath('//span[@class="single_product_price"]/text()').extract()[0])
     return i
示例#2
0
 def parse_item(self, response):
     self.logger.debug("Parsing reponse from %s", response.url)
     i = CafeItem()
     i["url"] = response.url
     i["brand"] = "Counter Culture"
     name_size = clean_str(response.xpath('//div[@class="product-name"]/h1/text()').extract()[0])
     tokens = name_size.split(" - ")
     i["name"] = tokens[0]
     i["size"] = tokens[-1] if len(tokens) > 1 else ""
     i["description"] = list_to_clean_str(response.xpath('//div[@id="accordion"]//text()').extract())
     i["image"] = response.xpath('//p[@class="product-image"]/img/@src').extract()[0]
     i["price"] = clean_str(response.xpath('//span[@class="price"]/text()').extract()[0])
     return i
示例#3
0
 def parse_item(self, response):
     self.logger.debug('Parsing reponse from %s', response.url)
     i = CafeItem()
     i['url'] = response.url
     i['brand'] = 'La Colombe'
     i['name'] = clean_str(response.xpath(
         '//h1[@itemprop="name"]/text()').extract()[0])
     i['size'] = '12 oz'
     i['description'] = list_to_clean_str(response.xpath(
         '//div[@itemprop="description"]//text()').extract())
     i['image'] = response.xpath(
         '//div[@id="ProductPhoto"]/img/@src').extract()[0]
     i['price'] = clean_str(response.xpath(
         '//span[@id="ProductPrice"]/text()').extract()[0])
     return i
示例#4
0
 def parse_item(self, response):
     self.logger.debug('Parsing reponse from %s', response.url)
     i = CafeItem()
     i['url'] = response.url
     i['brand'] = 'La Colombe'
     i['name'] = clean_str(
         response.xpath('//h1[@itemprop="name"]/text()').extract()[0])
     i['size'] = '12 oz'
     i['description'] = list_to_clean_str(
         response.xpath('//div[@itemprop="description"]//text()').extract())
     i['image'] = response.xpath(
         '//div[@id="ProductPhoto"]/img/@src').extract()[0]
     i['price'] = clean_str(
         response.xpath('//span[@id="ProductPrice"]/text()').extract()[0])
     return i
示例#5
0
 def parse_item(self, response):
     self.logger.debug('Parsing reponse from %s', response.url)
     i = CafeItem()
     i['url'] = response.url
     i['brand'] = 'Counter Culture'
     name_size = clean_str(
         response.xpath('//div[@class="product-name"]/h1/text()').extract()
         [0])
     tokens = name_size.split(' - ')
     i['name'] = tokens[0]
     i['size'] = tokens[-1] if len(tokens) > 1 else ''
     i['description'] = list_to_clean_str(
         response.xpath('//div[@id="accordion"]//text()').extract())
     i['image'] = response.xpath(
         '//p[@class="product-image"]/img/@src').extract()[0]
     i['price'] = clean_str(
         response.xpath('//span[@class="price"]/text()').extract()[0])
     return i
示例#6
0
 def parse_item(self, response):
     i = CafeItem()
     i['url'] = response.url
     i['brand'] = 'Parlor Coffee'
     i['name'] = clean_str(
         response.xpath('//h2[@itemprop="name"]/text()').extract()[0])
     desc = list_to_clean_str(
         response.xpath(
             '//span[@itemprop="description"]/p[1]//text()').extract())
     if len(desc) == 0:
         desc = list_to_clean_str(
             response.xpath(
                 '//span[@itemprop="description"]//div//text()').extract())
     i['description'] = desc
     i['size'] = list_to_clean_str(
         response.xpath(
             '//span[@itemprop="description"]/p[2]//text()').extract())
     i['image'] = response.xpath(
         '//div[@class="image_about"]/@style').extract()[0]
     i['price'] = clean_str(
         response.xpath(
             '//span[@class="single_product_price"]/text()').extract()[0])
     return i