walmart-scraper / README.md
bugrahans's picture
Upload 4 files
0cba968 verified
|
Raw History Blame Contribute Delete
3.35 kB
---
title: Walmart Scraper
short_description: Walmart products, details and price-by-ZIP as CSV/JSON
emoji: 🛒
colorFrom: blue
colorTo: yellow
sdk: gradio
sdk_version: 6.0.2
app_file: app.py
pinned: false
tags:
- walmart
- walmart-scraper
- walmart-api
- price-monitoring
- price-comparison
- ecommerce
- retail
- product-data
- web-scraping
- scraper
- data-extraction
- smolagents
- tool
- scrape.do
---
# Walmart Scraper — Powered by Scrape.do
Walmart prices and stock change from store to store. This Space ties every
request to a real store, picked by ZIP code or store number, so the numbers
match what a shopper there would see.
## 🔑 Get your free API token
👉 **[Sign up free on Scrape.do](https://dashboard.scrape.do/sign-up?utm_source=huggingface&utm_medium=walmart-scraper)** — 1,000 free credits per month, no credit card required. Every Walmart call costs 10 credits and failed calls are free, so that's about 100 calls.
## Three tabs
| Tab | Input | Output |
| --- | --- | --- |
| **Search products** | A keyword + your store | Product cards with price, sale price, rating, stock, pickup/delivery; a table and a CSV |
| **Product details** | A Walmart link, item id or product name | Price and savings, stock, seller, images, highlights, specifications, UPC/GTIN, model number, description |
| **Compare prices by ZIP** | A product + up to 5 ZIP codes | The same product's price and stock at each store, with the cheapest highlighted and a CSV |
Any product from the search results can be sent to the other two tabs with one click.
## What you can paste
- a Walmart product link (`walmart.com/ip/...`)
- the numeric item id, e.g. `17221971947`
- just the product name, e.g. `great value whole milk gallon` (costs one extra search to find it)
For the store, use a 5-digit US ZIP code (Walmart picks the nearest store) or a
Walmart store number such as `3520`.
## Why an API instead of scraping walmart.com directly
Walmart sits behind aggressive bot protection, and its prices depend on store
cookies that are tedious to manage. This Space uses the
[Scrape.do Walmart API](https://scrape.do/documentation/walmart-scraper-api/),
which handles the proxies, the bot checks and the store session, and returns
clean JSON.
## Use as a smolagents Tool
```python
from smolagents import CodeAgent, InferenceClientModel
from tool import ScrapeDoWalmartTool
agent = CodeAgent(
tools=[ScrapeDoWalmartTool(api_token="YOUR_SCRAPEDO_TOKEN")],
model=InferenceClientModel(),
)
agent.run("Find the cheapest gallon of whole milk at the Walmart nearest ZIP 60074, then compare its price in Dallas and Los Angeles.")
```
You can also set `SCRAPE_DO_API_TOKEN` in your environment and instantiate
`ScrapeDoWalmartTool()` with no arguments.
## Inputs
- `mode` *(required)* — `search`, `product` or `compare`.
- `query` *(required)* — For `search`: the keyword. For `product` and `compare`: a Walmart product link, item id or product name.
- `location` *(optional)* — A 5-digit US ZIP code or Walmart store number. For `compare`, a comma-separated list of up to 5. Defaults to `07094` (Secaucus, NJ), or four cities across the US for `compare`.
---
Learn more at [scrape.do](https://scrape.do/) · [Documentation](https://scrape.do/documentation/) · [Walmart scraping guide](https://scrape.do/blog/walmart-scraping/)