ebay-scraper-api
v0.0.1
Published
Node.js client for scraping eBay search results and listings using the ScrapingBee web scraping API.
Maintainers
Readme
ebay-scraper-api
Node.js client for scraping eBay through the ScrapingBee web scraping API. Search eBay, pull listing data, and read sold prices as parsed JSON, with rendering, residential proxies, and extraction handled server-side. If you need an ebay scraper api in a Node service without running a headless browser, this is the wrapper.
npm install ebay-scraper-apiFree tier: 1,000 credits, no card, at scrapingbee.com.
Scrape an eBay search in a few lines
The common flow: search a keyword, then read the structured products back. This ebay web scraper returns a products array with title, price, url, and shipping for each listing.
const { EbayScraper } = require('ebay-scraper-api');
const scraper = new EbayScraper({ apiKey: 'YOUR-API-KEY' });
async function run() {
const results = await scraper.search('nintendo switch');
for (const item of results.products) {
console.log(item.title, item.price);
}
}
run();Every method returns a Promise. Rendering and a premium proxy are on by default, because eBay needs both.
Sold prices and pagination
// real sale prices from completed listings
const sold = await scraper.search('iphone 15', { sold: true });
// walk result pages
const pageTwo = await scraper.search('iphone 15', { page: 2 });Adding sold: true turns this into an ebay data scraper for price history, using eBay's completed-listings filter.
Scrape a specific listing or store
// rendered HTML for any eBay URL
const html = await scraper.scrape('https://www.ebay.com/itm/123456789');
// or structured JSON with your own selectors
const data = await scraper.scrape('https://www.ebay.com/str/some-store', {
extractRules: {
titles: { selector: 'h3.s-item__title', type: 'list' },
},
});API reference
new EbayScraper({ apiKey, timeout })
| Option | Type | Default | Description |
| --- | --- | --- | --- |
| apiKey | string | required | Your ScrapingBee API key |
| timeout | number | 60000 | Request timeout in milliseconds |
.search(query, options)
| Option | API parameter | Default | Description |
| --- | --- | --- | --- |
| query | _nkw | required | eBay search terms |
| page | _pgn | none | Result page number |
| sold | LH_Complete + LH_Sold | false | Filter to completed and sold listings |
| renderJs | render_js | true | Execute eBay JavaScript |
| premiumProxy | premium_proxy | true | Residential proxies |
| countryCode | country_code | us | eBay region |
| wait | wait | 5000 | Milliseconds to wait for results |
| extractRules | extract_rules | listing rules | Override the default selectors |
| extra | (any) | {} | Any other documented HTML API parameter |
.scrape(url, options)
Fetch any eBay URL. Returns rendered HTML, or JSON when extractRules is passed. Accepts the same options as search.
What a search returns
The default selectors, taken from ScrapingBee's eBay guide, produce:
{
"products": [
{
"title": "Nintendo Switch OLED",
"price": "$299.99",
"url": "https://www.ebay.com/itm/...",
"shipping": "Free shipping"
}
]
}Fields present depend on what the listing rendered, so guard with optional chaining.
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. Current pricing: scrapingbee.com/pricing.
FAQ
How do I build an ebay product scraper with this?
Call search(query) to pull the product grid, then scrape(itemUrl) for detail pages. The default rules already return title, price, url, and shipping per product.
Why does eBay block a normal request?
eBay renders listings with JavaScript and flags default HTTP clients. Rendering plus residential proxies get past that, and both are on by default here.
Can I change which fields I extract?
Yes. Pass extractRules with your own CSS or XPath selectors, or add ai_extract_rules through extra for natural-language extraction.
Is scraping eBay allowed?
Public listing data is generally collectible for research and monitoring, but eBay's terms and local rules apply. Scrape public pages only.
Links
License
MIT. See LICENSE.
Disclaimer
Unofficial Node.js wrapper around the ScrapingBee web scraping API. Not affiliated with ScrapingBee or eBay. Compliance with eBay's terms of service and applicable law is the responsibility of the operator.
