Files
nanocode/xhs_trending_automation/QUICKSTART.md
T
Ubuntu 32b43f85bd a
2026-07-03 16:58:28 +08:00

92 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 小红书热点趋势自动化 - 快速开始
## 目录结构
```
xhs_trending_automation/
├── scripts/
│ ├── workflow.py # 主工作流
│ ├── scheduler.sh # 定时调度器 ⭐
│ ├── view_logs.sh # 查看日志
│ └── ...
├── logs/ # 运行日志
├── output/ # 生成内容
└── config/config.json # 配置文件
```
## 快速命令
### 1. 手动运行(指定话题)
```bash
cd /home/ubuntu/nanocode/xhs_trending_automation
python3 scripts/workflow.py --topic "AI芯片" --dry-run # 试运行
python3 scripts/workflow.py --topic "AI芯片" # 正式发布
```
### 2. 手动运行(自动发现热点)
```bash
python3 scripts/workflow.py --keyword "科技"
```
### 3. 查看定时任务日志
```bash
./scripts/view_logs.sh # 查看今天日志
./scripts/view_logs.sh 20260323 # 查看指定日期
```
### 4. 手动触发今日定时任务
```bash
./scripts/scheduler.sh
```
## 定时任务配置
**已配置**: 每天 10:00 自动运行
**任务ID**: d002c8d0
**话题轮换**:
| 星期 | 话题 |
|------|------|
| 周一 | AI人工智能 |
| 周二 | 芯片技术 |
| 周三 | 机器人科技 |
| 周四 | 新能源技术 |
| 周五 | AI应用趋势 |
| 周六 | 科技投资 |
| 周日 | AI产业分析 |
## 修改定时时间
```bash
# 查看当前任务
cron list
# 删除任务
cron remove d002c8d0
# 重新添加(例如改为14:00)
cron add --cron_expr "0 14 * * *" --message "小红书热点趋势自动化"
```
## 故障排查
**问题**: 任务没有按时运行
```bash
# 检查日志
tail -50 logs/scheduler_$(date +%Y%m%d).log
# 手动测试
./scripts/scheduler.sh
```
**问题**: AI生成失败
- 检查环境变量: `echo $MOONSHOT_API_KEY`
- 检查网络连接
## 内容预览
试运行模式会在 `output/` 目录生成JSON文件,可以查看AI生成的内容:
```bash
ls -lt output/
cat output/content_20260323_*.json | jq '.title, .body[:100]'
```