A small, dependency-light Python tool to scrape eBay search listings to CSV, JSON, or JSONL — from the command line or as a Python library.
- Scrape eBay search results by keyword (e.g.
laptop,vintage camera). - Extracts title, price, condition, item URL, seller, seller feedback, sold count, and watchers (the last few when eBay shows them on the card).
- Targets eBay's current
li.s-cardlayout (the legacys-itemselector no longer works). - Outputs CSV / JSON / JSONL, to stdout or a file.
- Maintains a cookie session and uses browser-like headers + randomized delays to behave politely.
- Zero heavy dependencies: just
requests+beautifulsoup4.
pip install ebay-listings-scraperOr from source:
git clone https://github.com/thunderbit-operations/ebay-scraper.git
cd ebay-scraper
pip install -e .# Scrape the first page of "laptop" results to CSV (stdout)
ebay "laptop"
# Two pages, JSON, to a file
ebay "vintage camera" --pages 2 --format json --output cameras.json
# Just count results
ebay "mechanical keyboard" --countebay QUERY [options]
Positional:
QUERY Search query, e.g. "laptop" or "vintage camera".
Options:
-p, --pages N Number of result pages to scrape (default: 1).
-f, --format FMT Output format: csv | json | jsonl (default: csv).
-o, --output PATH Output file path (default: stdout).
--count Only print the number of listings found.
--min-delay SECONDS Minimum delay between requests (default: 2.0).
--max-delay SECONDS Maximum delay between requests (default: 5.0).
The ebay-listings-scraper command is installed as an alias for ebay.
from ebay_scraper import EbayScraper, scrape
# Quick helper -> list of dicts
rows = scrape("laptop", pages=1)
print(rows[0])
# Full control
scraper = EbayScraper(delay_range=(2.0, 5.0))
listings = scraper.search("vintage camera", pages=2)
for l in listings:
print(l.title, l.price, l.condition, l.url)
# Parse saved HTML offline (no network)
html = open("search.html", encoding="utf-8").read()
listings = EbayScraper.parse(html)Each listing exposes: title, price, condition, url, seller, seller_feedback, sold, watchers, plus .as_dict().
- The scraper first issues a
GET https://www.ebay.com/to collect eBay's anti-bot cookies. Without this warm-up, search pages start returning HTTP 403 after the first request. - It then fetches
https://www.ebay.com/sch/i.html?_nkw={query}&_pgn={page}using the samerequests.Session, full Chrome-like headers, andReferer: https://www.ebay.com/. - Results are parsed with BeautifulSoup. Each product is a
li.s-card; the title is in.s-card__title .su-styled-text, the price in.su-styled-text--emphasis, condition in the first segment of.s-card__subtitle, and seller feedback / sold count are read from the card text. The leading "Shop on eBay" placeholder ad card is skipped. - Requests are spaced out by a randomized delay (default 2–5 s).
Be honest about what this is: a lightweight, best-effort scraper, not an enterprise data pipeline.
- It relies on cookie + IP reputation. A single residential/clean IP works for light use, but scraping many pages or running it frequently will get throttled or 403'd. For large-scale scraping you need to rotate IPs / proxies yourself — this tool does not do that.
- No login, no CAPTCHA solving. If eBay serves an interstitial or challenge page, the scraper will simply return no listings.
- Selectors can break. eBay changes its markup periodically (this tool already had to migrate from
s-itemtos-card). When the layout changes, the selectors inebay_scraper/scraper.pywill need updating. - Search cards only. It reads what's on the search results page. Some fields (seller name, watchers) are not always present on the card and will be
None. It does not visit individual item pages. - Respect eBay's Terms of Service and
robots.txt, and only scrape data you are permitted to access.
💡 Don't want to write code, rotate IPs, or fix selectors when eBay changes layout? Thunderbit is an AI web scraper Chrome extension that scrapes eBay (and any site) in 2 clicks, no code.
- redfin-scraper — scrape Redfin property listings.
- sitejabber-scraper — scrape Sitejabber business reviews.
- craigslist-scraper — scrape Craigslist listings.
- goodreads-scraper — scrape Goodreads books and reviews.
This project is for educational and research purposes. You are responsible for how you use it. Scraping may be subject to eBay's Terms of Service and applicable laws — review them and scrape responsibly (reasonable rate limits, only publicly accessible data).