fix auction listings
This commit is contained in:
parent
fb921423aa
commit
859542119e
|
@ -71,8 +71,8 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
if competitor_listing_data:
|
if competitor_listing_data:
|
||||||
#print(competitor_listing_data["price"])
|
#print(competitor_listing_data["price"])
|
||||||
if competitor_listing_data["price"] < seller_listing_data["price"]:
|
if (competitor_listing_data["price"] < seller_listing_data["price"]) and (competitor_listing_data["directbuy"] == True):
|
||||||
#print("found cheaper competitor: " + str(competitor_listing_data["price"]) + "€ instead: " + str(seller_listing_data["price"]) + "€ ---> " + competitor_listing_url)
|
#print("found cheaper competitor: " + str(competitor_listing_data["price"]) + "€ instead: " + str(seller_listing_data["price"]) + "€ ---> " + competitor_listing_url + " Type: "+ str(competitor_listing_data["directbuy"]))
|
||||||
cheaper_listings.append({
|
cheaper_listings.append({
|
||||||
'title': competitor_listing_data["title"],
|
'title': competitor_listing_data["title"],
|
||||||
'price': competitor_listing_data["price"],
|
'price': competitor_listing_data["price"],
|
||||||
|
|
|
@ -28,11 +28,13 @@ def scrape_listing(url):
|
||||||
soup = make_soup(url)
|
soup = make_soup(url)
|
||||||
#print(soup)
|
#print(soup)
|
||||||
#print(soup.find("div", class_="vim x-item-title").span.text)
|
#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("span", itemprop="price")["content"])
|
||||||
#print(soup.find("img", itemprop="image")["src"])
|
#print(soup.find("img", itemprop="image")["src"])
|
||||||
|
|
||||||
listing = {
|
listing = {
|
||||||
'title': soup.find("div", class_="vim x-item-title").span.text,
|
'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"]),
|
'price': float(soup.find("span", itemprop="price")["content"]),
|
||||||
'image': soup.find("img", itemprop="image")["src"],
|
'image': soup.find("img", itemprop="image")["src"],
|
||||||
'url' : url
|
'url' : url
|
||||||
|
@ -40,7 +42,7 @@ def scrape_listing(url):
|
||||||
return listing
|
return listing
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
while(1):
|
#while(1):
|
||||||
listing = scrape_listing("https://www.ebay.de/itm/165841583057")
|
listing = scrape_listing("https://www.ebay.de/itm/225333003766")
|
||||||
print(listing)
|
print(listing)
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,8 @@ def search(search_term, max_pages):
|
||||||
|
|
||||||
while not last_result_page:
|
while not last_result_page:
|
||||||
result_page_added = 0
|
result_page_added = 0
|
||||||
url = 'https://www.ebay.de/sch/i.html?_from=R40&_nkw=' + search_term.replace(" ", "+") + '&_sop=10&LH_PrefLoc=1&LH_SellerType=2&LH_BIN=1&_pgn=' + str(page_counter)
|
url = 'https://www.ebay.de/sch/i.html?_from=R40&_nkw=' + search_term.replace(" ", "+") + '&_sacat=0&LH_TitleDesc=0&LH_BIN=1&rt=nc&LH_PrefLoc=3&_pgn=' + str(page_counter)
|
||||||
|
#url = 'https://www.ebay.de/sch/i.html?_from=R40&_nkw=' + search_term.replace(" ", "+") + '&_sop=10&LH_PrefLoc=1&LH_SellerType=2&LH_BIN=1&_pgn=' + str(page_counter)
|
||||||
|
|
||||||
#print ("Web Page: ", url)
|
#print ("Web Page: ", url)
|
||||||
|
|
||||||
|
@ -65,6 +66,6 @@ def search(search_term, max_pages):
|
||||||
return found_listings
|
return found_listings
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print(search("mainboard power pc", max_pages = 4))
|
print((search("LC Power LC6450 V2.2 PC Netzteil 450W Watt", max_pages = 4)))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue