Guide
How to Scrape eBay Product Listings
A practical guide to scraping eBay product listings, prices, and seller data using Python with step-by-step code examples.
eBay is a valuable data source for price monitoring, market research, and competitive intelligence. With millions of active listings, the data potential is enormous. Here is how to scrape eBay effectively.
Why Scrape eBay?
- Price monitoring, track prices for specific products over time
- Market research, understand supply, demand, and pricing trends
- Competitive analysis, monitor competitor listings and strategies
- Arbitrage, find pricing discrepancies across platforms
Scraping eBay Search Results
eBay's search results are relatively straightforward to scrape:
import requests
from bs4 import BeautifulSoup
API_KEY = "YOUR_SCRAPERAPI_KEY"
def scrape_ebay_search(query, pages=3):
all_listings = []
for page in range(1, pages + 1):
url = f"https://www.ebay.com/sch/i.html?_nkw={query}&_pgn={page}"
response = requests.get("https://api.scraperapi.com", params={
"api_key": API_KEY,
"url": url
})
soup = BeautifulSoup(response.text, "html.parser")
items = soup.select(".s-item")
for item in items:
title_el = item.select_one(".s-item__title")
price_el = item.select_one(".s-item__price")
link_el = item.select_one(".s-item__link")
shipping_el = item.select_one(".s-item__shipping")
condition_el = item.select_one(".SECONDARY_INFO")
if title_el and "Shop on eBay" not in title_el.text:
all_listings.append({
"title": title_el.text.strip(),
"price": price_el.text.strip() if price_el else "N/A",
"shipping": shipping_el.text.strip() if shipping_el else "N/A",
"condition": condition_el.text.strip() if condition_el else "N/A",
"url": link_el["href"] if link_el else "N/A"
})
return all_listings
listings = scrape_ebay_search("iphone 15 pro")
for item in listings:
print(f"{item['title']}")
print(f" Price: {item['price']} | Shipping: {item['shipping']}")
print(f" Condition: {item['condition']}")
Scraping Individual Product Pages
def scrape_ebay_product(product_url):
response = requests.get("https://api.scraperapi.com", params={
"api_key": API_KEY,
"url": product_url,
"render": "true"
})
soup = BeautifulSoup(response.text, "html.parser")
title = soup.select_one("h1.x-item-title__mainTitle")
price = soup.select_one(".x-price-primary span")
seller = soup.select_one(".x-sellercard-atf__info__about-seller a")
condition = soup.select_one('[data-testid="x-item-condition-value"]')
return {
"title": title.text.strip() if title else "N/A",
"price": price.text.strip() if price else "N/A",
"seller": seller.text.strip() if seller else "N/A",
"condition": condition.text.strip() if condition else "N/A"
}
Using ScrapingAnt
import requests
from bs4 import BeautifulSoup
response = requests.get("https://api.scrapingant.com/v2/general", params={
"x-api-key": "YOUR_SCRAPINGANT_KEY",
"url": "https://www.ebay.com/sch/i.html?_nkw=mechanical+keyboard",
"browser": "true"
})
html = response.json()["content"]
soup = BeautifulSoup(html, "html.parser")
for item in soup.select(".s-item"):
title = item.select_one(".s-item__title")
if title and "Shop on eBay" not in title.text:
print(title.text.strip())
Data Points Available
- Product title and description
- Current price and bid information
- Shipping cost and delivery estimates
- Seller name, rating, and feedback score
- Item condition (new, used, refurbished)
- Number of watchers and items sold
- Item specifics (brand, model, color, etc.)
Best Practices
- eBay does not require heavy anti-bot handling for basic scraping
- Use ScraperAPI without rendering for search results (faster and cheaper)
- Enable rendering for individual product pages with dynamic content
- Consider eBay's Browse API for legitimate commercial applications
- Respect rate limits and add delays between requests
Verdict
eBay is one of the easier major sites to scrape. ScraperAPI handles it efficiently, often without needing JavaScript rendering for search results. ScrapingAnt works equally well. For commercial use, consider eBay's official Browse API alongside scraping for the most complete data coverage.