def get_prices(offer): div = offer.find("div", {"class": "pl--description"}) price = div.find("span", {"class": "price"}) new_price = price.find("span", class_="new") price = new_price if new_price else price num = re.sub('[^0-9]', '', price.text) num = float(num) if "PLN" in price.text: return convert("PLN", "USD", num) elif "€" in price.text: return convert("EUR", "USD", num) else: raise ValueError("No currency match")
def get_price(offer): prices = offer.find('p', class_="products__item-price") spans = prices.find_all("span") if len(spans) == 1: price = spans[0] else: price = spans[1] price = price.text.replace("PLN", "") price = float(price) return convert("PLN", "USD", price)
def get_prices(offer): price = offer.attrs["data-price"] price = float(price) return convert("PLN", "USD", price)
def get_price(offer): price = offer.cssselect('a > p > em')[0].text price = re.sub('[^\d,]', '', price) price = price.replace(',', '.', 1) return convert(frm='PLN', to='USD', amount=float(price))
def get_price(offer): price_tag = offer.find("span", {"class": "price-tag"}) pln = price_tag.find("span", {"data-currency_key": "PLN"}).text pln = re.sub("[^0-9]", "", pln) pln = float(pln) return convert("PLN", "USD", pln)
def get_prices(offer): price_tag = offer.find("span", {"class": "price"}) price = price_tag.text.replace(',', '.') price = price.replace('zł', '') price = float(price) return convert("PLN", "USD", price)
def get_price(offer): price = offer['price']['promotional'] price = price.replace(',', '.') price = re.sub(r'[^\d.]', '', price) price = float(price) return convert(frm='PLN', to='USD', amount=price)
def get_prices(offer): price = offer.find('span', class_='salesprice').text price = re.sub('[^\d,]', '', price) price = price.replace(',', '.') price = float(price) return convert("PLN", "USD", price)
def get_price(offer): span = offer.find("span", attrs={"class": re.compile("CurrencySizeMedium curprice")}) price = span.text.replace(",", ".") price = float(re.sub('[^\d.]', '', price)) return convert("PLN", "USD", price)
def get_price(offer): price = offer.cssselect('div > div > div.gl-product-card__details > a ' '> div.gl-product-card__details-main > div.gl-price-container > span')[0].text price = re.sub('\D', '', price) return convert("PLN", "USD", float(price))