UnitBytes Logo
UnitBytes Web Data APIs
Home / Blog / Data Engineering & AI
Data Engineering & AI 9 min read 2026-11-14

How to Fix Xiaohongshu xsec_token Error 300031: Scrape Bare /explore/ URLs, Keyword Search & Comments Without Login

Why standard Xiaohongshu (RedNote / 小红书) scrapers fail with error 300031 ('Note temporarily inaccessible') on bare /explore/<id> URLs and -100/300011 on guest search—plus working Python, cURL, and Claude/Cursor MCP examples for bare URLs, 300+ note keyword search, and 1,000+ comments.

How to Fix Xiaohongshu xsec_token Error 300031: Scrape Bare /explore/ URLs, Keyword Search & Comments Without Login

If you have tried to build a Python pipeline, AI agent, or brand monitoring workflow for Xiaohongshu (小红书 / RedNote) in 2026, you have almost certainly hit the infamous error_code=300031 wall:

text
https://www.xiaohongshu.com/404?source=web&error_code=300031&error_msg=当前笔记暂时无法浏览
# "Note temporarily inaccessible" — even though the post is 100% live in the app!

Across developer forums and open-source repositories, conventional wisdom claims that bare https://www.xiaohongshu.com/explore/<24-hex-id> URLs are impossible to scrape without a live ?xsec_token=... parameter and a logged-in +86 personal cookie. Teams end up running fragile local headless browsers, scanning QR codes every morning, and watching their personal accounts get restricted after 50 requests.

In this engineering guide, we explain why standard scrapers trigger 300031, -100, and 300011—and provide copy-paste Python (apify-client), REST cURL, and Hosted MCP (mcp.apify.com) implementations that extract bare /explore/<id> posts, 300+ note keyword searches, and 250–1,000+ multi-page comments per post with zero xsec_token parameters and zero login cookies.


1. Why Standard Scrapers Fail with 300031, -100, and 300011#

When you inspect Xiaohongshu traffic in browser DevTools, three separate enforcement layers break traditional scraping scripts:

Error CodeMessage / SymptomRoot Cause in DIY Scrapers
300031当前笔记暂时无法浏览 (Note temporarily inaccessible)Navigating to a bare /explore/<24-hex> URL without a fresh ?xsec_token=...&xsec_source=... token, or replaying a saved xsec_token outside the session or TTL window that minted it.
-100Mandatory QR / +86 SMS login modalCalling web search or comment pagination as a guest visitor without an authenticated session state.
300011 / 461Account abnormal / Slide verification wallRotating high-concurrency queries through a personal logged-in account cookie or datacenter IP range, triggering permanent account restrictions.

Even if your scraper harvests full URLs containing ?xsec_token=... during an authenticated search run, storing those tokens in Postgres, Snowflake, or Airtable for later hydration still fails:

  1. xsec_token Is Ephemeral & Context-Bound: Tokens expire and are tied to the originating feed context (pc_search, pc_feed, pc_user). Re-fetching a stored URL 24 hours later to track engagement velocity (likedCount, collectedCount, commentCount) returns 300031.
  2. External Links Never Have xsec_token: Note IDs shared in PR trackers, CRM spreadsheets, affiliate briefs, or xhslink.com shortlinks arrive as plain 24-character hex IDs or bare /explore/<id> URLs.
  3. Personal Cookie Rotation Does Not Scale: Buying or maintaining +86 SIM cards for headless browser pools introduces compliance risk and constant manual QR re-authentication.

Instead of managing accounts or browser sessions locally, UnitBytes resolves bare Note IDs, keyword searches, and comment threads in the cloud on Apify—with $5.00 in free monthly Apify platform credit included on every free account (~2,200+ notes/month at $0 out-of-pocket cost).


2. Fix 300031: Hydrate Bare /explore/<id> URLs Without xsec_token#

Using the Xiaohongshu Trend & Post Scraper (Run on Apify Store), you can pass any of the following directly inside startUrls with mode: "notes":

  • Bare web URLs: https://www.xiaohongshu.com/explore/660000000000000000000001
  • Discovery links: https://www.rednote.com/discovery/item/660000000000000000000001
  • Mobile app share shortlinks: http://xhslink.com/a/xxxxxx

Each hydrated post returns full caption text (desc), likedCount, collectedCount, commentCount, shareCount, high-resolution carousel images, watermark-free videoUrl (for video notes), tags, publish timestamp, and author metadata starting at $1.50 / 1,000 notes ($0.0015 Gold+; $0.0022 Free).

Python (apify-client) — Bare /explore/<id> Hydration

bash
pip install apify-client
python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

# Pass bare /explore/<24-hex> URLs or xhslink.com shortlinks — NO xsec_token needed
run_input = {
    "mode": "notes",
    "startUrls": [
        {"url": "https://www.xiaohongshu.com/explore/660000000000000000000001"},
        {"url": "https://www.xiaohongshu.com/explore/660000000000000000000002"},
    ],
    "maxItems": 2,
    "enrichDetails": True,
}

run = client.actor("unitbytes/xiaohongshu-rednote-trend-scraper").call(run_input=run_input)

for note in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(
        note["noteId"],
        note.get("title"),
        f"likes={note.get('likedCount')} saves={note.get('collectedCount')} comments={note.get('commentCount')}",
    )

Synchronous REST cURL — Bare URL to JSON in One Request

bash
curl -s -X POST \
  "https://api.apify.com/v2/acts/unitbytes~xiaohongshu-rednote-trend-scraper/run-sync-get-dataset-items?format=json&clean=true" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "notes",
    "startUrls": [
      {"url": "https://www.xiaohongshu.com/explore/660000000000000000000001"}
    ],
    "maxItems": 1,
    "enrichDetails": true
  }'

3. Run 300+ Note Keyword Searches Without Login (-100 Bypass)#

If your goal is pure keyword discovery, share-of-voice tracking, or D2C competitor monitoring, the dedicated RedNote Keyword Search Scraper (Run on Apify Store) exposes a streamlined 5-field JSON schema with no mode selector required:

  • keywords: Array of Chinese or English search queries (e.g. ["skincare", "早C晚A", "Lululemon"])
  • sort: "popularity_descending" (most liked), "general" (relevance), or "time_descending" (newest)
  • noteType: "all", "video_only", or "image_only"
  • maxItems: Up to 300+ unique notes per keyword
  • enrichDetails: Hydrates full post descriptions, tags, high-res image carousels, and MP4 video streams (true by default)

Python (apify-client) — 5-Field Keyword Search API

python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

search_input = {
    "keywords": ["skincare", "早C晚A"],
    "sort": "popularity_descending",
    "noteType": "all",
    "maxItems": 120,
    "enrichDetails": True,
}

run = client.actor("unitbytes/rednote-xiaohongshu-search-scraper").call(run_input=search_input)
notes = list(client.dataset(run["defaultDatasetId"]).iterate_items())
print(f"Retrieved {len(notes)} unique Xiaohongshu notes")

Synchronous REST cURL — Keyword Search API

bash
curl -s -X POST \
  "https://api.apify.com/v2/acts/unitbytes~rednote-xiaohongshu-search-scraper/run-sync-get-dataset-items?format=json&clean=true" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "keywords": ["敏感肌防晒"],
    "sort": "popularity_descending",
    "noteType": "video_only",
    "maxItems": 50,
    "enrichDetails": true
  }'

4. Scrape 250–1,000+ Xiaohongshu Comments & Inline Replies in Python#

Standard web scrapers hit a login wall after the first 10 preview comments—or fail outright with 300031 when given a bare post URL.

The RedNote Comments & Replies Scraper (Run on Apify Store) paginates 250 to 1,000+ engagement-ranked root comments per post directly from bare /explore/<24-hex> URLs, xhslink.com links, or search keywords, starting at $1.99 / 1,000 comments ($0.00199 Gold+; $0.00249 Free).

💡
Inline Replies (楼中楼) Coverage
When includeSubComments: True is enabled, up to 3 top inline replies per root comment are extracted zero-login (maxSubCommentsPerComment: 3), while subCommentCount reports the exact total reply count on each thread alongside commenter ipLocation and automated sentiment.isBuyerIntent classification.

Python (apify-client) — Multi-Page Comments from Bare URL

python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

comments_input = {
    "mode": "comments",
    "startUrls": [
        {"url": "https://www.xiaohongshu.com/explore/660000000000000000000001"}
    ],
    "maxCommentsPerNote": 300,
    "includeSubComments": True,
    "maxSubCommentsPerComment": 3,
}

run = client.actor("unitbytes/xiaohongshu-rednote-comments-scraper").call(run_input=comments_input)
comments = list(client.dataset(run["defaultDatasetId"]).iterate_items())

buyer_questions = [
    c for c in comments if (c.get("sentiment") or {}).get("isBuyerIntent")
]
print(f"Scraped {len(comments)} comments ({len(buyer_questions)} buyer-intent questions)")

Synchronous REST cURL — Multi-Page Comments

bash
curl -s -X POST \
  "https://api.apify.com/v2/acts/unitbytes~xiaohongshu-rednote-comments-scraper/run-sync-get-dataset-items?format=json&clean=true" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "comments",
    "startUrls": [
      {"url": "https://www.xiaohongshu.com/explore/660000000000000000000001"}
    ],
    "maxCommentsPerNote": 100,
    "includeSubComments": true,
    "maxSubCommentsPerComment": 3
  }'

5. Connect Claude Code, Cursor & Windsurf via Hosted MCP (mcp.apify.com)#

Building an AI research agent in Claude Code, Cursor, Windsurf, or VS Code? Instead of installing a 1.5 GB local browser MCP wrapper that breaks on 300031, point your MCP client directly at Apify's official Streamable HTTP MCP gateway pre-loaded with all 6 UnitBytes RedNote tools:

Cursor (~/.cursor/mcp.json) / Windsurf Config

json
{
  "mcpServers": {
    "rednote-xiaohongshu": {
      "url": "https://mcp.apify.com/?tools=fetch-actor-details,get-actor-run,get-dataset-items,unitbytes/rednote-xiaohongshu-search-scraper,unitbytes/xiaohongshu-rednote-trend-scraper,unitbytes/xiaohongshu-rednote-comments-scraper,unitbytes/xiaohongshu-rednote-profile-scraper,unitbytes/xiaohongshu-rednote-live-scraper,unitbytes/xiaohongshu-scraper",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_TOKEN"
      }
    }
  }
}

Claude Code CLI One-Liner

bash
claude mcp add --transport http rednote-xiaohongshu \
  "https://mcp.apify.com/?tools=fetch-actor-details,get-actor-run,get-dataset-items,unitbytes/rednote-xiaohongshu-search-scraper,unitbytes/xiaohongshu-rednote-trend-scraper,unitbytes/xiaohongshu-rednote-comments-scraper,unitbytes/xiaohongshu-rednote-profile-scraper,unitbytes/xiaohongshu-rednote-live-scraper,unitbytes/xiaohongshu-scraper" \
  --header "Authorization: Bearer YOUR_APIFY_TOKEN"

6. Choosing the Right Engine Across the 6-Actor RedNote Suite#

Every engine below runs 100% cookieless in the cloud, includes ready-to-import n8n AI Workflow Templates, and bills strictly Pay-Per-Event:

RedNote Cloud EnginePrimary Developer Use CaseGold+ Rate (Free Tier)Cloud Console
RedNote Keyword Search ScraperPure 5-field cookieless keyword search (300+ notes/query, sort, noteType)$1.50 / 1K notes ($2.20 Free)Run on Apify Store
Xiaohongshu Trend & Post ScraperBare /explore/<id> hydration (no xsec_token), keyword search & 13 trend channels$1.50 / 1K notes ($2.20 Free)Run on Apify Store
RedNote Comments & Replies Scraper250–1,000+ comments/post + top 3 inline replies, IP location & buyer-intent flags$1.99 / 1K comments ($2.49 Free)Run on Apify Store
Xiaohongshu KOL & Profile ScraperAutomated creatorLeads discovery, follower/save totals, MCN badges & ~30 portfolio posts$3.50 / 1K profiles ($5.00 Free)Run on Apify Store
RedNote Live Stream ScraperActive live shopping rooms (hasGoods), concurrent viewers, live chat & 1080p .flv/.m3u8$5.40 / 1K rooms ($7.90 Free)Run on Apify Store
RedNote (Xiaohongshu) All-in-One Scraper & APIUnified 7-in-1 multi-surface workspace combining Search, Notes, Comments, KOLs & Live$1.50 / 1K notes ($2.20 Free)Run on Apify Store

For broader social commerce strategy and live-shopping breakdowns, explore our companion playbooks: How to Scrape Xiaohongshu (RedNote) Without Login and How to Scrape Xiaohongshu Live Streams, 1080p Video & KOL Leads.

Frequently Asked Questions (FAQ)

Why does Xiaohongshu return error 300031 ('Note temporarily inaccessible') on /explore/<id> URLs?

On xiaohongshu.com, clicking a post card inside an authenticated feed attaches a short-lived, session-bound xsec_token query parameter. Requesting a bare /explore/<24-hex-id> link without xsec_token—or replaying an expired xsec_token from an earlier session—causes the web gateway to reject the request with error_code=300031.

Can I scrape a bare xiaohongshu.com/explore/<24-hex> URL without xsec_token or login cookies?

Yes. Both the UnitBytes Xiaohongshu Trend & Post Scraper and the RedNote Comments & Replies Scraper resolve bare https://www.xiaohongshu.com/explore/<24-hex-id> URLs, rednote.com item links, xhslink.com shortlinks, and raw 24-character hex Note IDs directly in the cloud with zero xsec_token parameters and zero cookies.

How do I run Xiaohongshu keyword searches without error -100 or a +86 SMS account?

Use unitbytes/rednote-xiaohongshu-search-scraper on Apify. Pass a 5-field JSON payload (keywords, sort, noteType, maxItems, enrichDetails) to retrieve up to 300+ unique notes per keyword sorted by popularity_descending, general, or time_descending starting at $1.50 per 1,000 notes on Gold+ plans.

How many Xiaohongshu comments and replies can I extract per post in Python?

Using unitbytes/xiaohongshu-rednote-comments-scraper, you can paginate 250 to 1,000+ engagement-ranked root comments per post plus up to 3 top inline replies per comment (subCommentCount reports the full reply total) starting at $1.99 per 1,000 comments on Gold+.

Tags: #Xiaohongshu 300031#xsec_token#RedNote Keyword Search API#Scrape Xiaohongshu Without Login#Scrape Xiaohongshu Comments Python#MCP
Continue Reading

Related Technical Guides & Teardowns

All Guides →
Done-For-You Datasets • Data Feeds • Custom Scrapers

Need Custom Data Engineering & AI Data or a Dedicated Pipeline?

Don't want to run scrapers yourself? Tell us what data you need and we'll deliver a clean Excel / CSV / Google Sheets dataset, set up a recurring data feed, or build a custom scraper for a new site.

One-Time Dataset
From $99

Send your keywords, categories, or URLs. We run the extraction and email you a clean Excel/CSV file, usually within 48 hours.

Recurring Data Feed
Priced by Volume

Daily or weekly data delivered to Google Sheets, Amazon S3, BigQuery, or a webhook. Tell us the volume and we'll quote a fixed monthly price.

Custom Scraper
From $299

Need a new website scraped or custom fields added? We build it, deliver it, and can maintain it for you.

We reply within 48 hours.
Prefer direct email? Write to us anytime at contact@unitbytes.com