You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
李恒宇 5ce08c46c2 feat 2 months ago
douyin_data feat 2 months ago
douyin_data_soupce feat 2 months ago
prompts feat 2 months ago
.env.example feat 2 months ago
.gitignore feat 2 months ago
AGENT_QUICKSTART.md feat 2 months ago
AI_CLASSIFICATION_UPDATE.md feat 2 months ago
CATEGORY_FIX_FINAL.md feat 2 months ago
CHANGES_SUMMARY.md feat 2 months ago
CHECKLIST.md feat 2 months ago
FINAL_UPDATE_SUMMARY.md feat 2 months ago
INSPIRATION_GUIDE.md feat 2 months ago
INSPIRATION_UPDATE.md feat 2 months ago
JSON_FORMAT_UPDATE.md feat 2 months ago
PROJECT_OVERVIEW.md feat 2 months ago
PROMPTS_GUIDE.md feat 2 months ago
QUICKSTART.md feat 2 months ago
README.md first commit 2 months ago
README_AGENT.md feat 2 months ago
README_AI.md feat 2 months ago
START_HERE.md feat 2 months ago
SUMMARY.md feat 2 months ago
UPDATE_SUMMARY.md feat 2 months ago
UPDATE_SUMMARY_20260107.md feat 2 months ago
URL_FIX.md feat 2 months ago
ai_agent.py feat 2 months ago
ai_analyzer.py feat 2 months ago
api.py feat 2 months ago
quick_test.py feat 2 months ago
requirements.txt feat 2 months ago
test_agent.py feat 2 months ago
test_ai_analysis.py feat 2 months ago
test_ai_classification.py feat 2 months ago
test_api.py feat 2 months ago
test_category_click.py feat 2 months ago
test_json_format.py feat 2 months ago
test_url_return.py feat 2 months ago
test_url_simple.py feat 2 months ago

README.md

抖音数据AI分析系统

一个基于AI Agent的智能抖音数据分析系统,支持自然语言交互、自主工具调用和提示词驱动。

核心特性

  • 🤖 AI Agent智能代理 - 自然语言交互,自动选择工具完成任务
  • 📊 数据抓取 - 支持搜索和创作指导两种数据源
  • 🧠 AI分析 - 基于阿里云百炼大模型的深度分析
  • 🎨 提示词驱动 - 修改提示词即可控制Agent行为
  • 🔧 易于扩展 - 轻松添加新工具和功能

🚀 快速开始

1. 安装依赖

pip install -r requirements.txt

2. 配置API Key

# 创建 .env 文件
echo "DASHSCOPE_API_KEY=your_api_key_here" > .env

获取API Key: https://dashscope.console.aliyun.com/

3. 测试运行

python test_agent.py

💡 使用示例

方式1:API接口(推荐)

# 启动服务
python api.py

# 调用Agent
curl -X POST "http://localhost:8001/api/agent" \
  -H "Content-Type: application/json" \
  -d '{"query": "帮我分析一下游戏类视频的热门趋势"}'

方式2:命令行

python ai_agent.py --query "帮我分析一下游戏类视频的热门趋势"

方式3:Python代码

from ai_agent import create_agent
import asyncio

async def main():
    agent = create_agent()
    result = await agent.run("帮我分析一下游戏类视频的热门趋势")
    print(result["final_answer"])

asyncio.run(main())

📖 文档

🎯 主要功能

1. AI Agent智能代理

用自然语言描述需求,Agent自动完成:

"帮我分析一下游戏类视频的热门趋势"
"我想做美食相关的内容,给我一些建议"
"王者荣耀的视频现在什么内容最火?"

2. 数据抓取

  • 搜索抖音视频
  • 获取创作指导数据
  • 支持分类筛选

3. AI分析

  • 内容趋势分析
  • 互动数据分析
  • 创作者分析
  • 热词分析
  • 实用建议

🎨 自定义

修改Agent行为

编辑 prompts/agent_prompt.md:

## 工作流程

**场景A:用户提到明确的分类**
- 使用 `get_creative_guidance` 获取数据
- 使用 `analyze_video_data` 分析
- 总结并给出建议

添加新工具

ai_agent.py 中:

# 1. 定义工具函数
async def your_tool(param: str) -> Dict:
    return {"success": True, "data": ...}

# 2. 注册工具
agent.register_tool(
    name="your_tool",
    func=your_tool,
    description="工具描述",
    parameters={...}
)

🏗️ 项目结构

.
├── ai_agent.py              # AI Agent核心模块 ⭐
├── ai_analyzer.py           # AI分析模块
├── api.py                   # FastAPI服务
├── prompts/
│   ├── agent_prompt.md     # Agent提示词 ⭐
│   └── analyze_prompt.md   # 分析提示词
├── douyin_data_soupce/     # 数据源模块
└── 文档/

🔧 技术栈

  • AI模型: 阿里云百炼(DashScope)
  • Web框架: FastAPI
  • 爬虫: Playwright
  • 语言: Python 3.8+

📊 API接口

  • POST /api/agent - AI智能代理(推荐)
  • POST /api/search - 搜索抖音视频
  • POST /api/creative-guidance - 获取创作指导
  • POST /api/analyze - AI分析数据
  • POST /api/analyze-file - 分析JSON文件

访问 http://localhost:8001/docs 查看完整API文档

🎓 工作原理

用户输入
    ↓
AI理解意图
    ↓
选择工具
    ↓
执行工具
    ↓
分析结果
    ↓
生成答案

💡 使用场景

  • 分析抖音内容趋势
  • 获取创作建议
  • 研究竞品策略
  • 发现热门话题
  • 优化内容方向

🆘 常见问题

Q: 如何获取API Key?

A: 访问 https://dashscope.console.aliyun.com/ 注册并创建

Q: 如何自定义Agent行为?

A: 编辑 prompts/agent_prompt.md 文件

Q: 如何添加新功能?

A: 在 ai_agent.py 中定义并注册新工具

Q: 支持哪些分类?

A: 全部、美食、旅行、泛生活、汽车、科技、游戏、二次元

📝 License

MIT

🤝 贡献

欢迎提交Issue和Pull Request!

📧 联系

如有问题,请查看文档或提交Issue。


开始使用: 查看 START_HERE.md 📖