Skip to main content

Python client for scraping eBay search results and listings using the ScrapingBee web scraping API

Project description

ebay-web-scraper

Scrape eBay search results and listings into parsed JSON. A thin Python wrapper over the ScrapingBee web scraping API that renders eBay, routes through residential proxies, and extracts fields using the CSS selectors from ScrapingBee's eBay guide.

pip install ebay-web-scraper

Covers the searches people run: ebay scraper, ebay scraper api, ebay web scraper, ebay data scraper, ebay product scraper. Requires Python 3.8+ and requests.

30-second example

from ebay_web_scraper import EbayScraper

scraper = EbayScraper(api_key="YOUR_API_KEY")

results = scraper.search("nintendo switch")
for item in results["products"]:
    print(item.get("title"), item.get("price"))

Grab a key first. ScrapingBee gives 1,000 credits with no card at scrapingbee.com.

The client

EbayScraper(api_key: str, timeout: int = 60)

Every request renders JavaScript and uses a premium (residential) proxy by default, because eBay needs both. The client serializes extraction rules and builds eBay URLs for you.

Methods

search(query, page=None, sold=False, **kwargs)

Search eBay and return structured listings. Returns a dict with a products list.

Argument Purpose
query Search terms (required)
page Page number for pagination (_pgn)
sold True filters to completed and sold listings
render_js Execute eBay JavaScript (default True)
premium_proxy Residential proxies (default True)
country_code eBay region (default "us")
wait Milliseconds to wait for results (default 5000)
extract_rules Override the default listing selectors
extra Dict of any other documented HTML API parameter

Each product carries the fields defined by the default rules: title, price, url, and shipping.

scrape(url, extract_rules=None, **kwargs)

Fetch any eBay URL, such as a single product page, a store, or a category. Returns rendered HTML by default, or JSON when you pass extract_rules.

Selectors

The default extraction targets eBay search results with the selectors from ScrapingBee's guide:

{
    "products": {
        "selector": "li.s-card",
        "type": "list",
        "output": {
            "title": "div.s-card__title span.su-styled-text",
            "price": "span.s-card__price",
            "url": {"selector": "a.s-card__link:not(.image-treatment)", "output": "@href"},
            "shipping": "div.s-card__attribute-row",
        },
    }
}

When eBay changes its markup, pass your own extract_rules, or add ai_extract_rules through extra for natural-language extraction.

Sold prices and pagination

# real sale prices from completed listings
sold = scraper.search("iphone 15", sold=True)

# walk result pages
page_two = scraper.search("iphone 15", page=2)

Credits

ScrapingBee bills successful requests. An eBay search with rendering and a premium proxy costs 25 credits. CSS extraction adds nothing; ai_extract_rules adds 5. See scrapingbee.com/pricing.

Notes

  • Scrape public eBay pages only. ScrapingBee's terms prohibit scraping behind a login.
  • Selectors reflect eBay's current search markup and may need updating over time.

Links

License

MIT

Disclaimer

Unofficial Python client built on the ScrapingBee web scraping API. Not affiliated with ScrapingBee or eBay. Comply with eBay's terms of service and applicable law.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ebay_web_scraper-0.0.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ebay_web_scraper-0.0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file ebay_web_scraper-0.0.1.tar.gz.

File metadata

  • Download URL: ebay_web_scraper-0.0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for ebay_web_scraper-0.0.1.tar.gz
Algorithm Hash digest
SHA256 62cde5d387b4f4dcd6df77d0c831486d9ada304040f954c6fbc20ab6f0ba3aac
MD5 dc90d0b24b6817598352e67b0004c111
BLAKE2b-256 7d28d1c32d1f906e93ca8d7083d3e95da910607b876e86324510a9c8d4a6bb2f

See more details on using hashes here.

File details

Details for the file ebay_web_scraper-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ebay_web_scraper-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da882b66a44cc87b9bfdb7ec037a977b50ba78f67747c2d0fcb2a518cdab6598
MD5 273b8c2bd7f574a821eccc5d9b034b40
BLAKE2b-256 bc2e679634e3f0a94054ca2b7f2ba053fcfed624f3cd8213e99530dfd4b120f8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page