How to Scrape SHEIN Products with Python

SHEIN prices and discounts change often, and the site does little to make collecting them easy. This walkthrough shows how to scrape SHEIN products with Python using the open-source shein-scraper: point it at a category, get one row per product with price, discount, rating and stock, then compare two runs to see what got cheaper. Most of the effort goes into the part that decides whether a run returns any data at all: SHEIN's own captcha gate.

Checked against shein-scraper 0.2.0 (released 2026-10-16). The challenge pass rates below were measured on 2026-09-30. Python 3.9 or newer.

How to scrape SHEIN products in seven steps

  1. Clone 2scraper/shein-scraper and create a virtualenv.
  2. Install the Playwright engine and Chromium.
  3. Copy .env.example to .env and put your keys there.
  4. Run playwright_scraper.py with --query, --category or --url.
  5. Check the exit code and the .meta.json file written next to the output.
  6. Read the JSON, or export CSV with --format csv.
  7. Compare two runs with diff_runs.py.

What the scraper collects from SHEIN

You give itYou get back
A search, --query "linen pants"One row per listed product: title, brand, price, original_price, discount_pct, rating, review_count, in_stock, is_clearance, quickship, image_url, product_url
A category, --category "Women Jeans-c-1934.html"The same fields, plus SHEIN's own category name
A product page, --url ".../dsbayvkj-p-33704388.html"One row read from the page's schema.org JSON-LD
A product with colours and sizesStill one row. sku is SHEIN's goods_id, the same across all variants. If variant prices differ, price is the lowest one and price_source says json_ld_min_variant
Region and currencyPrices from us.shein.com, with the currency in currency (USD in every sample row). Other SHEIN country sites have not been tested

Listing data comes from the page's embedded window.gbRawData object, not from parsed HTML. The prices and ids are SHEIN's own values, so a CSS redesign does not quietly break them.

Why SHEIN is hard to scrape

There are three separate problems, and they need different fixes.

The first is the risk gateway. A visitor SHEIN finds suspicious is redirected to /risk/challenge. It starts with an "I am human" checkbox and can escalate to a 3x3 "select the images matching the icon" grid, or to a "click the icons in order" puzzle. One run can get a different widget on each round.

The second is the rate limit. Too many requests from one identity end up at /risk/action/limit. Nothing there can be solved. The README notes that a Scraping Browser profile may be rate-limited for a few minutes after roughly ten runs in a row.

The third is pagination, or the lack of it. A listing is one infinitely scrolling page. Only the first batch of about 20 products is embedded in the HTML, so there is no page 2 URL to request in parallel.

Installing the SHEIN scraper

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

The .env file takes three variables: TWOCAPTCHA_KEY, SHEIN_CDP_ENDPOINT and SHEIN_PROXY. You don't need any of them for the first test. A local browser runs without keys, and clicking the checkbox costs nothing. For regular use the README recommends a 2Captcha Scraping Browser API profile in SHEIN_CDP_ENDPOINT together with a solver key, because SHEIN challenges or rate-limits plain local browsers quickly.

Playwright is the engine to start with. Selenium and Puppeteer engines exist, but the three conflict with each other and each needs its own virtualenv. Selenium also cannot connect to a Scraping Browser endpoint.

First run: a category for price monitoring

For a price tracker you want the same selection every time, so a category is a better choice than a free-text search:

python3 playwright_scraper.py --category "Women Jeans-c-1934.html" --max-results 20 --out jeans-monday.json

This writes jeans-monday.json and jeans-monday.json.meta.json. Read it before you trust the data. It records the status, stop_reason, the product count, SHEIN's own total_results, whether --max-results cut the run short, solves_spent and a hash of the output file.

I'd keep --max-results at 20 for now. The scraper scrolls for more, but every live run so far asked for 20 or fewer, and the README states plainly that loading products past the first ~20 has not been confirmed.

The exit code tells a cron job what happened: 0 complete, 6 partial (rows were written, stop_reason says why), 3 blocked or rate-limited with no rows, 4 no products on the page, 5 content never obtained. A run that collects nothing writes no files, so last week's good file is never overwritten with an empty one.

How the scraper gets past SHEIN's captcha

When SHEIN redirects to /risk/challenge, the scraper first clicks the "I am human" checkbox, which is free. If SHEIN escalates, the scraper screenshots the puzzle and sends it to 2Captcha: the image grid as a GridTask, the icon sequence as a CoordinatesTask. It clicks the returned answer and asks for a fresh puzzle if SHEIN refuses it.

In a test with five fresh US Scraping Browser profiles, three passed the challenge, each on its third round. SHEIN usually refuses the first correct answer or two, which is why --risk-challenge-rounds defaults to 5. The other two profiles were refused on every answer, including answers that were correct. SHEIN had flagged the profile itself, and no solver fixes that. In that case the run exits with code 3 instead of returning bad data.

Spending is capped per run. --max-solves defaults to 8 and 0 never pays, and the actual count lands in solves_spent. For a scheduled job I would set it lower than 8. A profile that passed once keeps its cookies and usually scrapes without new challenges, so after the first day most runs should need zero solves. A steadily rising solves_spent is a sign the profile needs replacing.

The rate-limit gate, /risk/action/limit, has nothing to solve. The run stops with exit 3. With --rate-limit-cooldown 300 it waits and retries once.

What a SHEIN product record looks like

A real row from the repository's sample_output.json:

{
  "sku": "458057728",
  "source": "shein.com",
  "category": "Women Mini Dresses",
  "title": "Aloruh Women's Solid Color Sleeveless Mini Dress, Suitable For Beach Vacation,Dresses For Women Summer",
  "brand": "Aloruh",
  "price": 13.03,
  "currency": "USD",
  "price_source": "embedded_json",
  "product_url": "https://us.shein.com/Aloruh-Women-s-Solid-Color-Sleeveless-Mini-Dress-Suitable-For-Beach-Vacation-Dresses-For-Women-Summer-p-458057728.html",
  "image_url": "https://img.ltwebstatic.com/v4/j/pi/2026/05/02/f8/17776852344d34295349aad8f43f4fbd32e5a672d8_thumbnail_405x552.jpg",
  "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
}

original_price and discount_pct are null when there is no discount. rating is null when a product has no reviews, so a missing rating doesn't drag down an average. The JSON output is a plain array of these objects in UTF-8. For a spreadsheet, add --format csv --out jeans.csv.

Building a SHEIN price tracker in Python

The script below reads one run and prints the ten deepest discounts, then the average price per category. It uses only the standard library, so you don't need pandas.

It calculates the discount from the two prices instead of using discount_pct. In the sample, all three rows show 38.0, while the actual cuts are 37.6%, 37.9% and 38.0%. The field is SHEIN's rounded badge, which is fine to display but not precise enough for ranking.

import json
import sys
from collections import defaultdict

path = sys.argv[1] if len(sys.argv) > 1 else "shein_results.json"
with open(path, encoding="utf-8") as f:
    rows = json.load(f)

# real discount from prices; discount_pct is SHEIN's rounded label
deals = []
for r in rows:
    if r.get("original_price") and r.get("price") is not None:
        cut = (r["original_price"] - r["price"]) / r["original_price"] * 100
        deals.append((cut, r))

print("Top 10 discounts")
for cut, r in sorted(deals, key=lambda d: d[0], reverse=True)[:10]:
    stock = "in stock" if r.get("in_stock") else "out of stock"
    print(f"{cut:5.1f}%  {r['price']:>7.2f} {r['currency']}  {r['brand']}  ({stock})  {r['product_url']}")

by_cat = defaultdict(list)
for r in rows:
    if r.get("price") is not None:
        by_cat[(r.get("category"), r.get("currency"))].append(r["price"])

print("\nAverage price by category")
for (cat, cur), prices in sorted(by_cat.items(), key=lambda kv: str(kv[0])):
    print(f"{cat}: {sum(prices) / len(prices):.2f} {cur} over {len(prices)} products")

Run it with python3 top_deals.py jeans-monday.json.

For "what got cheaper since last week", the repository already has the right tool, so don't write your own. Repeat the same category run on Tuesday with --out jeans-tuesday.json, then:

python3 diff_runs.py jeans-monday.json jeans-tuesday.json

It matches products by sku and reports added, removed and price changes. It also refuses comparisons that would mislead: two runs of different searches or markets, or a .meta.json that doesn't match its file. A currency change is reported as currency_changed, not as a price drop. Because the runs above are capped at 20, a product that fell out of the top 20 is listed as left_selection rather than removed. Add --fail-on-change and the command exits 1 on a real price change, which is enough to trigger an alert from cron or CI.

Limitations

  • Only us.shein.com is tested. Other country sites use different locales, and their prices and currencies are not covered.
  • Results past the first ~20 products of a listing are unverified. The run warns and reports partial when it collects fewer products than SHEIN says exist.
  • --sort is only recorded in the results. It is not sent to SHEIN yet.
  • Scraping Browser credentials expire. An HTTP 401 means it's time to fetch a fresh endpoint.
  • The bot check is not always solvable, as the 3-of-5 result shows.
  • review_count stops at 1001, which is how SHEIN's own data encodes the "1000+" shown on the product page. Above a thousand you know a product is popular, but not by how much, so don't rank bestsellers by this field.

Legal note

Collect only public product data, read SHEIN's terms of service and robots.txt before you start, and keep the request rate modest. The rate limit described above is also a signal of where SHEIN draws the line. The fields here are product data, but if you extend the scraper to anything that identifies people, GDPR and similar laws apply.

FAQ

Does SHEIN have a public API for product data?

No. SHEIN's Open Platform is for approved sellers: it lets a merchant publish its own products and handle orders, and access requires an application, a review and seller authorization. There is no public endpoint for searching the catalogue, so this scraper reads the product data SHEIN embeds in its own pages (window.gbRawData on listings, JSON-LD on product pages).

Can I scrape SHEIN reviews with this scraper?

Only the totals. Each row has rating and review_count, but review text is not collected.

How much does solving SHEIN's captcha cost?

About a euro cent per run at most. Both puzzle types, the image grid (GridTask) and the icon sequence (CoordinatesTask), are listed at $1.2 per 1000 on 2Captcha's pricing page at the time of writing, and the scraper caps paid solves at 8 per run by default (--max-solves). The actual count is recorded in solves_spent, and a profile that has already passed the challenge usually needs none.

How do I scrape SHEIN without getting blocked?

Blocks can't be ruled out, only made rare. Reuse one Scraping Browser profile that has already passed the challenge, keep runs spaced out (roughly ten in a row can trigger the rate limit), and use --rate-limit-cooldown 300 for scheduled jobs.

How do I export SHEIN data to CSV?

Add --format csv --out shein.csv to any run. Every run also writes a .meta.json next to the file, recording whether the data is complete.

Where to get it

The scraper is MIT-licensed and the code is on GitHub. A description of the scraper and the rest of the family, with the same CLI and output format, is on 2scraper.com. When SHEIN starts escalating to the image grid and icon puzzles, a 2Captcha key in .env is what lets the run continue; their site also has a guide that covers every scraper option in full.

Disclosure: this article was written by the 2Captcha team. The scraper is open source under the MIT licence, and it works without a 2Captcha key until SHEIN escalates the challenge.