示例#1
0
    def parse(self, response):
        # page = response.url.split("/")[-2]
        #filename = 'quotes-%s.html' % page
        #with open(filename, 'wb') as f:
        #    f.write(response.body)
        #self.log('Saved file %s' % filename)
        for producteRAW in response.css(
                'div.products article.product-miniature'):

            loader = ItemLoader(item=Producte(), selector=producteRAW)
            loader.add_css('nom', 'h2.product-title > a::text')
            loader.add_css('url', 'h2.product-title > a::attr(href)')
            loader.add_css('preu',
                           'div.product-price-and-shipping span.price::text')
            loader.add_css(
                'preu_original',
                'div.product-price-and-shipping span.regular-price::text')

            agotado = producteRAW.css('ul.product-flags li.agotado').get()
            if agotado is not None:
                loader.add_value('stock', 'Agotado')
            else:
                loader.add_value('stock', 'Disponible')

            producte = loader.load_item()

            producte['botiga'] = 'Jugamosotra'

            yield producte

        #PAGINES SEGÜENTS
        for next_page in response.css('ul.page-list a[rel=next]::attr(href)'):
            #print("next!")
            yield response.follow(next_page, self.parse)
示例#2
0
    def parse(self, response):

        for producteRAW in response.css('div.products div.product-small'):
            loader = ItemLoader(item=Producte(), selector=producteRAW)

            loader.add_css('nom', 'p.product-title a::text')
            loader.add_css('url', 'p.product-title a::attr(href)')
            loader.add_css('preu', 'span.price ins span.amount bdi::text')
            loader.add_css('preu', 'span.price span.amount bdi::text')
            loader.add_css('preu_original',
                           'span.price del span.amount bdi::text')

            textstock = producteRAW.css('p.stock::text').get()
            if textstock == "Disponible":
                loader.add_value('stock', 'Disponible')
            else:
                loader.add_value('stock', 'Agotado')

            producte = loader.load_item()

            producte['botiga'] = 'Egdgames'

            if producte['nom'] != "Blue Max":
                yield producte

        #PAGINES SEGÜENTS
        for next_page in response.css('link[rel=next]::attr(href)'):
            #print("next!")
            yield response.follow(next_page, self.parse)
    def parse(self, response):
        # page = response.url.split("/")[-2]
        #filename = 'quotes-%s.html' % page
        #with open(filename, 'wb') as f:
        #    f.write(response.body)
        #self.log('Saved file %s' % filename)

        for producteRAW in response.css('li.product_item'):
            loader = ItemLoader(item=Producte(), selector=producteRAW)

            loader.add_css('nom', 'h3.product-title > a::attr(title)')
            loader.add_css('url', 'h3.product-title > a::attr(href)')
            loader.add_css(
                'preu', 'button.product-price-and-shipping > span.price::text')

            disabled = producteRAW.css(
                'button.product-price-and-shipping::attr(disabled)').get()
            if disabled is None:
                loader.add_value('stock', 'Disponible')
            else:
                loader.add_value('stock', 'Agotado')

            producte = loader.load_item()

            producte['botiga'] = 'JugamosUna'
            yield producte

        #PAGINES SEGÜENTS
        for next_page in response.css('ul.page-list a[rel=next]::attr(href)'):
            #print("next!")
            yield response.follow(next_page, self.parse)
            pass
示例#4
0
    def parse(self, response):
        #page = response.url.split("/")[-2]
        #filename = 'quotes-%s.html' % page
        # with open(filename, 'wb') as f:
        #    f.write(response.body)
        #self.log('Saved file %s' % filename)

        for producteRAW in response.css(
                'div#products-list div.product_preview-body'):

            loader = ItemLoader(item=Producte(), selector=producteRAW)
            loader.add_css('nom', 'div.title-box p.product_preview-desc::text')
            loader.add_css('url',
                           'div.title-box h2.plp_title_seo > a::attr(href)')
            loader.add_css('preu', 'div.product_preview-buy span.price')
            loader.add_css(
                'preu_original',
                'div.product_preview-buy span.price-tagline span.price')

            loader.add_value('stock', 'Disponible')

            producte = loader.load_item()

            producte['botiga'] = 'ECI'

            yield producte

        #PAGINES SEGÜENTS
        for next_page in response.css(
                'div.pagination a[rel=next]::attr(href)'):
            #print("next!")
            yield response.follow(next_page, self.parse)
            pass
    def parse(self, response):
        # page = response.url.split("/")[-2]
        #filename = 'quotes-%s.html' % page
        #with open(filename, 'wb') as f:
        #    f.write(response.body)
        #self.log('Saved file %s' % filename)

        for producteRAW in response.css('li.product-item'):

            hidden = producteRAW.css('a.delete').get()
            if hidden is None:
                loader = ItemLoader(item=Producte(), selector=producteRAW)
                loader.add_css('nom', 'strong.product-item-name > a::text')
                loader.add_css('url',
                               'strong.product-item-name > a::attr(href)')
                loader.add_css(
                    'preu_original',
                    'div.price-box span[data-price-type=oldPrice] span.price::text'
                )
                loader.add_css(
                    'preu',
                    'div.price-box span[data-price-type=finalPrice] span.price::text'
                )

                unavailable = producteRAW.css('div.unavailable span').get()
                if unavailable is None:
                    loader.add_value('stock', 'Disponible')
                else:
                    loader.add_value('stock', 'Agotado')

                producte = loader.load_item()

                producte['botiga'] = 'Zacatrus'

                yield producte

        #PAGINES SEGÜENTS
        for next_page in response.css(
                'li.pages-item-next  a.next::attr(href)'):
            #print("next!")
            yield response.follow(next_page, self.parse)
            pass
    def parse(self, response):
        # page = response.url.split("/")[-2]
        #filename = 'quotes-%s.html' % page
        #with open(filename, 'wb') as f:
        #    f.write(response.body)
        #self.log('Saved file %s' % filename)
        for producteRAW in response.css('div.laberProductGrid div.item'):

            loader = ItemLoader(item=Producte(), selector=producteRAW)
            loader.add_css('nom', 'h2.productName > a::text')
            loader.add_css('url', 'h2.productName > a::attr(href)')
            loader.add_css(
                'preu',
                'div.laber-product-price-and-shipping span.price::text')
            loader.add_css(
                'preu_original',
                'div.laber-product-price-and-shipping span.regular-price::text'
            )

            available = producteRAW.css(
                'div.LaberProduct-availability span.product-availability').get(
                )
            if "Fuera de stock" in available:
                loader.add_value('stock', 'Agotado')
            else:
                loader.add_value('stock', 'Disponible')

            producte = loader.load_item()

            producte['botiga'] = 'Dracotienda'

            yield producte

        #PAGINES SEGÜENTS
        for next_page in response.css(
                'nav.pagination a[rel=next]::attr(href)'):
            #print("next!")
            yield response.follow(next_page, self.parse)
示例#7
0
    def parse(self, response):
        # page = response.url.split("/")[-2]
        #filename = 'quotes-%s.html' % page
        #with open(filename, 'wb') as f:
        #    f.write(response.body)
        #self.log('Saved file %s' % filename)

        for producteRAW in response.css(
                'div.center_column div.product-container'):
            loader = ItemLoader(item=Producte(), selector=producteRAW)

            loader.add_css('nom',
                           'div.pro_second_box a.product-name::attr(title)')
            loader.add_css('editorial', 'p.pro_list_manufacturer::text')
            loader.add_css('url',
                           'div.pro_second_box a.product-name::attr(href)')
            loader.add_css('preu', 'span.price::text')
            loader.add_css('preu_original', 'span.old-price::text')

            textstock = producteRAW.css('div.availability span::text').get()

            if textstock is not None and textstock.strip() == "Agotado":
                loader.add_value('stock', 'Agotado')
            else:
                loader.add_value('stock', 'Disponible')

            producte = loader.load_item()

            producte['botiga'] = 'Mathom'
            if "preu" in producte:
                producte['preu'] = float(producte['preu']) * 0.95
            yield producte

        #PAGINES SEGÜENTS
        for next_page in response.css('a.subcategory-name'):
            #pass
            yield response.follow(next_page, self.parse)