fix scrape for new website
This commit is contained in:
parent
a0971823b5
commit
1a37c403e3
22
README.md
22
README.md
|
@ -1,3 +1,23 @@
|
||||||
# eBayCompetitorPriceCompare
|
# eBayCompetitorPriceCompare
|
||||||
|
|
||||||
scrape ebay(.de) for competitors listings and compare the price to own ebay shop
|
scrape ebay(.de) for competitors listings and compare the price to own ebay shop
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
```
|
||||||
|
pip install tinydb tqdm
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Scrape listings
|
||||||
|
Scrape all listings from seller's shop with `python search_seller.py`
|
||||||
|
This will create `seller_db.json` with all found listings.
|
||||||
|
Delete this file before next run manually.
|
||||||
|
|
||||||
|
### Compare listings
|
||||||
|
Compare and export all found listings with `python compare.py`
|
||||||
|
This will take a while and exports the static html.
|
||||||
|
|
||||||
|
## Example export
|
||||||
|
See `example_export/` for an example.
|
|
@ -28,18 +28,18 @@ def scrape_listing(url):
|
||||||
soup = make_soup(url)
|
soup = make_soup(url)
|
||||||
|
|
||||||
#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", id="prcIsum")["content"])
|
#print(soup.find("span", itemprop="price")["content"])
|
||||||
#print(soup.find("img", id="icImg")["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,
|
||||||
'price': float(soup.find("span", id="prcIsum")["content"]),
|
'price': float(soup.find("span", itemprop="price")["content"]),
|
||||||
'image': soup.find("img", id="icImg")["src"],
|
'image': soup.find("img", itemprop="image")["src"],
|
||||||
'url' : url
|
'url' : url
|
||||||
}
|
}
|
||||||
return listing
|
return listing
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
listing = scrape_listing("https://www.ebay.de/itm/165508291809")
|
listing = scrape_listing("https://www.ebay.de/itm/162861653490")
|
||||||
print(listing)
|
print(listing)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue