Skip to content

feat(xiaohongshu): add 4 creator analytics commands (creator-profile, creator-stats, creator-notes, creator-note-detail)#49

Merged
jackwener merged 5 commits intojackwener:mainfrom
stone16:feat/xiaohongshu-creator-analytics
Mar 18, 2026
Merged

feat(xiaohongshu): add 4 creator analytics commands (creator-profile, creator-stats, creator-notes, creator-note-detail)#49
jackwener merged 5 commits intojackwener:mainfrom
stone16:feat/xiaohongshu-creator-analytics

Conversation

@stone16
Copy link
Contributor

@stone16 stone16 commented Mar 18, 2026

feat(xiaohongshu): Add 4 Creator Analytics Commands

Summary

Adds creator backend support for Xiaohongshu (小红书), enabling creators to access their analytics data from the CLI. This covers the creator.xiaohongshu.com domain — a separate surface from the existing public-facing xiaohongshu.com commands.

New Commands

Command Description Auth
creator-profile Account info: followers, following, likes+collects, creator level 🔐 Cookie
creator-stats 7-day/30-day overview with daily trends (views, likes, collects, comments, shares, new followers) 🔐 Cookie
creator-notes Note list with per-note metrics (title, date, views, likes, collects, comments) 🔐 Cookie
creator-note-detail Single note analytics breakdown (organic vs promoted vs video) 🔐 Cookie

API Discovery

Discovered and verified the following internal APIs:

Endpoint Status Strategy
/api/galaxy/creator/home/personal_info ✅ 200 Cookie
/api/galaxy/creator/data/note_detail_new ✅ 200 Cookie
/api/galaxy/creator/data/note_detail?note_id=xxx ✅ 200 Cookie
/api/galaxy/v2/creator/datacenter/account/base ❌ 406 Needs signature
/api/galaxy/v2/creator/note/user/posted ❌ 406 Needs signature

For note list, the v2 API requires x-s signature. I used DOM extraction from the note manager page as a reliable fallback — similar to how the existing xiaohongshu/search command works.

Verified Working

All commands tested against a real creator account.

API Response Examples

creator-stats (note_detail_new)
{
  "seven": {
    "view_count": 517,
    "view_time_avg": 15966,
    "home_view_count": 22,
    "like_count": 17,
    "collect_count": 17,
    "comment_count": 8,
    "share_count": 9,
    "rise_fans_count": 5,
    "view_list": [{"date": 1773072000000, "count": 344}, ...]
  }
}
creator-note-detail (per-note breakdown)
{
  "total_read": 0, "total_promo_read": 0, "total_engage": 0,
  "total_like": 0, "total_fav": 0, "total_cmt": 0, "total_share": 0,
  "normal_read": 0, "normal_engage": 0, "normal_like": 0,
  "video_read": 0, "video_engage": 0, "video_like": 0
}
creator-profile (personal_info)
{
  "name": "[redacted]",
  "follow_count": 68, "fans_count": 49, "faved_count": 1043,
  "grow_info": {"level": 1, "fans_count": 49, "max_fans_count": 500}
}

Prerequisites

  • Chrome running and logged into creator.xiaohongshu.com
  • Standard Playwright MCP Bridge setup (same as other browser commands)

TypeScript

  • npx tsc --noEmit passes with zero errors
  • Follows existing patterns (e.g., xiaohongshu/search.ts, xiaohongshu/user.ts)

stone16 and others added 3 commits March 18, 2026 13:44
Add creator backend support for Xiaohongshu (小红书), enabling
creators to access their analytics data from the command line.

New commands:
- creator-profile: account info (followers, likes, creator level)
- creator-stats: 7-day/30-day overview (views, likes, collects,
  comments, shares, new followers) with daily trend data
- creator-notes: note list with per-note metrics from note manager
- creator-note-detail: single note analytics breakdown
  (organic vs promoted vs video traffic)

API discovery:
- /api/galaxy/creator/home/personal_info (cookie auth, 200 OK)
- /api/galaxy/creator/data/note_detail_new (cookie auth, 200 OK)
- /api/galaxy/creator/data/note_detail?note_id=xxx (cookie auth, 200 OK)
- Note manager DOM extraction for note list (bypasses v2 signature)

All endpoints verified working with real creator account.
Screenshots (redacted) included in docs/screenshots/.

Requires: Chrome logged into creator.xiaohongshu.com
Co-authored-by: stone16 <stone2paul@gmail.com>
@jackwener jackwener force-pushed the feat/xiaohongshu-creator-analytics branch from 4c05337 to 5f5033b Compare March 18, 2026 05:47
Co-authored-by: stone16 <stone2paul@gmail.com>
@jackwener
Copy link
Owner

Thanks for the contribution! I pushed a follow-up fix directly onto this branch and kept you credited via Co-authored-by.\n\nWhat I fixed:\n- preserved \ in the built manifest/package output\n- added \ to \ so it composes cleanly with \n- added a targeted \ workflow so we do not need to run every site's tests for every change\n\nReally appreciate the creator analytics work here.

@jackwener
Copy link
Owner

Thanks for the contribution! I pushed a follow-up fix directly onto this branch and kept you credited via Co-authored-by.

What I fixed:

  • preserved creator-stats --period in the built manifest/package output
  • added id/url to creator-notes so it composes cleanly with creator-note-detail
  • added a targeted npm run test:site -- <site> workflow so we do not need to run every site's tests for every change

Really appreciate the creator analytics work here.

@jackwener
Copy link
Owner

Thanks for the contribution! This adds a really useful creator-side Xiaohongshu surface to opencli. I pushed a small follow-up fix to the note-manager DOM parser so publish timestamps are excluded before extracting per-note metrics, and re-ran

@jackwener/opencli@0.7.11 typecheck
tsc --noEmit plus
@jackwener/opencli@0.7.11 test:site
node scripts/test-site.mjs xiaohongshu

==> Typecheck

@jackwener/opencli@0.7.11 typecheck
tsc --noEmit

==> Targeted verify
opencli validate: PASS
Checked 2 CLI(s) in 2 file(s)
Errors: 0 Warnings: 0

No site-specific vitest files found for "xiaohongshu". Skipping full vitest run.. Everything looks good now.

Copy link
Owner

@jackwener jackwener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the creator analytics commands and followed up with a fix for the note-manager DOM parser so publish timestamps no longer get counted as note metrics. Local verification passed: npm run typecheck and npm run test:site -- xiaohongshu.

@jackwener jackwener merged commit c370bd0 into jackwener:main Mar 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants