📝 Overview
Last 30 Days—CN Edition is a Chinese social media topic research tool that searches real discussion data from the past 30 days across three major platforms—Xiaohongshu, Douyin, and WeChat Official Accounts—and analyzes public opinion trends through cross-platform comparison. It supports two modes: general topic research and entity comparison, and outputs structured research reports and visualized HTML.
✨ Features
| Feature Module | Capability Description | Core Value |
|---|---|---|
| Three-platform data sources | Unified interface for Xiaohongshu/WeChat Official Accounts + Douyin broad-domain database interface data | Multi-dimensional public opinion perspectives |
| Keyword research | Supports multi-word combined queries (separated by English commas) | Flexible topic coverage |
| Cross-platform comparison | Automatically synthesizes data from the three platforms to generate insights | Discovers differentiated trends |
| Comparison | A vs B structured comparative analysis | Assists decision-making |
| HTML report | Interactive visualized report generation | Easy to share and disseminate |
| Historical backtracking | Supports data for any date within the past 30 days | Tracks trend evolution |
🔑 Authentication
The script requires an API Key to be configured. Obtain a personal Key from RedFox Data and configure the environment variable:
export REDFOX_API_KEY=ak_你的密钥
Priority: command line --api-key > REDFOX_API_KEY / X_API_KEY environment variable > configuration file.
Core Parameters
| Parameter | Description | Default Value |
|---|---|---|
keyword |
Search keywords (required, separate multiple words with English commas) | - |
--platforms |
Platform list (reducing is not recommended) | xhs,dy,gzh |
--count |
Number of items per platform | 50 |
--days |
Time range; set to 7 to view recent trends | 30 |
--output-format |
json / html / both |
json |
--output-dir |
Output directory | ~/Documents/CnLast30Days |
Platform signal interpretation:
| Platform | Content Characteristics | Key Metrics |
|---|---|---|
| Xiaohongshu (xhs) | Product recommendation experiences, tutorials and guides, user feedback | High saves/likes ratio = recommendation signal |
| Douyin (dy) | Hot topic follow-up comments, knowledge fragments, emotional spread | Shares = dissemination power |
| WeChat Official Accounts (gzh) | In-depth industry analysis, opinion output, data reports | Reads = attention, shares = recognition |
Workflow
1. Environment check
Before running, ensure that an API Key is configured (environment variable REDFOX_API_KEY or --api-key parameter). If not configured, prompt the user:
Please configure the API Key:
export REDFOX_API_KEY=ak_你的密钥, registration address https://www.redfox.hk/login
2. Keyword quality check
Before running the engine, check whether the topic is too vague (such as "tools" or "methods"); if so, ask the user to make it more specific.
3. Pre-research
Before calling the engine, run 2-3 WebSearch queries in parallel to extract hot keywords and background:
小红书 {TOPIC} 热门讨论→ Extract Xiaohongshu hot keywords抖音 {TOPIC} 热门话题→ Extract Douyin tags{TOPIC} 最新动态→ Supplement timely background
4. Query plan
Determine the query strategy based on preliminary research:
- Prioritize merging related keywords into a single call (e.g.,
"产品经理,AI产品经理") - At most 5 keywords per platform; only split calls when the topic dimensions differ greatly
- By default, call the engine only once
5. Run the engine
python3 scripts/cn_last30days.py "{TOPIC},{SUBTOPIC}" \
--platforms xhs,dy,gzh \
--count 50 \
--days 30 \
--output-format json \
--output-dir="${CN_LAST30DAYS_MEMORY_DIR:-$HOME/Documents/CnLast30Days}"
Run in the foreground, with a 5-minute timeout; do not run in the background. Read the complete output, including titles, authors, engagement data, and links from the three platforms.
6. WebSearch supplement
After the engine finishes, supplement with 1-2 WebSearch queries to cover sources not covered by the engine, such as Zhihu, Bilibili, and 36Kr. Exclude xiaohongshu.com / douyin.com / mp.weixin.qq.com (already covered by the engine).
7. Comprehensive output
Follow the output rules to generate the research report. Core principles:
- After the badge and before "My Findings", you must output the "Data Overview" module: in the order of WeChat Official Account → Xiaohongshu → Douyin, display a TOP5 works table for each platform (titles as clickable hyperlinks, authors, and platform-specific engagement metrics displayed in separate columns (WeChat Official Account reads/likes/shares, Xiaohongshu likes/saves/comments, Douyin likes/comments/shares)), and at the end of the module display the total data volume and an HTML report prompt
- Synthesize by topic/story, not by listing platform by platform
- Conclusions cross-validated across multiple platforms have the highest confidence
- High-engagement content has the highest weight (including genuine user signals)
- Each narrative paragraph starts with a bold title, followed by
-and the body text - Citations must be clickable Markdown links
After the comprehensive report is completed,automatically executethe following steps to generate the HTML report (no need to ask the user):
# 直接从 JSON 生成 HTML(不调 API,不写入 Markdown)
python3 scripts/cn_last30days.py --from-json "JSON文件路径" \
--output-dir="${CN_LAST30DAYS_MEMORY_DIR:-$HOME/Documents/CnLast30Days}"
# 自动打开 HTML 报告
open "HTML文件路径"
The script will output the HTML file path; after opening it automatically, simply inform the user of the path.
Other resources
- Output rules and templates - Output rules (LAW), general/comparison query output format templates
- Script files - Python engine (Python 3.8+, standard library only)