Skip to main content

How to Scrape Rakuten Products with Python

Rank Rakuten Ichiba subscription deals from one search, with points kept separate

Updated 12 min readMarkdown
How to Scrape Rakuten Products with Python

Rakuten Ichiba shops often list two prices for the same tea or coffee: a one-off price and a lower subscription price for regular deliveries. This tutorial shows how to scrape Rakuten products with Python using 2scraper/rakuten-scraper, an MIT-licensed open-source scraper, and then rank a search by how much a subscription actually saves. By the end you'll have a JSON file of Japanese green tea listings and a CSV of the best subscription deals, with points kept in a separate column.

How to scrape Rakuten products, step by step

To scrape Rakuten products, run a Python browser scraper against a search.rakuten.co.jp search URL. It reads the JSON payload the page is built from and writes one row per product, with price, subscription price, Rakuten points, shop, rating and shipping. No key, proxy or account is needed for a first run, and each run reports whether it completed.

  1. Clone the repository and create a Python 3.9+ virtual environment.
  2. Install the base and Playwright requirements, then Chromium.
  3. Run one search URL with --pages 2.
  4. Check the exit code and the .meta.json sidecar.
  5. Open a single product with --mode product if you need variants.
  6. Rank subscription savings with a short pandas script.

What the scraper returns for each input

Input URL Mode What you get
search.rakuten.co.jp/search/mall/{keyword}/ listing 45 products per page: price, price_max, subscription_price, points, point_rate, rating, review_count, shop_*, shipping fields
search.rakuten.co.jp/search/mall/-/{genreId}/ or www.rakuten.co.jp/category/{genreId}/ listing The same fields for a whole genre
item.rakuten.co.jp/{shop}/{code}/ product One product with per-variant prices and a variant count
www.rakuten.co.jp/{shopCode}/ refused Storefronts have no product payload, and the scraper says so

Every row is in JPY and carries a sku in the form {shopCode}:{manageNumber}, which is the same on listing and product routes. That makes it a stable key when you go from a search to a product page.

Three fields need care. in_stock was true on all 405 listing rows in the README's measurement, so it isn't much of a filter on listings. original_price and discount_pct are null on every listing row, because a verified was-price only exists on item pages. And points is a discount Rakuten pays back as points, which never touches price.

Why Rakuten blocks some clients and not others

Rakuten sits behind Akamai, and the README's measurements show it doesn't simply block datacenter IPs. It refuses clients whose claimed identity and TLS fingerprint disagree. In the 2026-09-21 test from a Hetzner server in Helsinki, plain curl with its own user agent got a full 919 KB page with 45 products, while curl pretending to be Chrome got a 42–43 byte "Reference #…" page. Headless and headful Chromium both got the products.

The refusal arrives as HTTP 200, which is what makes it awkward: a naive scraper sees success and an empty page. The scraper tells them apart by counting r10s.jp asset hosts, which appear 90 to 343 times on a served page and 0 or 1 times on a refusal.

There's also a hard cap. Rakuten serves at most 150 pages of 45, so 6,750 results per query, however many products match. The README's example query matched 3,053,682 products, so even a full run is a 0.2% sample. Narrow searches beat broad ones.

Installing the Rakuten scraper

Python 3.9 or newer is required; CI runs the offline suite on 3.9 and 3.13. Clone the rakuten-scraper repository on GitHub, then follow the README's quick start:

git clone https://github.com/2scraper/rakuten-scraper.git
cd rakuten-scraper
python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt -r requirements-playwright.txt
playwright install chromium

Selenium and Puppeteer engines are there too (requirements-selenium.txt, requirements-puppeteer.txt), but Playwright is the recommended one, and the README notes pyppeteer is effectively unmaintained. Before going online, python3 smoke_test.py runs the offline tests with no network.

You don't need a .env file to start. The optional one (copy .env.example) takes TWOCAPTCHA_KEY, RAKUTEN_CDP_ENDPOINT, RAKUTEN_PROXY and RAKUTEN_URL. Keys belong in that file, never on the command line, and python3 env_config.py shows what was loaded without printing secrets.

python3 playwright_scraper.py \
  --url "https://search.rakuten.co.jp/search/mall/緑茶/" --pages 2 --out greentea
echo $?

That's 緑茶, green tea, as the keyword. The run writes the products to greentea.json along with a .meta.json sidecar describing the run: status (complete, partial or failed), stop_reason (such as end_of_listing or throttled), pages_failed, total_results and reachable_max. Add --format csv when you want a CSV for a spreadsheet.

A run that finds no products writes nothing unless you pass --allow-empty, so an old file can outlive a failed run. The exit code tells you which case you're in:

  • 0: products written
  • 6: partial run; check stop_reason and pages_failed
  • 3: blocked before parsing
  • 4: a page was served but had zero products
  • 5: content never obtained, for example a page that stayed throttled after every wait
  • 2: bad usage
  • 1: crash

Don't be surprised if total_results is in the hundreds of thousands while you got 90 rows. You asked for two pages, and reachable_max tells you how far the 6,750 cap would let you go.

--locale en adds ?lang=en, but it only translates Rakuten's navigation. Titles, shop names and tags stay in Japanese, so plan for Japanese text in your data.

From search result to product page

A listing row gives you price and, when the product has options, a price_max with has_price_range: true. To see the individual options, take the row's url and run it in product mode. This is the README's own product example:

python3 playwright_scraper.py \
  --url "https://item.rakuten.co.jp/sawaicoffee-tea/solandluna/" --mode product --out tea_item

Product mode reads the item page's own app data (item-page-app-data) and returns per-variant prices and a variant count. It's also the only place a verified was-price can appear, so if you need real discounts rather than campaign titles, product pages are where to look. Item pages are EUC-JP encoded while listings are UTF-8; the scraper handles both, but keep it in mind if you ever fetch pages yourself.

Throttling, Akamai and where 2Captcha comes in

There's no CAPTCHA on these routes today. The README reports zero CAPTCHA vendor markers across 13 captures. What you'll actually hit is throttling and the occasional Akamai refusal.

HTTP 503 is a throttle, not a block. The scraper waits 6 seconds, then 15, then 30, and only gives up on that page after the last wait. HTTP 403 and the tiny "Reference #" page count as blocks. Spacing pages out with --delay 4 is the cheapest fix for throttling, and it costs nothing.

For long runs, a key from 2Captcha covers four separately billed services the scraper supports:

  • Japanese residential proxies through RAKUTEN_PROXY (the country comes from -region-jp in the login), with --proxy-rotate per-page to relaunch the browser on a new IP for each page
  • the Scraping Browser API, a remote browser you connect to with --cdp-endpoint or RAKUTEN_CDP_ENDPOINT
  • browser fingerprints with --fingerprint
  • CAPTCHA solving, which is wired in for reCAPTCHA v2/v3 but has nothing to solve on Rakuten right now

A few combinations are refused on purpose. With --cdp-endpoint, --concurrency above 1 or a typed --proxy is exit 2, because each browser profile allows one live connection. Selenium can't use a credentialed CDP endpoint at all.

My take: for a green tea search of a few pages, you won't need any of it. The README's own 2026-11-17 run of the quick start returned 45 rows, complete, exit 0, with no credentials. Reach for proxies when you start running many searches in a row and seeing throttled in stop_reason.

One listing row from the sample file

Selected fields from a row in the repository's sample_output.json, collected on 2026-09-21 from a coffee search (title, URLs and tags left out):

{
  "source": "rakuten.co.jp",
  "sku": "sawaicoffee-tea:sol150",
  "price": 7998.0,
  "price_max": null,
  "has_price_range": false,
  "subscription_price": 7198.0,
  "currency": "JPY",
  "points": 148,
  "point_rate": 2,
  "rating": 4.65,
  "review_count": 1375,
  "shop_code": "sawaicoffee-tea",
  "shop_name": "澤井珈琲Beans&Leaf",
  "is_official_shop": false,
  "brand": "澤井珈琲",
  "category": "コーヒー豆",
  "genre_id": 201402,
  "genre_rank": null,
  "original_price": null,
  "discount_pct": null,
  "in_stock": true,
  "price_source": "state",
  "shipping_fee": 0.0,
  "free_shipping": true,
  "is_39shop": true,
  "variants": null,
  "scraped_at": "2026-09-21T09:22:22.033563+00:00"
}

Each row has 42 columns in total. rating and review_count are null together when a product has no reviews, since Rakuten reports those as a score of 0. genre_rank is the item's place in Rakuten's genre ranking, not its position in your search.

Ranking subscription savings with pandas

Subscription prices aren't on every product: in the README's 405-row measurement, 54 rows had one. The script below keeps the single-price ones, works out the saving against the one-off price, and writes the best deals to CSV. It also summarises by shop. Install pandas first, as it isn't one of the scraper's requirements:

pip install pandas

Save this as subscriptions.py:

import sys

import pandas as pd

path = sys.argv[1] if len(sys.argv) > 1 else "greentea.json"
df = pd.read_json(path, dtype={"sku": str, "shop_code": str})
total = len(df)

subs = df[(df["currency"] == "JPY") & df["subscription_price"].notna()
          & (df["has_price_range"] == False)].copy()
subs["saving_yen"] = subs["price"] - subs["subscription_price"]
subs["saving_pct"] = (subs["saving_yen"] / subs["price"] * 100).round(1)

cols = ["sku", "shop_name", "price", "subscription_price", "saving_pct",
        "points", "rating", "review_count"]
best = subs.sort_values("saving_pct", ascending=False)[cols]
best.to_csv("subscription_deals.csv", index=False, encoding="utf-8-sig")

by_shop = subs.groupby("shop_name").agg(
    items=("sku", "count"), median_saving_pct=("saving_pct", "median"))
print(f"{len(subs)} of {total} products have one price and a subscription price")
print(by_shop.sort_values("median_saving_pct", ascending=False).to_string())

Run it with python3 subscriptions.py greentea.json. Products with has_price_range: true are left out, because their price and subscription_price may come from different variants, which would make the saving percentage meaningless. The utf-8-sig encoding is there so Excel opens the Japanese shop names correctly instead of showing garbled text.

Points stay a separate column on purpose. They're paid back later and depend on the shopper's campaigns, so mixing them into the saving would hide what the subscription itself is worth.

On the repository sample, six of the nine coffee rows have a subscription price, but three of those have a price range across variants and are filtered out. The remaining three, all from the same shop, each save 10.0%.

Limits to plan around

  • Only rakuten.co.jp (Rakuten Ichiba) is supported, and prices are JPY.
  • Each query tops out at 6,750 results, 150 pages of 45.
  • Listing rows have no was-price; original_price is null until you open the item page.
  • Storefront pages and ranking.rakuten.co.jp aren't supported.
  • Sponsored placements mean the 45 rows per page come from a payload of about 52 entries, and the count varies between fetches.
  • The engines aren't guaranteed to produce identical files. In a 2026-10-29 test on a filtered search, Playwright and Selenium shared 44 of 45 SKUs per page.

Collect public product data only. Read Rakuten's terms of service and robots.txt before scraping, use a moderate --delay, and stop when Rakuten starts refusing or throttling every page. Nothing here logs in or touches customer accounts. Shop names are business data, but if you extend this to reviews or anything that identifies a person, GDPR and Japan's APPI apply.

FAQ

Does Rakuten have an API for product data?

Yes, Rakuten offers an official Ichiba Item Search API through Rakuten Web Service, with its own quotas and result limits. This scraper doesn't use it; it reads the same JSON payload the Ichiba pages are built from, so you get fields such as subscription_price and shop flags as shown on the site.

Do I need a proxy or CAPTCHA solver to scrape Rakuten?

Not for small runs. The README's quick start works with no key, proxy or account. Japanese proxies and the Scraping Browser API help with long or repeated runs that start getting throttled, and there's currently no CAPTCHA to solve.

How do I scrape Rakuten without getting blocked?

Use a real browser engine rather than a faked user agent, add --delay between pages, and keep queries narrow. A 503 means slow down; the scraper backs off automatically before failing the page.

Can I build a Rakuten price tracker in Python?

Yes. Save two runs and compare them with python3 diff_runs.py --old monday.json --new tuesday.json --fail-on-change. It joins on sku, reports added, removed and changed products, tracks points and point_rate, and refuses to compare a partial run with a complete one.

Can I scrape Rakuten reviews?

Only as numbers. Each row has rating and review_count; review text isn't collected.

How do I export Rakuten data to CSV?

Add --format csv to the run. String cells are escaped so a spreadsheet won't treat them as formulas, and the sidecar counts them in csv_cells_escaped.

Where to go next

Try the same script on a genre URL instead of a keyword, or rerun it weekly to see whether shops change their subscription pricing. The code, the measurements behind every number here and the troubleshooting notes are in the rakuten-scraper repository on GitHub, and there are details and more scrapers on the Rakuten Scraper page at 2scraper.com. 2Captcha's guide How to scrape Rakuten is the full reference of all options. When your runs grow past a few pages and start coming back throttled, that's the point to add a 2Captcha key and a Japanese proxy.

the exit code table and the meta json thing are the bits most guides just skip, and keeping points in their own column is kinda clutch

one thing i'd check tho, does subscription_price actually belong to the same variant as the row price? if it doesn't the saving percent is basically garbage and you won't notice unless you open a few rows by hand

Thanks for the observation. The README doesn't say which variant subscription_price belongs to. I have updated the script to only compare products with has_price_range: false, where there's just one price to match. For products with variants, opening them with --mode product is the safer way to check before trusting the percentage.