fix parsing of price and image path
This commit is contained in:
parent
859542119e
commit
518177fdf2
@ -29,20 +29,20 @@ def scrape_listing(url):
|
||||
#print(soup)
|
||||
#print(soup.find("div", class_="vim x-item-title").span.text)
|
||||
#print(soup.find("span", class_="ux-call-to-action__text").text)
|
||||
#print(soup.find("span", itemprop="price")["content"])
|
||||
#print(soup.find("img", itemprop="image")["src"])
|
||||
#print(float(soup.find('div', class_='x-price-primary').find('span', class_='ux-textspans').text.replace("EUR", "").strip().replace(',', '.')))
|
||||
#print(soup.find("img", loading="eager")["src"])
|
||||
|
||||
listing = {
|
||||
'title': soup.find("div", class_="vim x-item-title").span.text,
|
||||
'directbuy' : True if soup.find("span", class_="ux-call-to-action__text").text == "Sofort-Kaufen" else False,
|
||||
'price': float(soup.find("span", itemprop="price")["content"]),
|
||||
'image': soup.find("img", itemprop="image")["src"],
|
||||
'price': float(soup.find('div', class_='x-price-primary').find('span', class_='ux-textspans').text.replace("EUR", "").strip().replace(',', '.')),
|
||||
'image': soup.find("img", loading="eager")["src"],
|
||||
'url' : url
|
||||
}
|
||||
return listing
|
||||
|
||||
if __name__ == "__main__":
|
||||
#while(1):
|
||||
listing = scrape_listing("https://www.ebay.de/itm/225333003766")
|
||||
listing = scrape_listing("https://www.ebay.de/itm/226288543773")
|
||||
print(listing)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user