This commit is contained in:
Ubuntu
2026-07-03 16:58:28 +08:00
commit 32b43f85bd
6240 changed files with 1987678 additions and 0 deletions
+130
View File
@@ -0,0 +1,130 @@
# 小红书热点趋势自动化
基于小红书热门话题AI创作原创内容的工作流。
## 项目结构
```
xhs_trending_automation/
├── config/
│ └── config.json # 配置文件
├── scripts/
│ ├── __init__.py
│ ├── workflow.py # 主工作流入口 ⭐
│ ├── topic_discovery.py # 热点发现模块
│ ├── content_generator.py # AI内容生成模块
│ ├── publisher_adapter.py # 发布适配器(调用共享模块)
│ └── shared_utils.py # 共享工具(导入IT项目公共模块)
├── logs/ # 运行日志
├── output/ # 生成的内容
└── README.md
```
## 模块解耦设计
### 共享模块(来自IT资讯自动化)
| 功能 | 原始位置 | 本项目引用方式 |
|------|----------|---------------|
| 图片生成+发布 | `it_automation_enhanced/scripts/xiaohongshu_multi_image.py` | `shared_utils.get_xiaohongshu_publisher()` |
| 去AI化处理 | `skills/anti-ai-detector/humanize.py` | `shared_utils.get_anti_ai_humanizer()` |
### 独立模块
- `topic_discovery.py` - 小红书热点搜索和话题提取
- `content_generator.py` - AI内容创作和格式化
- `publisher_adapter.py` - 封装发布功能,解耦实现细节
## 使用方法
### 1. 自动发现热点并创作
```bash
cd /home/ubuntu/nanocode/xhs_trending_automation
python3 scripts/workflow.py --keyword "AI科技"
```
### 2. 直接指定话题创作
```bash
python3 scripts/workflow.py --topic "芯片技术发展"
```
### 3. 试运行(不发布)
```bash
python3 scripts/workflow.py --topic "机器人趋势" --dry-run
```
### 4. 指定风格
```bash
python3 scripts/workflow.py --topic "AI应用" --style warm
# 可选风格: tech(科技)/warm(温暖)/business(商业)
```
## 配置说明
编辑 `config/config.json`:
```json
{
"workflow": {
"search_keyword": "AI科技", // 默认搜索关键词
"search_limit": 5, // 搜索数量
"content_style": "tech", // 默认内容风格
"default_tags": ["科技趋势", "人工智能", "AI产业"]
}
}
```
## 工作流程
```
┌─────────────────┐
│ 1. 搜索热门话题 │ ← xhs search
└────────┬────────┘
▼
┌─────────────────┐
│ 2. 提取话题关键词│
└────────┬────────┘
▼
┌─────────────────┐
│ 3. AI创作内容 │ ← Moonshot API
└────────┬────────┘
▼
┌─────────────────┐
│ 4. 去AI化处理 │ ← 共享模块
└────────┬────────┘
▼
┌─────────────────┐
│ 5. 发布小红书 │ ← 共享发布模块
└─────────────────┘
```
## 日志
运行日志保存在 `logs/` 目录,按日期命名:
- `workflow_20260323.log`
## 依赖
- Python 3.8+
- `requests` - API调用
- `pyyaml` - 解析xhs输出
- `xhs` CLI - 小红书命令行工具
- 环境变量: `MOONSHOT_API_KEY`
## 与IT资讯自动化的区别
| 项目 | 数据来源 | 内容特点 | 发布频率 |
|------|----------|----------|----------|
| IT资讯自动化 | TechCrunch/Wired等 | 翻译+总结外刊 | 每日16:00 |
| 小红书热点趋势 | 小红书热门笔记 | AI原创蹭热点 | 按需/定时 |
## Git提交记录
工作流首次验证:
- 话题:AI产业冰山模型
- 笔记ID:69c0c0990000000023013f21
- 时间:2026-03-23 12:24