Problem
opencli xiaohongshu search --keyword "酒店" returns empty results.
Root Cause
The current search.ts uses Pinia store's loadMore() method with XHR interception to capture data from //edith.xiaohongshu.com/api/sns/web/v1/search/notes. The API now returns { success: true, data: { has_more: true } } without any items array, meaning xiaohongshu has changed their API response structure or added anti-scraping measures.
Debug Findings
- Pinia store
search still exists with mutateSearchValue and loadMore methods ✅
- XHR interception correctly captures the request to
search/notes ✅
- API response
success: true but data only contains { has_more } — no items/notes ❌
searchStore.feeds remains empty after loadMore() ❌
- However, navigating to
https://www.xiaohongshu.com/search_result?keyword=酒店 does render results in the DOM via section.note-item elements ✅
Suggested Fix
Fall back to DOM-based extraction when the API interception returns empty:
- Navigate to the search results page directly:
https://www.xiaohongshu.com/search_result?keyword={keyword}&source=web_search_result_notes
- Wait for
section.note-item elements to render
- Extract structured data from DOM:
const notes = document.querySelectorAll('section.note-item');
// Each note-item contains: .title, .name, .time, .count, a[href*="/explore/"]
DOM Structure (confirmed working)
section.note-item
├── .cover (thumbnail)
└── .footer
├── .title → note title
└── .card-bottom-wrapper
├── .author
│ ├── .author-avatar
│ └── .name-time-wrapper
│ ├── .name → author name
│ └── .time → publish date
└── .like-wrapper
└── .count → like count
Note: filter out section.query-note-item (these are "related searches", not actual notes).
Environment
@playwright/mcp@0.0.68
- macOS, Chrome with Playwright MCP Bridge extension
- User logged in to xiaohongshu
🤖 Generated with Claude Code
Problem
opencli xiaohongshu search --keyword "酒店"returns empty results.Root Cause
The current
search.tsuses Pinia store'sloadMore()method with XHR interception to capture data from//edith.xiaohongshu.com/api/sns/web/v1/search/notes. The API now returns{ success: true, data: { has_more: true } }without anyitemsarray, meaning xiaohongshu has changed their API response structure or added anti-scraping measures.Debug Findings
searchstill exists withmutateSearchValueandloadMoremethods ✅search/notes✅success: truebutdataonly contains{ has_more }— no items/notes ❌searchStore.feedsremains empty afterloadMore()❌https://www.xiaohongshu.com/search_result?keyword=酒店does render results in the DOM viasection.note-itemelements ✅Suggested Fix
Fall back to DOM-based extraction when the API interception returns empty:
section.note-itemelements to renderDOM Structure (confirmed working)
Note: filter out
section.query-note-item(these are "related searches", not actual notes).Environment
@playwright/mcp@0.0.68🤖 Generated with Claude Code