ZJU-REAL/Easel / skills/builtin/skill-xhs-analyzer
redbook
Flagged小红书内容分析:搜索笔记、拉取互动数据、分析爆款规律、创作者画像、限流检测,支持 CLI 自动化操作。 当用户说"小红书数据分析""小红书爆款分析""笔记数据""小红书限流检测""小红书创作者画像""分析小红书账号"时使用。 发布与日常互动运营请用 skill-xhs-publisher。
| File | Kind | Size |
|---|---|---|
| .github/workflows/npm-publish.yml | config | 3.8 KB |
| EASEL-META.md | markdown | 2.1 KB |
| SKILL.md | skill md | 5.2 KB |
| package-lock.json | manifest | 36.6 KB |
| package.json | manifest | 1.6 KB |
| references/commands.md | markdown | 4.4 KB |
| references/modules.md | markdown | 6.2 KB |
| references/platform-signals.md | markdown | 1.7 KB |
| references/research-loop.md | markdown | 8.2 KB |
| references/technical-reference.md | markdown | 3.8 KB |
| scripts/postinstall.js | script | 4.5 KB |
| scripts/preuninstall.js | script | 1.4 KB |
| social-preview.html | other | 5.1 KB |
| social-preview.png | binary | 261.4 KB |
| src/cli.ts | script | 76.8 KB |
| src/lib/analyze.ts | script | 20.0 KB |
| src/lib/cdp-cookies.ts | script | 13.1 KB |
| src/lib/client.ts | script | 22.2 KB |
| src/lib/cookies.ts | script | 13.3 KB |
| src/lib/creator-signing.ts | script | 1.8 KB |
| src/lib/detect.ts | script | 6.6 KB |
| src/lib/fingerprint-data.ts | script | 2.3 KB |
| src/lib/health.ts | script | 5.5 KB |
| src/lib/platform.ts | script | 2.7 KB |
| src/lib/render.ts | script | 19.5 KB |
| src/lib/reply-strategy.ts | script | 6.0 KB |
| src/lib/signing.ts | script | 21.1 KB |
| src/lib/template.ts | script | 8.0 KB |
| src/lib/url.ts | script | 1.8 KB |
| tsconfig.json | config | 458 B |
src/lib/health.ts
View on GitHub/**
* Note Health Check — detect hidden rate-limiting (限流) via creator API level field
*
* XHS assigns a hidden `level` to each note in the creator backend API response.
* This level controls recommendation distribution but is never shown in the UI.
*
* Discovery credit: @xxx111god (Jason Zuo)
* Reference: https://github.com/jzOcb/xhs-note-health-checker
*/
// ─── Level Definitions ──────────────────────────────────────────────────────
export interface LevelMeta {
label: string;
color: "green" | "lightGreen" | "yellow" | "red" | "darkRed" | "severe" | "gray";
emoji: string;
description: string;
}
const LEVEL_META: Record<string, LevelMeta> = {
normal: { label: "L4 正常", color: "green", emoji: "🟢", description: "Normal distribution" },
baseline: { label: "L2 基本", color: "lightGreen", emoji: "🟡", description: "Basically normal" },
newPost: { label: "L1 新帖", color: "yellow", emoji: "⚪", description: "New post, under review" },
softLimit: { label: "L-1 限流", color: "red", emoji: "🔴", description: "Mild throttling" },
moderate: { label: "中度限流", color: "darkRed", emoji: "🔴", description: "Moderate throttling" },
severe: { label: "L-102 严重", color: "severe", emoji: "⛔", description: "Severe (irreversible)" },
unknown: { label: "未知", color: "gray", emoji: "❓", description: "Unknown level" },
};
export function getLevelMeta(level: number): LevelMeta & { level: number } {
let meta: LevelMeta;
if (level === -102) meta = LEVEL_META.severe;
else if (level <= -5) meta = { ...LEVEL_META.moderate, label: `L${level} 中度` };
else if (level === -1) meta = LEVEL_META.softLimit;
else if (level === 1) meta = LEVEL_META.newPost;
else if (level >= 4) meta = LEVEL_META.normal;
else if (level >= 2) meta = { ...LEVEL_META.baseline, label: `L${level} 基本` };
else meta = { ...LEVEL_META.unknown, label: `L${level}` };
return { ...meta, level };
}
// ─── Sensitive Word Detection ───────────────────────────────────────────────
const SENSITIVE_WORDS = [
"自动化",
"自动发布",
"AI生成",
"内容工厂",
"批量",
"全自动",
"自动工作流",
"AI自动",
];
export function detectSensitiveWords(title: string): string[] {
return SENSITIVE_WORDS.filter((word) => title.includes(word));
}
// ─── Tag Count Check ────────────────────────────────────────────────────────
const MAX_RECOMMENDED_TAGS = 5;
export function checkTagCount(note: Record<string, unknown>): { count: number; warning: boolean } {
const arrayCandidates = [
note.tag_list, note.tags, note.topic_list,
note.topics, note.hash_tag_list, note.hashtag_list, note.hash_tag,
];
for (const candidate of arrayCandidates) {
if (Array.isArray(candidate)) return { count: candidate.length, warning: candidate.length > MAX_RECOMMENDED_TAGS };
}
const numericCandidates = [note.tag_count, note.topic_count, note.hashtag_count];
for (const candidate of numericCandidates) {
if (typeof candidate === "number") return { count: candidate, warning: candidate > MAX_RECOMMENDED_TAGS };
}
return { count: 0, warning: false };
}
// ─── Note Diagnostics ───────────────────────────────────────────────────────
export interface NoteDiagnostics {
noteId: string;
title: string;
level: number;
levelMeta: LevelMeta;
sensitiveHits: string[];
tagCount: number;
tagWarning: boolean;
}
export function diagnoseNote(note: Record<string, unknown>): NoteDiagnostics {
const noteId = String(note.note_id ?? note.noteId ?? note.id ?? note.item_id ?? note.display_id ?? "");
const title = String(note.display_title ?? note.title ?? note.note_title ?? note.name ?? "");
// Level extraction with fallback cascade (matches Chrome extension logic)
const levelValue = Number(
note.level_ ?? note.level ?? note.distribution_level ?? note.status_level ?? NaN
);
const level = Number.isFinite(levelValue) ? levelValue : 1;
const levelMeta = getLevelMeta(level);
const sensitiveHits = detectSensitiveWords(title);
const { count: tagCount, warning: tagWarning } = checkTagCount(note);
return { noteId, title, level, levelMeta, sensitiveHits, tagCount, tagWarning };
}
// ─── Health Report ──────────────────────────────────────────────────────────
export interface HealthReport {
totalNotes: number;
notes: NoteDiagnostics[];
distribution: Record<string, number>;
limitedNotes: NoteDiagnostics[];
sensitiveNotes: NoteDiagnostics[];
}
export function buildHealthReport(rawNotes: Record<string, unknown>[]): HealthReport {
const notes = rawNotes.map(diagnoseNote);
const distribution: Record<string, number> = {};
for (const n of notes) {
const key = n.levelMeta.emoji + " " + n.levelMeta.label;
distribution[key] = (distribution[key] ?? 0) + 1;
}
const limitedNotes = notes.filter((n) => n.level < 1);
const sensitiveNotes = notes.filter((n) => n.sensitiveHits.length > 0 || n.tagWarning);
return { totalNotes: notes.length, notes, distribution, limitedNotes, sensitiveNotes };
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |