@lucasygu/redbook 0.1.15 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +184 -6
- package/SKILL.md +365 -12
- package/dist/cli.js +276 -0
- package/dist/cli.js.map +1 -1
- package/dist/lib/analyze.d.ts +1 -0
- package/dist/lib/analyze.d.ts.map +1 -1
- package/dist/lib/analyze.js +4 -2
- package/dist/lib/analyze.js.map +1 -1
- package/dist/lib/client.d.ts +1 -0
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/client.js +8 -0
- package/dist/lib/client.js.map +1 -1
- package/dist/lib/render.d.ts +33 -0
- package/dist/lib/render.d.ts.map +1 -0
- package/dist/lib/render.js +531 -0
- package/dist/lib/render.js.map +1 -0
- package/dist/lib/reply-strategy.d.ts +42 -0
- package/dist/lib/reply-strategy.d.ts.map +1 -0
- package/dist/lib/reply-strategy.js +119 -0
- package/dist/lib/reply-strategy.js.map +1 -0
- package/dist/lib/template.d.ts +50 -0
- package/dist/lib/template.d.ts.map +1 -0
- package/dist/lib/template.js +154 -0
- package/dist/lib/template.js.map +1 -0
- package/package.json +17 -2
package/SKILL.md
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Search, read, and
|
|
2
|
+
description: Search, read, analyze, and automate Xiaohongshu (小红书) content via CLI
|
|
3
3
|
allowed-tools: Bash, Read, Write, Glob, Grep
|
|
4
|
+
# OpenClaw / ClawHub metadata (clawhub install redbook)
|
|
5
|
+
name: redbook
|
|
6
|
+
version: 0.2.0
|
|
7
|
+
metadata:
|
|
8
|
+
openclaw:
|
|
9
|
+
requires:
|
|
10
|
+
bins:
|
|
11
|
+
- redbook
|
|
12
|
+
install:
|
|
13
|
+
- kind: node
|
|
14
|
+
package: "@lucasygu/redbook"
|
|
15
|
+
bins: [redbook]
|
|
16
|
+
os: [macos]
|
|
17
|
+
homepage: https://github.com/lucasygu/redbook
|
|
18
|
+
tags:
|
|
19
|
+
- xiaohongshu
|
|
20
|
+
- social-media
|
|
21
|
+
- analytics
|
|
22
|
+
- content-ops
|
|
4
23
|
---
|
|
5
24
|
|
|
6
25
|
# Redbook — Xiaohongshu CLI
|
|
7
26
|
|
|
8
|
-
Use the `redbook` CLI to search notes, read content, analyze creators, and research topics on Xiaohongshu (小红书/RED).
|
|
27
|
+
Use the `redbook` CLI to search notes, read content, analyze creators, automate engagement, and research topics on Xiaohongshu (小红书/RED).
|
|
28
|
+
|
|
29
|
+
**OpenClaw users:** Install via `clawhub install redbook` or `npm install -g @lucasygu/redbook`.
|
|
9
30
|
|
|
10
31
|
## Usage
|
|
11
32
|
|
|
@@ -28,6 +49,11 @@ Use the `redbook` CLI to search notes, read content, analyze creators, and resea
|
|
|
28
49
|
| Browse feed | `redbook feed --json` |
|
|
29
50
|
| Search hashtags | `redbook topics "keyword" --json` |
|
|
30
51
|
| Analyze viral note | `redbook analyze-viral <url> --json` |
|
|
52
|
+
| Extract content template | `redbook viral-template <url1> <url2> --json` |
|
|
53
|
+
| Post a comment | `redbook comment <url> --content "text"` |
|
|
54
|
+
| Reply to comment | `redbook reply <url> --comment-id <id> --content "text"` |
|
|
55
|
+
| Batch reply (preview) | `redbook batch-reply <url> --strategy questions --dry-run` |
|
|
56
|
+
| Render markdown to cards | `redbook render content.md --style xiaohongshu` |
|
|
31
57
|
| Check connection | `redbook whoami` |
|
|
32
58
|
|
|
33
59
|
**Always add `--json`** when parsing output programmatically. Without it, output is human-formatted text.
|
|
@@ -303,6 +329,172 @@ redbook search "keyword" --type video --sort popular --json
|
|
|
303
329
|
|
|
304
330
|
---
|
|
305
331
|
|
|
332
|
+
### Module I: Comment Operations
|
|
333
|
+
|
|
334
|
+
**Answers:** Which comments deserve a reply? What is the comment quality distribution?
|
|
335
|
+
|
|
336
|
+
**Commands:**
|
|
337
|
+
```bash
|
|
338
|
+
# 1. Fetch all comments
|
|
339
|
+
redbook comments "<noteUrl>" --all --json
|
|
340
|
+
|
|
341
|
+
# 2. Preview reply candidates (dry run)
|
|
342
|
+
redbook batch-reply "<noteUrl>" --strategy questions --dry-run --json
|
|
343
|
+
|
|
344
|
+
# 3. Execute replies with template (5 min delay with ±30% jitter)
|
|
345
|
+
redbook batch-reply "<noteUrl>" --strategy questions \
|
|
346
|
+
--template "感谢提问!关于{content},..." \
|
|
347
|
+
--max 10
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
**Fields to extract from `--dry-run` JSON:**
|
|
351
|
+
- `candidates[].commentId` — target comments
|
|
352
|
+
- `candidates[].isQuestion` — boolean, detected question
|
|
353
|
+
- `candidates[].likes` — engagement signal
|
|
354
|
+
- `candidates[].hasSubReplies` — whether already answered
|
|
355
|
+
- `skipped` — how many comments were filtered out
|
|
356
|
+
- `totalComments` — total fetched
|
|
357
|
+
|
|
358
|
+
**Strategies:**
|
|
359
|
+
- `questions` — replies to comments ending with `?` or `?` (learning-oriented audience)
|
|
360
|
+
- `top-engaged` — replies to highest-liked comments (maximum visibility)
|
|
361
|
+
- `all-unanswered` — replies to comments with no existing sub-replies (fill gaps)
|
|
362
|
+
|
|
363
|
+
**How to interpret:**
|
|
364
|
+
- High question rate (>15%) = audience is learning-oriented → reply to build authority
|
|
365
|
+
- High top-engaged comments (>100 likes) = reply to visible comments for maximum reach
|
|
366
|
+
- Many unanswered comments = engagement gap, opportunity to increase reply rate
|
|
367
|
+
|
|
368
|
+
**Safety:** Hard cap 30 replies per batch, minimum 3-minute delay with ±30% jitter (default 5 min), `--dry-run` by default (no template = preview only), immediate stop on captcha. See [Rate Limits & Safety](#rate-limits--safety) for details.
|
|
369
|
+
|
|
370
|
+
**Output:** Reply plan table with candidate comments, strategy match reason, and status.
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
### Module J: Viral Replication
|
|
375
|
+
|
|
376
|
+
**Answers:** What structural template can I extract from successful notes to guide new content creation?
|
|
377
|
+
|
|
378
|
+
**Commands:**
|
|
379
|
+
```bash
|
|
380
|
+
# 1. Find top notes for a keyword
|
|
381
|
+
redbook search "keyword" --sort popular --json
|
|
382
|
+
|
|
383
|
+
# 2. Extract structural template from 2-3 top performers
|
|
384
|
+
redbook viral-template "<url1>" "<url2>" "<url3>" --json
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
**Fields to extract from `viral-template` JSON:**
|
|
388
|
+
- `dominantHookPatterns[]` — hook types appearing in majority of notes
|
|
389
|
+
- `titleStructure.commonPatterns[]` — specific title formula
|
|
390
|
+
- `titleStructure.avgLength` — target title length
|
|
391
|
+
- `bodyStructure.lengthRange` — target word count [min, max]
|
|
392
|
+
- `bodyStructure.paragraphRange` — target paragraph count
|
|
393
|
+
- `engagementProfile.type` — reference/insight/entertainment
|
|
394
|
+
- `audienceSignals.commonThemes[]` — what the audience talks about
|
|
395
|
+
|
|
396
|
+
**How to interpret:**
|
|
397
|
+
- Consistent hook patterns across notes = proven formula for this niche
|
|
398
|
+
- Narrow body length range = audience has clear content length preference
|
|
399
|
+
- High collect/like in profile = audience saves content → create reference material
|
|
400
|
+
- Common comment themes = topics to address in new content
|
|
401
|
+
|
|
402
|
+
**Composition with other modules:**
|
|
403
|
+
- Uses Module A results to identify top URLs for template extraction
|
|
404
|
+
- Feeds into Module H (Content Brainstorm) as structural constraint
|
|
405
|
+
- Uses Module C classification to validate engagement profile
|
|
406
|
+
|
|
407
|
+
**Output:** Content template spec — the structural skeleton for content creation. An LLM (via the composed workflow) uses this template to generate actual title, body, hashtags, and cover image prompt.
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
### Module K: Engagement Automation
|
|
412
|
+
|
|
413
|
+
**Answers:** How should I manage ongoing engagement with my audience?
|
|
414
|
+
|
|
415
|
+
This module is a workflow that composes Modules I and J with human oversight.
|
|
416
|
+
|
|
417
|
+
**Workflow:**
|
|
418
|
+
1. **Monitor** — `redbook comments "<myNoteUrl>" --all --json` to fetch recent comments
|
|
419
|
+
2. **Filter** — `redbook batch-reply --strategy questions --dry-run` to identify reply candidates
|
|
420
|
+
3. **Review** — Human reviews dry-run output (or LLM reviews with persona guidelines)
|
|
421
|
+
4. **Execute** — `redbook batch-reply --strategy questions --template "..." --max 10`
|
|
422
|
+
5. **Report** — Summary of replies sent, errors encountered, rate limit status
|
|
423
|
+
|
|
424
|
+
**Safety rules:**
|
|
425
|
+
- Always `--dry-run` first, human approval before execution
|
|
426
|
+
- Maximum 30 replies per session (hard cap)
|
|
427
|
+
- Minimum 3-minute delay between replies, default 5 minutes, with ±30% random jitter
|
|
428
|
+
- Never reply to the same comment twice (check `hasSubReplies`)
|
|
429
|
+
- Stop immediately on captcha — do not retry
|
|
430
|
+
- See [Rate Limits & Safety](#rate-limits--safety) for XHS risk control thresholds
|
|
431
|
+
|
|
432
|
+
**Anti-spam guidelines:**
|
|
433
|
+
- Vary reply templates across batches
|
|
434
|
+
- Limit to 1-2 batch runs per note per day
|
|
435
|
+
- Prioritize quality (targeted strategy) over quantity
|
|
436
|
+
- Uniform timing patterns trigger bot detection — jitter is applied automatically
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
### Module L: Card Rendering
|
|
441
|
+
|
|
442
|
+
**Answers:** How do I turn markdown content into Xiaohongshu-ready image cards?
|
|
443
|
+
|
|
444
|
+
**Commands:**
|
|
445
|
+
```bash
|
|
446
|
+
# Render markdown to styled PNG cards
|
|
447
|
+
redbook render content.md --style xiaohongshu
|
|
448
|
+
|
|
449
|
+
# Custom style and output directory
|
|
450
|
+
redbook render content.md --style dark --output-dir ./cards
|
|
451
|
+
|
|
452
|
+
# JSON output (for programmatic use)
|
|
453
|
+
redbook render content.md --json
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
**Input:** Markdown file with YAML frontmatter:
|
|
457
|
+
```markdown
|
|
458
|
+
---
|
|
459
|
+
emoji: "🚀"
|
|
460
|
+
title: "5个AI效率技巧"
|
|
461
|
+
subtitle: "Claude Code 实战"
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
## 技巧一:...
|
|
465
|
+
Content here...
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
## 技巧二:...
|
|
470
|
+
More content...
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
**Output:** `cover.png` + `card_1.png`, `card_2.png`, ... in the same directory.
|
|
474
|
+
|
|
475
|
+
**Card specs:**
|
|
476
|
+
- **Size:** 1080×1440 (3:4 ratio, standard XHS image)
|
|
477
|
+
- **DPR:** 2 (retina quality, actual output 2160×2880)
|
|
478
|
+
- **Styles:** purple, xiaohongshu, mint, sunset, ocean, elegant, dark
|
|
479
|
+
|
|
480
|
+
**Pagination modes:**
|
|
481
|
+
- `auto` (default) — smart split on heading/paragraph boundaries using character-count heuristic
|
|
482
|
+
- `separator` — manual split on `---` in markdown
|
|
483
|
+
|
|
484
|
+
**How to interpret:**
|
|
485
|
+
- Uses the user's existing Chrome for rendering (via `puppeteer-core`) — no browser download needed
|
|
486
|
+
- Purely offline — no XHS API or cookies required
|
|
487
|
+
- Output images are ready for `redbook post --images cover.png card_1.png ...`
|
|
488
|
+
|
|
489
|
+
**Dependencies:** Requires `puppeteer-core` and `marked` (optional, install with `npm install -g puppeteer-core marked`).
|
|
490
|
+
|
|
491
|
+
**Composition with other modules:**
|
|
492
|
+
- Pairs with Module H (Content Brainstorm) — generate content ideas, write markdown, render to cards
|
|
493
|
+
- Pairs with Module J (Viral Replication) — extract template, write content matching the template, render
|
|
494
|
+
- Output feeds into `redbook post --images` for publishing
|
|
495
|
+
|
|
496
|
+
---
|
|
497
|
+
|
|
306
498
|
## Composed Workflows
|
|
307
499
|
|
|
308
500
|
Combine modules for different analysis depths.
|
|
@@ -332,22 +524,94 @@ The comprehensive playbook — keyword landscape, cross-topic heatmap, engagemen
|
|
|
332
524
|
|
|
333
525
|
No module composition needed — `analyze-viral` returns hook analysis, engagement ratios, comment themes, author baseline comparison, and a 0-100 viral score in one call.
|
|
334
526
|
|
|
335
|
-
### Viral Pattern Research
|
|
527
|
+
### Viral Pattern Research → Content Template
|
|
336
528
|
```bash
|
|
337
529
|
# 1. Find top notes
|
|
338
530
|
redbook search "keyword" --sort popular --json
|
|
339
531
|
|
|
340
|
-
# 2.
|
|
341
|
-
redbook
|
|
342
|
-
redbook analyze-viral "<url2>" --json
|
|
343
|
-
redbook analyze-viral "<url3>" --json
|
|
344
|
-
|
|
345
|
-
# 3. Synthesize across notes:
|
|
346
|
-
# - Which hookPatterns[] appear most often?
|
|
347
|
-
# - What collectToLikeRatio is typical?
|
|
348
|
-
# - What content structure drives saves vs. shares?
|
|
532
|
+
# 2. Extract template from top 3 notes (replaces manual synthesis)
|
|
533
|
+
redbook viral-template "<url1>" "<url2>" "<url3>" --json
|
|
349
534
|
```
|
|
350
535
|
|
|
536
|
+
`viral-template` automates what previously required manual synthesis across `analyze-viral` results. It outputs a `ContentTemplate` JSON that captures dominant hooks, body structure ranges, engagement profile, and audience signals.
|
|
537
|
+
|
|
538
|
+
### Reply Management
|
|
539
|
+
**Modules:** I
|
|
540
|
+
|
|
541
|
+
Single-module workflow for managing comment engagement on your notes. Use `batch-reply --dry-run` to audit, then execute with a template.
|
|
542
|
+
|
|
543
|
+
### Content Replication
|
|
544
|
+
**Modules:** A → J → H → L
|
|
545
|
+
|
|
546
|
+
Keyword research → viral template extraction → data-backed content brainstorm → render to image cards. The template provides structural constraints that guide Module H's content ideas. Module L renders the final markdown to XHS-ready PNGs.
|
|
547
|
+
|
|
548
|
+
### Content Creation End-to-End
|
|
549
|
+
**Modules:** A → J → H → L → `post`
|
|
550
|
+
|
|
551
|
+
The full pipeline: research keywords → extract viral template → brainstorm content → write markdown → render to styled image cards → publish via `redbook post --images cover.png card_1.png ...`
|
|
552
|
+
|
|
553
|
+
### Full Operations
|
|
554
|
+
**Modules:** A → C → I → J → K
|
|
555
|
+
|
|
556
|
+
Comprehensive automation playbook — keyword analysis, engagement classification, comment operations, viral replication templates, and engagement automation workflow.
|
|
557
|
+
|
|
558
|
+
---
|
|
559
|
+
|
|
560
|
+
## Rate Limits & Safety
|
|
561
|
+
|
|
562
|
+
XHS enforces aggressive anti-spam (风控) that detects automated behavior through device fingerprinting, activity ratio monitoring, and timing pattern analysis. The CLI applies safe defaults based on platform research.
|
|
563
|
+
|
|
564
|
+
### Safe Thresholds
|
|
565
|
+
|
|
566
|
+
| Action | Safe Interval | CLI Default | Hard Cap |
|
|
567
|
+
|--------|--------------|-------------|----------|
|
|
568
|
+
| Post a note | 3-4 hours (2-3 notes/day max) | N/A (manual) | — |
|
|
569
|
+
| Comment | ≥3 minutes | N/A (manual) | — |
|
|
570
|
+
| Reply | ≥3 minutes | N/A (manual) | — |
|
|
571
|
+
| Batch reply delay | ≥3 minutes | 5 min ±30% jitter | — |
|
|
572
|
+
| Batch reply count | — | 10 | 30 |
|
|
573
|
+
|
|
574
|
+
### Anti-Detection Measures
|
|
575
|
+
|
|
576
|
+
- **Timing jitter:** ±30% random variation on all batch delays. Uniform intervals are a bot signature.
|
|
577
|
+
- **Hard caps:** Maximum 30 replies per batch (down from 50). No override.
|
|
578
|
+
- **Rate limit warnings:** `post`, `comment`, and `reply` commands display safe interval reminders after each action.
|
|
579
|
+
- **Captcha circuit breaker:** Batch operations stop immediately on captcha (NeedVerify).
|
|
580
|
+
|
|
581
|
+
### What Triggers Risk Control
|
|
582
|
+
|
|
583
|
+
- **Uniform timing** — replying at exact 3-second intervals flags bot detection
|
|
584
|
+
- **High frequency** — >50 interactions/minute across any action type
|
|
585
|
+
- **Activity ratio anomaly** — more comments than post views signals inauthentic behavior
|
|
586
|
+
- **Device fingerprint mismatch** — XHS fingerprints 21 hardware parameters
|
|
587
|
+
|
|
588
|
+
### Best Practices for Agents
|
|
589
|
+
|
|
590
|
+
1. Always `--dry-run` first, review candidates, then execute
|
|
591
|
+
2. Use the default 5-minute delay — do not override `--delay` below 180000 (3 min)
|
|
592
|
+
3. Limit batch runs to 1-2 per note per day
|
|
593
|
+
4. Vary reply templates between batches
|
|
594
|
+
5. Space `post` commands 3-4 hours apart (2-3 notes/day maximum)
|
|
595
|
+
|
|
596
|
+
---
|
|
597
|
+
|
|
598
|
+
## API vs Browser Limitations
|
|
599
|
+
|
|
600
|
+
The following operations work reliably via API:
|
|
601
|
+
- **Reading**: search, notes, comments, user profiles, feed
|
|
602
|
+
- **Writing**: top-level comments, comment replies
|
|
603
|
+
- **Analysis**: viral scoring, template extraction, batch reply planning
|
|
604
|
+
|
|
605
|
+
The following operations are unreliable via API (frequently trigger captcha):
|
|
606
|
+
- Publishing notes (use `--private` for higher success rate)
|
|
607
|
+
- Bulk operations at very high frequency
|
|
608
|
+
|
|
609
|
+
The following operations require browser automation (not supported by this CLI):
|
|
610
|
+
- Captcha solving, real-time notifications
|
|
611
|
+
- Like/collect/follow (heavy anti-automation enforcement)
|
|
612
|
+
- DM/private messaging
|
|
613
|
+
- Cover image generation (use external tools like Gemini/DALL-E)
|
|
614
|
+
|
|
351
615
|
---
|
|
352
616
|
|
|
353
617
|
## Command Details
|
|
@@ -443,6 +707,94 @@ Returns `{ note, score, hook, content, visual, engagement, comments, relative, f
|
|
|
443
707
|
- `relative.isOutlier` — true if viralMultiplier > 3
|
|
444
708
|
- `comments.themes[]` — top recurring keyword phrases from comments
|
|
445
709
|
|
|
710
|
+
### `redbook viral-template <url> [url2] [url3]`
|
|
711
|
+
|
|
712
|
+
Extract a reusable content template from 1-3 viral notes. Analyzes each note (same pipeline as `analyze-viral`) and synthesizes common structural patterns.
|
|
713
|
+
|
|
714
|
+
```bash
|
|
715
|
+
redbook viral-template "<url1>" "<url2>" "<url3>" --json
|
|
716
|
+
redbook viral-template "<url1>" --comment-pages 5 --json
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
**Options:**
|
|
720
|
+
- `--comment-pages <n>`: Comment pages to fetch per note (default: 3, max: 10)
|
|
721
|
+
|
|
722
|
+
**JSON output structure:**
|
|
723
|
+
Returns `{ dominantHookPatterns, titleStructure, bodyStructure, engagementProfile, audienceSignals, sourceNotes, generatedAt }`.
|
|
724
|
+
|
|
725
|
+
- `dominantHookPatterns[]` — hook types appearing in majority of input notes
|
|
726
|
+
- `titleStructure.avgLength` — average title length across notes
|
|
727
|
+
- `bodyStructure.lengthRange` — [min, max] body length
|
|
728
|
+
- `engagementProfile.type` — "reference" / "insight" / "entertainment"
|
|
729
|
+
- `audienceSignals.commonThemes[]` — merged comment themes across notes
|
|
730
|
+
|
|
731
|
+
### `redbook comment <url>`
|
|
732
|
+
|
|
733
|
+
Post a top-level comment on a note.
|
|
734
|
+
|
|
735
|
+
```bash
|
|
736
|
+
redbook comment "<noteUrl>" --content "Great post!" --json
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
**Options:**
|
|
740
|
+
- `--content <text>` (required): Comment text
|
|
741
|
+
|
|
742
|
+
### `redbook reply <url>`
|
|
743
|
+
|
|
744
|
+
Reply to a specific comment on a note.
|
|
745
|
+
|
|
746
|
+
```bash
|
|
747
|
+
redbook reply "<noteUrl>" --comment-id "<commentId>" --content "Thanks for asking!" --json
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
**Options:**
|
|
751
|
+
- `--comment-id <id>` (required): Comment ID to reply to (from `comments --json` output)
|
|
752
|
+
- `--content <text>` (required): Reply text
|
|
753
|
+
|
|
754
|
+
### `redbook batch-reply <url>`
|
|
755
|
+
|
|
756
|
+
Reply to multiple comments using a filtering strategy. Always preview with `--dry-run` first.
|
|
757
|
+
|
|
758
|
+
```bash
|
|
759
|
+
# Preview which comments match the strategy
|
|
760
|
+
redbook batch-reply "<noteUrl>" --strategy questions --dry-run --json
|
|
761
|
+
|
|
762
|
+
# Execute replies with a template (default 5 min delay with jitter)
|
|
763
|
+
redbook batch-reply "<noteUrl>" --strategy questions \
|
|
764
|
+
--template "感谢提问!{content}" --max 10
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
**Options:**
|
|
768
|
+
- `--strategy <name>`: `questions` (default), `top-engaged`, `all-unanswered`
|
|
769
|
+
- `--template <text>`: Reply template with `{author}`, `{content}` placeholders
|
|
770
|
+
- `--max <n>`: Max replies (default: 10, hard cap: 30)
|
|
771
|
+
- `--delay <ms>`: Delay between replies in ms (default: 300000 / 5 min, min: 180000 / 3 min). ±30% random jitter applied automatically.
|
|
772
|
+
- `--dry-run`: Preview candidates without posting (default when no template)
|
|
773
|
+
|
|
774
|
+
**Safety:** Stops immediately on captcha. No template = dry-run only. Delays include random jitter to avoid uniform timing patterns that trigger XHS bot detection.
|
|
775
|
+
|
|
776
|
+
### `redbook render <file>`
|
|
777
|
+
|
|
778
|
+
Render a markdown file with YAML frontmatter into styled PNG image cards. Uses the user's existing Chrome installation — no browser download needed.
|
|
779
|
+
|
|
780
|
+
```bash
|
|
781
|
+
redbook render content.md --style xiaohongshu
|
|
782
|
+
redbook render content.md --style dark --output-dir ./cards
|
|
783
|
+
redbook render content.md --pagination separator --json
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
**Options:**
|
|
787
|
+
- `--style <name>`: `purple`, `xiaohongshu` (default), `mint`, `sunset`, `ocean`, `elegant`, `dark`
|
|
788
|
+
- `--pagination <mode>`: `auto` (default), `separator` (split on `---`)
|
|
789
|
+
- `--output-dir <dir>`: Output directory (default: same as input file)
|
|
790
|
+
- `--width <n>`: Card width in px (default: 1080)
|
|
791
|
+
- `--height <n>`: Card height in px (default: 1440)
|
|
792
|
+
- `--dpr <n>`: Device pixel ratio (default: 2)
|
|
793
|
+
|
|
794
|
+
**Requires:** `puppeteer-core` and `marked` (`npm install -g puppeteer-core marked`). Does NOT require XHS cookies — purely offline rendering.
|
|
795
|
+
|
|
796
|
+
**Override Chrome path:** Set `CHROME_PATH` environment variable if Chrome is not in the standard location.
|
|
797
|
+
|
|
446
798
|
### `redbook whoami`
|
|
447
799
|
|
|
448
800
|
Check connection status. Verifies cookies are valid and shows the logged-in user.
|
|
@@ -582,3 +934,4 @@ const topics = await client.searchTopics("Claude Code");
|
|
|
582
934
|
- Node.js >= 22
|
|
583
935
|
- Logged into xiaohongshu.com in Chrome (or Safari/Firefox with `--cookie-source`)
|
|
584
936
|
- macOS (cookie extraction uses native keychain access)
|
|
937
|
+
- **For card rendering only:** `puppeteer-core` and `marked` (`npm install -g puppeteer-core marked`). Uses your existing Chrome — no additional browser download.
|