feat: add get-notifications command#46
Open
SZhangCoding wants to merge 1 commit intoautoclaw-cc:mainfrom
Open
Conversation
New command: `cli.py get-notifications [--num N]` - Navigates to xiaohongshu.com/notification and reads the Vue store (window.__INITIAL_STATE__.notification.notificationMap.mentions) instead of calling the API directly, which requires dynamic x-s/x-t security headers that cannot be replicated via plain XHR. - Returns structured JSON with per-notification fields: - commentId, content, quotedComment (for replies) - user info (userId, nickname, avatar, xsecToken) - noteId + noteXsecToken (usable directly with reply-comment) - hasMore + cursor for pagination awareness - --num limits returned items (default 20; page loads max 20 per batch) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
get-notificationsto read comment/reply notifications from xiaohongshu.com/notificationscripts/xhs/notifications.pywith typed dataclasses following existing project conventionsHow it works
Navigates to the notification page and reads from
window.__INITIAL_STATE__.notification.notificationMap.mentions(Vue store), instead of calling the API directly — the mentions API requires dynamicx-s/x-tsecurity headers that cannot be reproduced via plain XHR.Usage
Response fields
Each notification item includes:
type:comment/item(commented on your note) orcomment/comment(replied to your comment)content: comment textquotedComment: original comment being replied to (reply type only)user:{ userId, nickname, avatar }noteId+noteXsecToken: can be passed directly toreply-commenthasMore+cursor: pagination awareness🤖 Generated with Claude Code