Metadata-Version: 2.4
Name: ebay-web-scraper
Version: 0.0.1
Summary: Python client for scraping eBay search results and listings using the ScrapingBee web scraping API
Author: wordstotech
License: MIT
Project-URL: Homepage, https://www.scrapingbee.com/blog/how-to-scrape-ebay/
Keywords: ebay scraper,ebay scraper api,ebay web scraper,ebay data scraper,ebay product scraper,scrapingbee
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Dynamic: license-file

# 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.

```bash
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

```python
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](https://www.scrapingbee.com/).

## The client

```python
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:

```python
{
    "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

```python
# 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](https://www.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

- [How to scrape eBay (ScrapingBee)](https://www.scrapingbee.com/blog/how-to-scrape-ebay/)
- [Data extraction rules](https://www.scrapingbee.com/documentation/data-extraction/)
- [ScrapingBee pricing](https://www.scrapingbee.com/pricing/)

## 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.
