fix(xiaohongshu): improve search login-wall handling and detail output#298
Merged
jackwener merged 2 commits intojackwener:mainfrom Mar 23, 2026
Conversation
…, remove serial per-note enrichment - Detect login wall and throw a clear error message (from original PR) - Preserve search_result/ URL with xsec_token instead of degrading to /explore/<id> - Add author_url to results - Remove readNoteDetail() + sequential page.goto() per note (caused 60s+ delays for default limit=20 with 3s wait each) - Simplify and unify DOM extraction logic (remove unused fallback anchor scan) - Update tests: cover login-wall, URL preservation (assert single goto), and limit/filter
jackwener
added a commit
that referenced
this pull request
Mar 23, 2026
- docs/adapters/browser/xiaohongshu.md: fill in search command description (was empty), update usage examples with keyword positional arg - TESTING.md: update unit test count 31→32 (search.test.ts added in #298), add xiaohongshu/search.test.ts to the adapter test file list
jackwener
added a commit
that referenced
this pull request
Mar 23, 2026
- docs/adapters/browser/xiaohongshu.md: fill in search command description (was empty), update usage examples with keyword positional arg - TESTING.md: update unit test count 31→32 (search.test.ts added in #298), add xiaohongshu/search.test.ts to the adapter test file list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Improve
xiaohongshu searchin two ways:[].This also fixes URL handling.
Previously the command could degrade result URLs into bare
/explore/<noteId>links, which were not reliably reopenable.Now it preserves the real detail link exposed by the search result page (
search_result/...?...xsec_token=...), so the returnedurlcan open the note detail page directly.Related issue: #296
Type of Change
Checklist
Documentation (if adding/modifying an adapter)
docs/adapters/(if new adapter)docs/adapters/index.mdtable (if new adapter)docs/.vitepress/config.mts(if new adapter)Screenshots / Output
Checks run:
Added tests:
xiaohongshu searchsearch_resultdetail URL and enriching rows with note detail fieldsBefore
{ "rank": 2, "title": "某鱼买FSD被坑了4万", "author": "随风2025-10-10", "likes": "261", "url": "https://www.xiaohongshu.com/explore/68e90be80000000004022e66", "author_url": "https://www.xiaohongshu.com/user/profile/635a9c720000000018028b40?...", "content": "", "comment_count": "0", "comments": [] }After
{ "rank": 2, "title": "某鱼买FSD被坑了4万", "author": "随风", "likes": "261", "url": "https://www.xiaohongshu.com/search_result/68e90be80000000004022e66?xsec_token=...", "author_url": "https://www.xiaohongshu.com/user/profile/635a9c720000000018028b40?...", "content": "今天早上提车,昨天深夜,心血来潮搜了一下x鱼...", "comment_count": "302", "comments": [ "KA330: 没有被坑啊。", "NONO: 你怎么敢某鱼花4.3W买的" ] }The
AfterURL is taken from the real search-result detail link and can open the note detail page directly.