fix(xiaohongshu): support creator center URLs in creator-note-detail#1696
Open
FrankFuShMomentLab wants to merge 1 commit into
Open
fix(xiaohongshu): support creator center URLs in creator-note-detail#1696FrankFuShMomentLab wants to merge 1 commit into
FrankFuShMomentLab wants to merge 1 commit into
Conversation
- Enhance parseNoteId() to extract noteId from creator.xiaohongshu.com URLs - Update creator-note-detail.js to use parseNoteId() for robust ID extraction - Add comprehensive tests for URL parsing and creator-note-detail command Fixes: creator-note-detail fails when passed a full creator center URL instead of a bare note ID, because the raw URL was used directly in page.goto() causing 404/406 errors.
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.
Problem
The
creator-note-detailcommand fails when users pass a full creator center URL (e.g.,https://creator.xiaohongshu.com/statistics/note-detail?noteId=xxx) instead of a bare note ID.Error:
No note detail data found. Check note_id and login status for creator.xiaohongshu.com.(EmptyResultError)Root cause: The command directly uses the raw
note-idargument inpage.goto(), causing a malformed URL when a full URL is passed.Solution
parseNoteId()innote-helpers.jsto supportcreator.xiaohongshu.comURLscreator-note-detail.jsto useparseNoteId()instead of raw inputTest Results
All 154 xiaohongshu adapter tests pass.
Changes
clis/xiaohongshu/note-helpers.js: Add creator URL support toparseNoteId()clis/xiaohongshu/creator-note-detail.js: UseparseNoteId()for robust ID extractionclis/xiaohongshu/note-helpers.test.js: New test file (6 tests)clis/xiaohongshu/creator-note-detail.test.js: Add creator URL test case