示例#1
0
    def parse_item(self, response):
        airsoft = ProductItem()
        airsoft["id_product"] = self.id_product
        airsoft["id_site"] = 2
        airsoft["title"] = response.xpath(
            '//div[contains(@class,"productName")]/text()').extract_first()
        airsoft["url"] = response.request.url
        airsoft["image"] = response.xpath(
            '//a[@id="botaoZoom"]/img/@src').extract_first()
        airsoft["price"] = response.xpath(
            '//em[contains(@class, "valor-por")]/strong/text()').extract_first(
                default='99999')
        discount = response.xpath('//span[@class="msg-desconto"]/b/text()'
                                  ).extract_first(default='99999')
        if discount == '99999':
            airsoft["discount_price"] = response.xpath(
                '//strong[@class="skuBestPrice"]/text()').extract_first(
                    default='99999')
        else:
            airsoft["discount_price"] = discount
        airsoft["price"] = GlobalTools.currencytoFloat(airsoft["price"])
        airsoft["discount_price"] = GlobalTools.currencytoFloat(
            airsoft["discount_price"])

        yield airsoft
示例#2
0
 def parse_item(self, response):
     airsoft = ProductItem()
     airsoft["id_product"] = self.id_product
     airsoft["id_site"] = 1
     airsoft["title"] = response.xpath('//dt[@class="item"]/span[@class="fn"]/text()').extract_first()
     airsoft["url"] = response.request.url
     airsoft["image"] = response.xpath('//img[@id="img-product"]/@src').extract_first()
     airsoft["price"] = response.xpath('//em[@class="sale-price"]/b[@itemprop="price"]/@content').extract_first(default='99999')
     airsoft["discount_price"] = response.xpath('//div[@class="content"]/div[@class="price"]/small/b[@class="instant-price"]/text()').extract_first(default='99999')
     
     #airsoft["price"] = GlobalTools.currencytoFloat(airsoft["price"])
     airsoft["discount_price"] = GlobalTools.currencytoFloat(airsoft["discount_price"])
     
     yield airsoft
示例#3
0
 def parse_item(self, response):
     airsoft = ProductItem()
     airsoft["id_product"] = self.id_product
     airsoft["id_site"] = 8
     airsoft["title"] = response.xpath('//dt[@class="item"]/span[@itemprop="name"]/text()').extract_first()
     airsoft["url"] = response.request.url
     airsoft["image"] = response.xpath('(//img[@class="photo"])[1]/@src').extract_first()
     airsoft["price"] = response.xpath('//div[contains(@class, "purchase-info")]/div/div[@class="price"]/em/@data-base-price').extract_first(default='99999')
     airsoft["discount_price"] = response.xpath('//div[contains(@class, "purchase-info")]/div/div[@class="price"]/small/b/text()').extract_first(default='99999')
     
     #airsoft["price"] = GlobalTools.currencytoFloat(airsoft["price"])
     airsoft["discount_price"] = GlobalTools.currencytoFloat(airsoft["discount_price"])
     
     yield airsoft
示例#4
0
 def parse_item(self, response):
     airsoft = ProductItem()
     airsoft["id_product"] = self.id_product
     airsoft["id_site"] = 6
     airsoft["title"] = response.xpath('//h1/text()').extract_first()
     airsoft["url"] = response.request.url
     airsoft["image"] = response.xpath('//img[@id="imagem-principal"]/@src').extract_first()
     airsoft["price"] = response.xpath('//p[@class="preco"]/strong/text()').extract_first(default='99999')
     airsoft["discount_price"] = response.xpath('//div[@class="dados_compra"]/p[@class="parcelamento"]/strong/text()').extract_first(default='99999')
     
     airsoft["price"] = GlobalTools.currencytoFloat(airsoft["price"])
     airsoft["discount_price"] = GlobalTools.currencytoFloat(airsoft["discount_price"])
                 
     yield airsoft
示例#5
0
 def parse_item(self, response):
     airsoft = ProductItem()
     airsoft["id_product"] = self.id_product
     airsoft["id_site"] = 3
     airsoft["title"] = response.xpath('//h1/a/text()').extract_first()
     airsoft["url"] = response.request.url
     airsoft["image"] = response.xpath('(//ul[contains(@class,"product-photos-list")]/li/a/img/@src)[1]').extract_first()
     airsoft["price"] = response.xpath('(//div[contains(@class,"purchase-info")])[1]/div[@class="content"]/div[@class="price"]/em/@data-base-price').extract_first(default='99999')
     airsoft["discount_price"] = response.xpath('(//div[contains(@class,"purchase-info")])[1]/div[@class="content"]/div[@class="price"]/small/b/text()').extract_first(default='99999')
     
     #airsoft["price"] = GlobalTools.currencytoFloat(airsoft["price"])
     airsoft["discount_price"] = GlobalTools.currencytoFloat(airsoft["discount_price"])
     
     
    
     
     yield airsoft
示例#6
0
    def parse_item(self, response):
        airsoft = ProductItem()
        airsoft["id_product"] = self.id_product
        airsoft["id_site"] = 4
        airsoft["title"] = response.xpath('//h1/text()').extract_first()
        airsoft["url"] = response.request.url
        airsoft["image"] = response.xpath(
            '(//figure/a/img/@src)[1]').extract_first()
        airsoft["price"] = response.xpath(
            '//p[@class="price"]/span[@class="electro-price"]/ins/span/text()'
        ).extract_first(default='99999')
        airsoft["discount_price"] = response.xpath(
            '//p[@class="price"]/span[@class="electro-price"]/ins/span/text()'
        ).extract_first(default='99999')

        airsoft["price"] = GlobalTools.currencytoFloat(airsoft["price"])
        airsoft["discount_price"] = GlobalTools.currencytoFloat(
            airsoft["discount_price"])

        yield airsoft