If you resell fashion or just hunt for bargains, the useful SHEIN listings are the ones that are discounted, in stock and quick to ship. This walkthrough shows how to scrape SHEIN products with Python using the open-source 2scraper/shein-scraper project, then turn one search into a deal sheet sorted by how much you save. You'll finish with a JSON file from SHEIN and a CSV you can open in any spreadsheet.
How to scrape SHEIN products in seven steps
You can scrape SHEIN products with a Python browser scraper that opens a search or category page, reads the product JSON SHEIN embeds in the page, and saves one row per product with price, original price, discount, rating, review count and stock, shipping and clearance flags. Exit codes and a metadata file say whether the run is complete.
The steps:
- Clone the repository and create a Python 3.9+ virtual environment.
- Install the Playwright requirements and Chromium.
- Run the offline test suite to confirm the install.
- Copy
.env.example to .env; keys are optional for a first run.
- Search with
--query "denim jacket" --max-results 20.
- Read the exit code before you open the file.
- Build the deal sheet with a short standard-library script.
| You pass | The scraper reads | You get back |
--query "denim jacket" | The search listing's window.gbRawData | Price, original_price, discount_pct, rating, review_count, in_stock, quickship, is_clearance per product |
--category "Women Jeans-c-1934.html" | The category listing, same embedded object | The same fields, scoped to a category |
--url for one product | schema.org JSON-LD (ProductGroup or Product) | Identity and price, lowest variant price when variants differ |
| Every input | Every row | currency, sku, store_code, scraped_at |
Two fields shape how you read the results. currency is USD here because only us.shein.com is tested, so region is fixed for now. And sku is SHEIN's goods_id, shared by every colour and size, which means a row describes a product, not a variant.
What makes SHEIN awkward to scrape
The listing isn't in the HTML. SHEIN renders the grid in the browser from a JavaScript object, so a plain requests call gets you a page with no products in it.
More products appear as you scroll, and the README says plainly that loading past roughly the first 20 hasn't been confirmed. The run is flagged partial when it collects fewer products than SHEIN reports.
Then there's SHEIN's risk gateway. Suspicious sessions land on /risk/challenge (a bot check) or /risk/action/limit (a rate limit). They need different handling, covered further down.
Install and check it offline
Python 3.9 or newer is required; CI runs the offline suite on 3.9 and 3.12. The project ships Playwright, Selenium and Puppeteer engines whose dependencies conflict, so pick one per virtual environment. These are the README's commands for Playwright, the recommended engine:
git clone https://github.com/2scraper/shein-scraper.git
cd shein-scraper
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements-playwright.txt
playwright install chromium
cp .env.example .env # add your keys here, never on the command line
Before going anywhere near SHEIN, run the test suite. It makes no network calls and needs no engine:
python3 smoke_test.py
The README lists 108 offline checks. If they pass, any later failure is about SHEIN or your connection, not your install. A Dockerfile is included too (docker build -t shein-scraper .) if you'd rather not touch your system Python.
.env holds four optional values. TWOCAPTCHA_KEY is one 2Captcha key used for CAPTCHA solving, the Scraping Browser API and the Fingerprint API. SHEIN_PROXY is a proxy for local engines, SHEIN_CDP_ENDPOINT a remote browser endpoint, and SHEIN_URL a default for --url. Command-line flags win over exported variables, which win over .env.
You can leave all of them empty to start. .env.example says the default is a plain local headless Chromium with no proxy and no CAPTCHA key.
Run a search and read the exit code
python3 playwright_scraper.py --query "denim jacket" --max-results 20 --out denim_deals.json
echo $?
When rows are collected, the run writes denim_deals.json and denim_deals.json.meta.json. The metadata records status, stop_reason, product count, total_results, whether --max-results capped the run, solves spent and a hash of the output. If nothing is collected, neither file is written, so an old file with the same name stays untouched. Check its scraped_at before assuming it's from today.
The exit code sorts runs into buckets you can script against:
| Code | What happened |
| 0 | Complete |
| 6 | Partial; rows written, stop_reason says why (blocked, rate_limited, remote_api_error, failed_pages, rejected_rows) |
| 3 | Blocked or rate-limited, no rows |
| 4 | Page loaded, no products |
| 5 | Content not obtained; parser_found_nothing points at a layout change |
| 2 | Bad usage |
| 1 | Crash |
For a 5, rerun with --dump-html to save what the browser received, and with --headful to watch the browser yourself. Both flags are off by default.
Want CSV directly? Add --format csv --out denim_deals.csv. The CSV gets one extra guard: cells that a spreadsheet could read as a formula are escaped, and the metadata counts them in csv_cells_escaped.
Follow a deal to its product page
Listings are good for scanning, but to extract data from a single SHEIN product page you need one more run. Feed its product_url back with --url. This picks the row with the biggest saving and scrapes its page:
URL=$(python3 -c 'import json; rows = json.load(open("denim_deals.json")); best = max(rows, key=lambda r: (r.get("original_price") or r["price"]) - r["price"]); print(best["product_url"])')
python3 playwright_scraper.py --url "$URL" --out deal_page.json
The product page is read from JSON-LD, which carries fewer fields than the listing. Watch price_source here. If the product has variants at different prices, it's json_ld_min_variant and the price is the cheapest variant, so it can sit below the listing price without anything having changed.
What happens inside a run
Chromium opens the search, locally or through --cdp-endpoint on a remote browser. The scraper reads window.gbRawData and then scrolls: at most --max-scrolls 20 times, --scroll-delay 1.5s apart, giving up after --stall-rounds 4 scrolls that add nothing. Each product becomes a row in one schema, tagged with a price_source. Failed pages are retried --retries 2 times with a --retry-delay of 3s. All three engines share the page loop in page_flow.py, so the flags don't change between them.
Handling SHEIN's bot check and rate limits
The two gateway pages need opposite responses.
/risk/challenge can be passed. The scraper clicks the "I am human" checkbox first, at no cost. If SHEIN escalates to a puzzle, the scraper screenshots it and sends it to 2Captcha: a 3x3 image grid as a GridTask, or an "icons in order" puzzle as a CoordinatesTask. Refused answers get a fresh puzzle, up to --risk-challenge-rounds (default 5).
/risk/action/limit can't be solved, because there's nothing to solve. The run exits 3, or --rate-limit-cooldown 300 makes it wait five minutes and try once more. Paying for CAPTCHAs won't help here.
Spending is under your control:
python3 playwright_scraper.py --query "denim jacket" --max-results 20 \
--solve-captcha when-blocked --max-solves 2 --out denim_deals.json
--solve-captcha accepts off, when-blocked (default) or always. --max-solves caps paid solves per run at 8 by default, and 0 means never pay. A deal sheet doesn't need to be fresh to the minute, so a cap of 2 is reasonable: if SHEIN keeps escalating past that, try again later instead of paying for more rounds.
Don't expect every challenge to clear. On 2026-09-30 the maintainers tested fresh US Scraping Browser API profiles: 3 of 5 passed, each on the third round, because SHEIN tends to reject the first one or two correct answers. The other two profiles were refused on every answer since SHEIN had flagged the profile itself.
That's why the browser matters as much as the solver. The same key works with the 2Captcha Scraping Browser API, which you plug in through SHEIN_CDP_ENDPOINT. Solving and the remote browser are separate services, billed separately. Profiles wear out: a 401 means fetch a fresh endpoint, and roughly ten back-to-back runs can get a profile rate-limited for a few minutes. Selenium can't authenticate a remote endpoint, so stay on Playwright for this setup.
One row of SHEIN data
This is a record from the repository's sample_output.json, with the long title, product_url and image_url left out:
{
"sku": "458057728",
"source": "shein.com",
"category": "Women Mini Dresses",
"brand": "Aloruh",
"price": 13.03,
"currency": "USD",
"price_source": "embedded_json",
"scraped_at": "2026-09-30T12:56:49Z",
"original_price": 20.89,
"discount_pct": 38.0,
"rating": 4.62,
"review_count": 1001,
"store_code": "4534970445",
"in_stock": true,
"is_clearance": false,
"quickship": false
}
When an item isn't discounted, original_price and discount_pct are null. When it has no reviews, rating is null. Output is JSON unless you pass --format csv.
Build a SHEIN deal sheet in CSV
This script keeps in-stock, discounted products, works out the dollar saving, and writes a CSV sorted by saving with the QuickShip and clearance flags alongside. It uses only the standard library. Save it as deal_sheet.py:
import csv
import json
import sys
src = sys.argv[1] if len(sys.argv) > 1 else "denim_deals.json"
with open(src, encoding="utf-8") as f:
rows = json.load(f)
deals = []
for r in rows:
if r.get("in_stock") is not True or r.get("original_price") is None:
continue
deals.append({
"sku": r["sku"],
"title": r.get("title"),
"price": r["price"],
"was": r["original_price"],
"saving": round(r["original_price"] - r["price"], 2),
"discount_pct": r.get("discount_pct"),
"quickship": r.get("quickship"),
"clearance": r.get("is_clearance"),
"reviews": r.get("review_count"),
"url": r.get("product_url"),
})
deals.sort(key=lambda d: d["saving"], reverse=True)
with open("deal_sheet.csv", "w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=list(deals[0]) if deals else ["sku"])
writer.writeheader()
writer.writerows(deals)
print(f"{len(deals)} deals written to deal_sheet.csv")
Run python3 deal_sheet.py denim_deals.json. Sorting by dollar saving rather than discount_pct is deliberate: on the repository sample all three items show the same 38.0% discount, but the savings work out to $10.68, $7.86 and $5.24. The flags are kept as columns, not filters, since none of the sample rows has quickship or is_clearance set. Filter on them in your spreadsheet once you have live data.
Current limits
- us.shein.com is the only tested market. Swapping the domain isn't a supported way to get other regions or currencies.
- Collection past about 20 listing products is unverified. Compare your row count with
total_results in the metadata.
- One row per product. Size- or colour-level stock isn't in the output.
--sort is saved in the metadata but not sent to SHEIN yet.
- Reviews are a
rating and a review_count, with no review text.
- Some challenges can't be solved, so a run can end with exit 3.
Legal and polite scraping
Stick to public product data. Read SHEIN's terms of service and robots.txt first, run small searches at a moderate pace, and stop when SHEIN refuses access. Nothing here logs in or touches customer accounts. If you extend the workflow to anything that identifies a person, GDPR and similar rules apply.
FAQ
Is there a SHEIN API for product prices?
The scraper doesn't use one. It reads the data SHEIN already puts in its pages (window.gbRawData on listings, JSON-LD on product pages), so no API access is involved.
Can I scrape SHEIN without a 2Captcha key?
Yes, for a first run: the default is a local headless Chromium with no key. Once SHEIN starts showing its bot check, the README recommends adding a key so the scraper can send the puzzles to 2Captcha.
How do I avoid getting blocked when scraping SHEIN?
Keep searches small and spaced out, and treat a rate limit as a signal to wait, using --rate-limit-cooldown 300. A flagged browser profile won't recover with more solves, so switch to a fresh one instead.
How much does it cost to scrape SHEIN?
The scraper is MIT-licensed and free, and a local run without a key has no service cost. Paid parts are CAPTCHA solves, capped per run with --max-solves, and any remote browser or proxy. Check current 2Captcha prices before a paid run.
Can I track SHEIN prices over time with Python?
Yes. Save runs under dated names and compare two complete ones with python3 diff_runs.py old.json new.json. It matches by sku, reports added, removed and price-changed products, and with --fail-on-change exits 1 on a real price change.
Does the SHEIN scraper collect reviews?
Only the average rating and the review_count. Review text and reviewer details aren't collected.
Try it on your own search
Swap "denim jacket" for whatever you sell or shop for, and the same two commands give you a fresh deal sheet. That's all it takes to scrape SHEIN products for a new niche. The source and every flag are documented in the shein-scraper repository on GitHub, the SHEIN Scraper page at 2scraper.com has details and more scrapers, and 2Captcha's guide How to scrape SHEIN is the full reference of all options. When SHEIN starts challenging your runs, add a 2Captcha key to .env and set --max-solves low.