예제 #1
0
    def retrieve_product_data(self, product_link):
        browser = mechanize.Browser()
        browser.set_handle_robots(False)
        product_data = browser.open(product_link).get_data()
        soup = BeautifulSoup(product_data)

        name = soup.find('div', {'id': 'ficha-producto-nombre'})

        if not name:
            return None
        name = name.string.encode('ascii', 'ignore').strip()

        has_cencosud_card_price =\
        soup.find('div', {'id': 'ficha-producto-precio-mas'})

        if has_cencosud_card_price:
            mas_price = clean_price_string(has_cencosud_card_price.contents[0])
            price = int(mas_price)
        else:
            normal_price = soup.find('div', {'id': 'ficha-producto-precio'})
            normal_price = normal_price.string.split('$')[1]
            price = int(clean_price_string(normal_price))

        product_data = ProductData()
        product_data.custom_name = name
        product_data.price = price
        product_data.url = product_link
        product_data.comparison_field = product_link

        return product_data
예제 #2
0
파일: paris.py 프로젝트: vkhemlan/solotodo
    def retrieve_product_data(self, product_link):
        browser = mechanize.Browser()
        browser.set_handle_robots(False)
        product_data = browser.open(product_link).get_data()
        soup = BeautifulSoup(product_data)

        name = soup.find('div', {'id': 'ficha-producto-nombre'})

        if not name:
            return None
        name = name.string.encode('ascii', 'ignore').strip()

        has_cencosud_card_price =\
        soup.find('div', {'id': 'ficha-producto-precio-mas'})

        if has_cencosud_card_price:
            mas_price = clean_price_string(has_cencosud_card_price.contents[0])
            price = int(mas_price)
        else:
            normal_price = soup.find('div', {'id': 'ficha-producto-precio'})
            normal_price = normal_price.string.split('$')[1]
            price = int(clean_price_string(normal_price))
        
        product_data = ProductData()
        product_data.custom_name = name
        product_data.price = price
        product_data.url = product_link
        product_data.comparison_field = product_link
        
        return product_data
예제 #3
0
파일: wei.py 프로젝트: vkhemlan/solotodo
    def retrieve_product_data(self, product_link):
        br = mechanize.Browser()
        soup = BeautifulSoup(br.open(product_link).get_data())

        name = soup.find('title').string.split(
            'WEI CHILE - ')[1].encode('ascii', 'ignore')

        not_available_image = soup.find('img', {
            'src': 'img/iconos/stocks/stk6.png'})

        if not_available_image:
            return name, {}


        price = soup.find('h2', 'precio').string
        price = int(clean_price_string(price))

        productData = ProductData()

        productData.custom_name = name
        productData.price = price
        productData.url = product_link
        productData.comparison_field = productData.url

        return productData
예제 #4
0
    def retrieve_product_data(self, productUrl):
        br = mechanize.Browser()
        data = br.open(productUrl).get_data()
        soup = BeautifulSoup(data)

        name = soup.find('h3').string.encode('ascii', 'ignore')

        internet_price = int(clean_price_string(
            soup.find('p', 'precio').find('em').contents[-1]))

        productData = ProductData()
        productData.custom_name = name
        productData.price = internet_price
        productData.url = productUrl
        productData.comparison_field = productData.url
        return productData
예제 #5
0
    def retrieve_product_data(self, product_link):
        browser = mechanize.Browser()
        soup = BeautifulSoup(browser.open(product_link).get_data())

        title = soup.find('h1').string.encode('ascii', 'ignore')

        price_string = soup.findAll('span', 'price')[-1].string
        price = int(clean_price_string(price_string))

        productData = ProductData()
        productData.custom_name = title
        productData.price = price
        productData.url = product_link
        productData.comparison_field = productData.url

        return productData
예제 #6
0
    def retrieve_product_data(self, product_link):
        browser = mechanize.Browser()
        soup = BeautifulSoup(browser.open(product_link).get_data())

        title = soup.find('h1').string.encode('ascii', 'ignore')

        price_string = soup.findAll('span', 'price')[-1].string
        price = int(clean_price_string(price_string))

        productData = ProductData()
        productData.custom_name = title
        productData.price = price
        productData.url = product_link
        productData.comparison_field = productData.url

        return productData
예제 #7
0
    def retrieve_product_data(self, product_link):
        browser = mechanize.Browser()
        product_data = browser.open(product_link).get_data()
        soup = BeautifulSoup(product_data)

        name = soup.find('h1').string.encode('ascii', 'ignore').strip()

        cash_price = int(
            round(
                int(
                    clean_price_string(
                        soup.findAll('span', 'price')[-1].string)) * 0.97))

        product_data = ProductData()
        product_data.custom_name = name
        product_data.price = cash_price
        product_data.url = product_link
        product_data.comparison_field = product_link

        return product_data
예제 #8
0
    def retrieve_product_data(self, product_link):
        br = mechanize.Browser()
        soup = BeautifulSoup(br.open(product_link).get_data())

        name = soup.find('title').string.split('WEI CHILE - ')[1].encode(
            'ascii', 'ignore')

        not_available_image = soup.find('img',
                                        {'src': 'img/iconos/stocks/stk6.png'})

        if not_available_image:
            return name, {}

        price = soup.find('h2', 'precio').string
        price = int(clean_price_string(price))

        productData = ProductData()

        productData.custom_name = name
        productData.price = price
        productData.url = product_link
        productData.comparison_field = productData.url

        return productData