
Douyin Account Diagnosis
- 250 installs
- 316 repo stars
- Updated August 4, 2026
- redfox-data/redfox-community
Use douyin-account-diagnosis for development tasks
About
douyin-account-diagnosis: A skill for development. This provides functionality for development workflows.
- douyin-account-diagnosis
Douyin Account Diagnosis by the numbers
- 250 all-time installs (skills.sh)
- +16 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #1,514 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/redfox-data/redfox-community --skill douyin-account-diagnosisAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 250 |
|---|---|
| repo stars | ★ 316 |
| Last updated | August 4, 2026 |
| Repository | redfox-data/redfox-community ↗ |
What it does
Use douyin-account-diagnosis for development tasks
Files
抖音账号诊断宗师
简介
抖音账号诊断宗师是一款专业的抖音账号数据分析工具,通过红狐API接口获取账号精确数据,从四个维度进行全面诊断评估。
通过简单的账号输入,你可以:
- 📊 获取四维度量化评分(100分制),告别主观判断
- 📋 自动生成评分计算明细 + 完整诊断报告
- 💡 获得针对性的优势/短板分析和优化建议
适用于品牌方、MCN机构、自媒体从业者、内容运营人员等需要评估抖音账号表现的场景。
触发方式:
- "诊断抖音账号"、"抖音账号分析"、"抖音体检"
- "抖音评估"、"查看XX抖音数据"
- 直接输入抖音名称 + "诊断/分析"
---
功能特性
🎯 核心功能
| 功能 | 说明 |
|---|---|
| 📊 四维度评分 | 账号体量(35分) + 内容表现(35分) + 运营活跃度(20分) + 平台指数(10分) = 100分 |
| 📋 诊断报告 | 自动生成评分计算明细 + 完整诊断报告(基本信息/核心数据/综合评分/优化建议) |
| 🔍 账号查询 | 支持按昵称(模糊匹配)或抖音号(精确匹配)查询 |
| 💡 优化建议 | 基于评分数据自动生成优势/短板分析和3条优化建议 |
✨ 特色亮点
- ⚡ 精准数据:基于红狐API接口,所有数据来源可追溯,严禁估算编造
- 📈 标准化评分:统一的评分标准,横向可比,避免主观判断
- 🔧 兼容null值:playCount为null时不影响评分,传播系数使用分享/点赞比替代
- 🏷️ 分类映射:API返回的账号分类自动映射为统一输出名称
完整的评分标准、评分细则表、综合评级标准详见 → references/core_workflow.md 第3节(四维度评分体系)
优势/短板/建议生成逻辑详见 → references/core_workflow.md 第4节
输出模板(评分计算明细 + 诊断报告格式)详见 → references/core_workflow.md 第5节(输出模板)
---
一键安装
前置条件
- 已获取红狐API Key(前往 redfox.hk 申请,格式
ak_xxx)
环境变量配置
| 变量名 | 必填 | 说明 |
|---|---|---|
REDFOX_API_KEY | 是 | 红狐API访问密钥,格式 ak_xxx |
API配置
| 配置项 | 值 |
|---|---|
| 接口地址 | POST https://redfox.hk/story/api/dyUser/query |
| 认证方式 | 请求头 X-API-KEY |
| 积分消耗 | 每次查询0.6积分 |
| 来源标识 | 抖音账号诊断宗师-GitHub |
完整的请求参数与响应字段详见 → references/core_workflow.md 第2节(API调用配置)
---
使用指南
基础使用
1. 输入账号
告诉助手你想诊断的抖音账号:
用户:诊断抖音账号"良田"
助手:🔍 正在查询抖音账号:良田...
2. 查看评分明细
系统自动计算四维度得分并输出评分计算过程:
**维度一:账号体量(35分)**
+ 粉丝数 21,434,182(1000-5000万)→ 19分
+ 获赞总数 589,189,024(1-10亿)→ 6分
+ 获赞/粉丝比 ≈ 27.5(≥15)→ 5分
+ **小计:30分**
...3. 查看诊断报告
评分明细之后自动输出完整诊断报告,包含基本信息、核心数据、综合评分和优化建议。
命令速查
| 输入方式 | 示例 | 说明 |
|---|---|---|
| 按昵称查询 | 诊断抖音账号"良田" | 模糊匹配昵称 |
| 按抖音号查询 | 诊断抖音号 liangtian5147 | 精确匹配抖音号 |
| 按名称+操作 | 良田 抖音分析 | 自然语言触发 |
特殊情况
- 未查询到账号:API返回空数据时,输出收录引导文案,严禁生成无依据报告
未查询到当前账号的相关信息,可提交当前抖音账号进行账号收录。
1. 回复抖音号(在抖音个人主页显示的ID,如 1212_1234),即可进行账号收录。30分钟后将自动为您推送诊断报告~
2. 下次再说;
- API调用失败:降级为联网搜索,明确标注数据来源。严禁从第三方渠道估算或补充API未返回的字段。
---
使用场景
场景一:品牌方账号评估
角色:品牌营销经理
需求:评估潜在合作达人的账号质量和内容表现
使用方式: 1. 输入达人抖音昵称进行诊断 2. 查看综合评分和四个维度得分率 3. 关注内容表现和运营活跃度,判断达人近期状态
预期收益:用数据代替直觉,科学评估达人合作价值
---
场景二:MCN机构达人管理
角色:MCN运营人员
需求:定期监测旗下达人的账号健康度和运营节奏
使用方式: 1. 定期对旗下达人进行账号诊断 2. 关注运营活跃度维度的更新频率和发布时段 3. 根据优化建议指导达人调整发布策略
预期收益:及时发现问题账号,提升达人管理效率
---
场景三:自媒体账号优化
角色:抖音博主 / 内容运营
需求:了解自身账号表现,找到优化方向
使用方式: 1. 输入自己的抖音账号进行诊断 2. 重点查看短板和优化建议 3. 针对性改善发布时段、内容选题或运营节奏
预期收益:明确优化方向,提升账号数据表现
---
项目架构
目录结构
douyin-account-diagnosis/
├── SKILL.md # 技能定义文件(本文件)
├── CONFIG.json # 技能配置(版本/评分维度/API配置/分类映射)
├── references/
│ └── core_workflow.md # 核心工作流(完整技术参考)
└── scripts/
├── douyin_api_client.py # 红狐API调用客户端
└── generate_diagnosis_report.py # 诊断报告生成器核心模块
| 模块 | 文件 | 职责 |
|---|---|---|
| 技能定义 | SKILL.md | 触发场景、功能介绍、使用指南 |
| 核心工作流 | references/core_workflow.md | 完整的API配置、评分体系、输出模板、行为规范 |
| API客户端 | scripts/douyin_api_client.py | 红狐API调用、数据获取、降级处理 |
| 报告生成器 | scripts/generate_diagnosis_report.py | 四维度评分计算、诊断报告格式化输出 |
| 技能配置 | CONFIG.json | 版本信息、评分维度、API配置、分类映射 |
数据流转
用户输入(昵称/抖音号) → API客户端 → 红狐API → 原始数据
↓
诊断报告 ← 报告生成器 ← 评分计算 ← 数据解析完整的账号分类映射详见 → references/core_workflow.md 第6节(账号分类映射)
完整的Agent行为规范详见 → references/core_workflow.md 第7节(Agent行为规范)
---
常见问答
安装相关问题
Q1: 如何获取红狐API Key?
A: 前往 redfox.hk 注册账号,在控制台申请API Key,格式为 ak_xxx。
Q2: 每次查询消耗多少积分?
A: 每次查询消耗0.6积分。积分不足时(API返回code=3201),系统会降级为联网搜索并标注数据来源。
使用相关问题
Q3: 昵称查询和抖音号查询有什么区别?
A: 昵称查询使用 accountNames 参数,为模糊匹配,可能返回多个结果(取第一个);抖音号查询使用 accountIds 参数,为精确匹配。
Q4: 为什么红狐指数显示0.0?
A: 部分账号可能未被红狐平台收录或数据未更新,此时 redfoxIndex 返回0.0或null,平台指数维度得0分。
Q5: 诊断报告中为什么没有播放量?
A: 红狐API返回的 playCount 字段常为null,本工具不估算播放量,也不计算依赖播放量的指标(如点赞率)。
故障排除
Q6: 提示"未查询到账号"怎么办?
A: 可能原因: 1. 输入的昵称或抖音号有误,请检查后重试 2. 该账号尚未被红狐平台收录,可按提示提交数据收录申请 3. 尝试使用抖音号(而非昵称)进行精确查询
Q7: API调用失败如何处理?
A: 系统会自动降级为联网搜索,并在报告中明确标注数据来源。严禁从第三方渠道估算或补充API未返回的字段。
---
Douyin Account Diagnosis / douyin-account-diagnosis
---
Overview
Enter a Douyin account name or ID to receive a comprehensive diagnosis across four dimensions—account scale, content performance, operational activity, and platform index—with a 100-point quantified score and a full diagnostic report in one click.
Core Value
- Four-dimension quantified scoring: Account scale + Content performance + Operational activity + Platform index—say goodbye to subjective judgment
- Scoring breakdown + Diagnostic report: Automatically generates the scoring process and a full diagnostic report with traceable data
- Strengths / Weaknesses + Optimization suggestions: Data-driven analysis with targeted optimization directions
Intended Users
- 🏢 Brands / MCN agencies — Replace intuition with data for science-based influencer partnership evaluation
- 📱 Douyin creators / Self-media — Understand your account performance and find optimization directions
- 📊 Content operators — Regularly monitor account health and guide publishing strategy adjustments
---
Features
Core Capabilities
- Four-dimension scoring: Account scale (35 pts) + Content performance (35 pts) + Operational activity (20 pts) + Platform index (10 pts) = 100 pts, unified standard for cross-account comparison
- Full diagnostic report: Automatically generates scoring breakdown + basic info / core data / comprehensive score / optimization suggestions
- Flexible querying: Supports fuzzy matching by nickname or exact matching by Douyin ID
- Smart optimization suggestions: Automatically generates strengths / weaknesses analysis and 3 optimization suggestions based on scoring data
Highlights
- Precise data-driven: Based on RedFoxHub API for real data, all scores are traceable
- Standardized scoring system: Unified 100-point scoring standard for cross-account comparison, avoiding subjective judgment
- Compatible with incomplete data: Automatically uses alternative metrics when play count is unavailable, without affecting the overall score
- Automatic category mapping: API-returned account categories are automatically mapped to unified output names
---
API Key Acquisition & Security
- This skill requires the environment variable:
REDFOX_API_KEY. REDFOX_API_KEYis issued by RedFoxHub (https://redfox.hk).- Register at RedFoxHub to obtain
REDFOX_API_KEY. - Configure
REDFOX_API_KEYon your device before using this skill. - Before providing your key, confirm its source, scope, validity period, and whether it can be reset or revoked.
- Do not hard-code or expose keys in plain text in code, prompts, logs, or output files.
---
Usage Guide
Simply say the Douyin account you want to diagnose in natural language—no fixed commands to memorize.
Quick Reference
| Intent | Example Phrase | Result |
|---|---|---|
| Diagnose by nickname | "Diagnose Douyin account Liangtian" | Fuzzy match nickname, generate full diagnostic report |
| Diagnose by Douyin ID | "Diagnose Douyin ID liangtian5147" | Exact match Douyin ID, generate full diagnostic report |
| Natural language trigger | "Liangtian Douyin analysis" | Auto-detect account and intent, output diagnosis results |
Output Example
After diagnosis, you will receive a scoring breakdown followed by a full diagnostic report:
Scoring Breakdown (illustrative):
**Dimension 1: Account Scale (35 pts)**
+ Followers 201,242,077 (≥50M) → 22 pts
+ Total likes 18,112,283,863 (≥1B) → 8 pts
+ Likes/Followers ratio ≈ 90.0 (≥15) → 5 pts
+ **Subtotal: 35 pts (full score)**
**Overall Score: 93.0 pts — 🏆 S-tier Benchmark Account**Diagnostic Report (illustrative):
| Dimension | Score | Max | Score Rate |
|---|---|---|---|
| Account Scale | 35.0 | 35 pts | 100.0% |
| Content Performance | 29.0 | 35 pts | 82.9% |
| Operational Activity | 20.0 | 20 pts | 100.0% |
| Platform Index | 10.0 | 10 pts | 100.0% |
| Overall | 94.0 | 100 pts | 94.0% |
---
Use Cases
| Scenario | Role | Example Question | Benefit |
|---|---|---|---|
| Influencer partnership evaluation | Brand marketing manager | "Diagnose Douyin account Liangtian, check partnership value" | Replace intuition with data for science-based evaluation |
| Managed creator monitoring | MCN operator | "Help me analyze our managed creators' Douyin accounts" | Spot problem accounts early, improve management efficiency |
| Self-account optimization | Douyin creator / operator | "Analyze my Douyin ID, see what needs improvement" | Identify optimization directions, boost account performance |
---
抖音账号诊断宗师
简介
抖音账号诊断宗师是一款专业的抖音账号数据分析工具,通过红狐API接口获取账号精确数据,从账号、内容、运营活跃度等维度进行全面诊断评估。
通过简单的账号输入,你可以:
- 📊 获取四维度量化评分(100分制),告别主观判断
- 📋 自动生成评分计算明细 + 完整诊断报告
- 💡 获得针对性的优势/短板分析和优化建议
适用于品牌方、MCN机构、自媒体从业者、内容运营人员等需要评估抖音账号表现的场景。
触发方式:
- "诊断抖音账号"、"抖音账号分析"、"抖音体检"
- "抖音评估"、"查看XX抖音数据"
- 直接输入抖音名称 + "诊断/分析"
---
功能特性
🎯 核心功能
| 功能 | 说明 |
|---|---|
| 📊 四维度评分 | 账号体量(35分) + 内容表现(35分) + 运营活跃度(20分) + 平台指数(10分) = 100分 |
| 📋 诊断报告 | 自动生成评分计算明细 + 完整诊断报告(基本信息/核心数据/综合评分/优化建议) |
| 🔍 账号查询 | 支持按昵称(模糊匹配)或抖音号(精确匹配)查询 |
| 💡 优化建议 | 基于评分数据自动生成优势/短板分析和3条优化建议 |
✨ 特色亮点
- ⚡ 精准数据:基于红狐API接口,所有数据来源可追溯,严禁估算编造
- 📈 标准化评分:统一的评分标准,横向可比,避免主观判断
- 🔧 兼容null值:playCount为null时不影响评分,传播系数使用分享/点赞比替代
- 🏷️ 分类映射:API返回的账号分类自动映射为统一输出名称
完整的评分标准、评分细则表、综合评级标准详见 → references/core_workflow.md 第3节(四维度评分体系)
优势/短板/建议生成逻辑详见 → references/core_workflow.md 第4节
输出模板(评分计算明细 + 诊断报告格式)详见 → references/core_workflow.md 第5节(输出模板)
---
一键安装
前置条件
- 已获取红狐API Key(前往 redfox.hk 申请,格式
ak_xxx)
环境变量配置
| 变量名 | 必填 | 说明 |
|---|---|---|
REDFOX_API_KEY | 是 | 红狐API访问密钥,格式 ak_xxx |
API配置
| 配置项 | 值 |
|---|---|
| 接口地址 | POST https://redfox.hk/story/api/dyUser/query |
| 认证方式 | 请求头 X-API-KEY |
| 积分消耗 | 每次查询0.6积分 |
| 来源标识 | 抖音账号诊断宗师-GitHub |
完整的请求参数与响应字段详见 → references/core_workflow.md 第2节(API调用配置)
---
使用指南
基础使用
1. 输入账号
告诉助手你想诊断的抖音账号:
用户:诊断抖音账号"良田"
助手:🔍 正在查询抖音账号:良田...
2. 查看评分明细
系统自动计算四维度得分并输出评分计算过程:
**维度一:账号体量(35分)**
+ 粉丝数 21,434,182(1000-5000万)→ 19分
+ 获赞总数 589,189,024(1-10亿)→ 6分
+ 获赞/粉丝比 ≈ 27.5(≥15)→ 5分
+ **小计:30分**
...3. 查看诊断报告
评分明细之后自动输出完整诊断报告,包含基本信息、核心数据、综合评分和优化建议。
命令速查
| 输入方式 | 示例 | 说明 |
|---|---|---|
| 按昵称查询 | 诊断抖音账号"良田" | 模糊匹配昵称 |
| 按抖音号查询 | 诊断抖音号 liangtian5147 | 精确匹配抖音号 |
| 按名称+操作 | 良田 抖音分析 | 自然语言触发 |
特殊情况
- 未查询到账号:API返回空数据时,输出收录引导文案,严禁生成无依据报告
未查询到当前账号的相关信息,可提交当前抖音账号进行账号收录。
1. 回复抖音号(在抖音个人主页显示的ID,如 1212_1234),即可进行账号收录。30分钟后将自动为您推送诊断报告~
2. 下次再说;
- API调用失败:降级为联网搜索,明确标注数据来源。严禁从第三方渠道估算或补充API未返回的字段。
---
使用场景
场景一:品牌方账号评估
角色:品牌营销经理
需求:评估潜在合作达人的账号质量和内容表现
使用方式: 1. 输入达人抖音昵称进行诊断 2. 查看综合评分和四个维度得分率 3. 关注内容表现和运营活跃度,判断达人近期状态
预期收益:用数据代替直觉,科学评估达人合作价值
---
场景二:MCN机构达人管理
角色:MCN运营人员
需求:定期监测旗下达人的账号健康度和运营节奏
使用方式: 1. 定期对旗下达人进行账号诊断 2. 关注运营活跃度维度的更新频率和发布时段 3. 根据优化建议指导达人调整发布策略
预期收益:及时发现问题账号,提升达人管理效率
---
场景三:自媒体账号优化
角色:抖音博主 / 内容运营
需求:了解自身账号表现,找到优化方向
使用方式: 1. 输入自己的抖音账号进行诊断 2. 重点查看短板和优化建议 3. 针对性改善发布时段、内容选题或运营节奏
预期收益:明确优化方向,提升账号数据表现
---
项目架构
目录结构
douyin-account-diagnosis/
├── SKILL.md # 技能定义文件(本文件)
├── CONFIG.json # 技能配置(版本/评分维度/API配置/分类映射)
├── references/
│ └── core_workflow.md # 核心工作流(完整技术参考)
└── scripts/
├── douyin_api_client.py # 红狐API调用客户端
└── generate_diagnosis_report.py # 诊断报告生成器核心模块
| 模块 | 文件 | 职责 |
|---|---|---|
| 技能定义 | SKILL.md | 触发场景、功能介绍、使用指南 |
| 核心工作流 | references/core_workflow.md | 完整的API配置、评分体系、输出模板、行为规范 |
| API客户端 | scripts/douyin_api_client.py | 红狐API调用、数据获取、降级处理 |
| 报告生成器 | scripts/generate_diagnosis_report.py | 四维度评分计算、诊断报告格式化输出 |
| 技能配置 | CONFIG.json | 版本信息、评分维度、API配置、分类映射 |
数据流转
用户输入(昵称/抖音号) → API客户端 → 红狐API → 原始数据
↓
诊断报告 ← 报告生成器 ← 评分计算 ← 数据解析完整的账号分类映射详见 → references/core_workflow.md 第6节(账号分类映射)
完整的Agent行为规范详见 → references/core_workflow.md 第7节(Agent行为规范)
---
常见问答
安装相关问题
Q1: 如何获取红狐API Key?
A: 前往 redfox.hk 注册账号,在控制台申请API Key,格式为 ak_xxx。
Q2: 每次查询消耗多少积分?
A: 每次查询消耗0.6积分。积分不足时(API返回code=3201),系统会降级为联网搜索并标注数据来源。
使用相关问题
Q3: 昵称查询和抖音号查询有什么区别?
A: 昵称查询使用 accountNames 参数,为模糊匹配,可能返回多个结果(取第一个);抖音号查询使用 accountIds 参数,为精确匹配。
Q4: 为什么红狐指数显示0.0?
A: 部分账号可能未被红狐平台收录或数据未更新,此时 redfoxIndex 返回0.0或null,平台指数维度得0分。
Q5: 诊断报告中为什么没有播放量?
A: 红狐API返回的 playCount 字段常为null,本工具不估算播放量,也不计算依赖播放量的指标(如点赞率)。
故障排除
Q6: 提示"未查询到账号"怎么办?
A: 可能原因: 1. 输入的昵称或抖音号有误,请检查后重试 2. 该账号尚未被红狐平台收录,可按提示提交数据收录申请 3. 尝试使用抖音号(而非昵称)进行精确查询
Q7: API调用失败如何处理?
A: 系统会自动降级为联网搜索,并在报告中明确标注数据来源。严禁从第三方渠道估算或补充API未返回的字段。
---
抖音账号诊断宗师核心工作流
Agent 执行抖音账号诊断任务时的完整技术参考,包含 API、评分算法、输出模板和行为约束。
---
1. 工作流步骤
步骤1:识别输入
- 用户提供抖音昵称(中文)或抖音号(unique_id/short_id/uid)
- 中文昵称 → 使用
accountNames参数查询(模糊匹配) - 抖音号/ID → 使用
accountIds参数查询(精确匹配)
步骤2:查询数据
调用红狐API接口:
POST https://redfox.hk/story/api/dyUser/query
Headers: Content-Type: application/json, X-API-KEY: {REDFOX_API_KEY}
Body: {"accountNames": ["昵称"], "source": "抖音账号诊断宗师-GitHub"}
或
Body: {"accountIds": ["抖音号"], "source": "抖音账号诊断宗师-GitHub"}步骤3:处理查询结果
成功时(code: 2000, data非空):
- 取 data[0] 作为诊断对象
- 按第3节评分体系计算四维度得分
- 按第5节输出模板生成诊断报告
未找到时(code: 2000, data为空数组):
- 输出收录引导文案:
未查询到当前账号的相关信息,可提交当前抖音账号进行账号收录。
1. 回复抖音号(在抖音个人主页显示的ID,如 1212_1234),即可进行账号收录。30分钟后将自动为您推送诊断报告~
2. 下次再说;
- 等待用户回复抖音号后,调用账号收录接口(见下方步骤3b)
- 严禁生成无依据报告
API错误时(code非2000):
- code=3201:积分不足,降级为联网搜索并标注数据来源
- 其他错误:提示用户稍后重试
步骤3b:账号收录(用户回复抖音号后触发)
当用户在「未找到账号」引导后回复了抖音号,调用收录接口将该账号加入同步队列:
POST https://redfox.hk/story/api/dyUser/syncUserNotes
Headers: Content-Type: application/json, X-API-KEY: {REDFOX_API_KEY}
Body: {"accountId": "用户回复的抖音号", "source": "抖音账号诊断宗师-GitHub"}请求参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| accountId | String | 是 | 抖音账号ID(支持 unique_id、short_id、uid 任一匹配) |
| source | String | 否 | 调用来源 |
响应处理:
- 成功(HTTP 200 / code: 200):输出收录成功提示
✅ 已成功提交收录申请!系统将异步拉取该账号数据,约30分钟后可重新诊断查看报告~
- 失败(code: 400):参数错误,提示用户检查抖音号
- 失败(code: 500):业务异常,提示用户稍后重试
注意:收录接口为异步触发,调用成功仅表示已加入同步队列,并非数据已就绪。需等待约30分钟后重新查询。
步骤4:生成报告
- 严格按照第5节输出模板格式输出
- 所有数值从API返回数据中取值,禁止自行编造
- 所有评分精确到1位小数
---
2. API 调用配置
接口地址
| 用途 | 地址 |
|---|---|
| 查询接口 | POST https://redfox.hk/story/api/dyUser/query |
| 收录接口 | POST https://redfox.hk/story/api/dyUser/syncUserNotes |
请求配置
- 请求方式:POST
- 请求头:
Content-Type: application/json+X-API-KEY: {REDFOX_API_KEY} - 认证方式:Header
X-API-KEY,值从环境变量REDFOX_API_KEY获取(格式ak_xxx) - 积分消耗:每次查询0.6积分
查询接口
请求体:
{
"accountIds": ["Dailytaste"],
"accountNames": ["人民日报"],
"source": "抖音账号诊断宗师-GitHub"
}| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| accountIds | List\<String\> | 否* | 抖音号(unique_id/short_id/uid) |
| accountNames | List\<String\> | 否* | 抖音昵称(模糊匹配) |
| source | String | 否 | 来源标识,默认抖音账号诊断宗师-GitHub |
*accountIds和accountNames至少传一个
账号级返回字段:
| 字段 | 类型 | 说明 |
|---|---|---|
| nickname | String | 昵称 |
| accountId | String | 抖音号 |
| uid | String | 用户唯一ID |
| signature | String | 简介 |
| gender | String | 性别 |
| age | Integer | 年龄(可为null) |
| country | String | 国家 |
| province | String | 省份 |
| city | String | 城市 |
| ipLocation | String | IP属地(可为null) |
| followerCount | Long | 粉丝数 |
| awemeCount | Integer | 作品总数 |
| totalFavorited | Long | 获赞总数 |
| crawlTime | String | 数据抓取时间 |
| redfoxIndex | Double | 红狐指数(可为null) |
| works | List | 近7天作品列表 |
| similarAccounts | List | 相似账号列表 |
作品级返回字段(works):
| 字段 | 类型 | 说明 |
|---|---|---|
| awemeId | String | 作品唯一ID |
| title | String | 作品标题 |
| coverUrl | String | 作品封面链接 |
| desc | String | 作品描述(可能为空) |
| createTime | String | 发布时间(如 "2026-06-03 21:57:03") |
| diggCount | Long | 点赞数 |
| commentCount | Long | 评论数 |
| shareCount | Long | 分享数 |
| playCount | Long/null | 播放量(常为null) |
| interactiveCount | Long | 互动总数 |
| workUrl | String | 作品链接 |
相似账号字段(similarAccounts):
| 字段 | 类型 | 说明 |
|---|---|---|
| nickname | String | 昵称 |
| displayId | String | 显示ID |
| uid | String | 用户唯一ID |
| avatarUrl | String | 头像链接 |
| followerCount | Long | 粉丝数 |
| awemeCount | Integer | 作品数 |
| totalFavorited | Long | 获赞总数 |
| signature | String | 账号简介 |
| accountClassifyFirst | String | 账号分类(需映射,见第6节分类映射表) |
| redfoxIndex | Double | 红狐指数 |
---
3. 四维度评分体系(100分制)
设计原则
1. 仅依赖API可返回字段 — 所有指标均来自API返回数据 2. 兼容playCount=null — 不将播放量作为必要计算因子 3. 0换算 — 每项直接评分,无需乘系数/换算 4. 不重复 — 同一指标只在一个维度出现
---
维度一:账号体量(35分)
评估账号的基础规模和粉丝价值
| 指标 | 满分 | 评分标准 | 数据来源 |
|---|---|---|---|
| 粉丝数 | 22分 | 见下表 | followerCount |
| 获赞总数 | 8分 | 见下表 | totalFavorited |
| 获赞/粉丝比 | 5分 | 见下表 | totalFavorited/followerCount |
粉丝数评分(22分)
| 得分 | 粉丝数 | 量级 |
|---|---|---|
| 22分 | ≥5000万 | 超头部 |
| 19分 | 1000-5000万 | 头部 |
| 16分 | 500-1000万 | 准头部 |
| 12分 | 100-500万 | 中腰部 |
| 9分 | 50-100万 | 中小 |
| 5分 | 10-50万 | 小型 |
| 2分 | 1-10万 | 微型 |
| 0分 | <1万 | 新号 |
获赞总数评分(8分)
| 得分 | 获赞数 |
|---|---|
| 8分 | ≥10亿 |
| 6分 | 1-10亿 |
| 5分 | 1000万-1亿 |
| 3分 | 100-1000万 |
| 1分 | 10-100万 |
| 0分 | <10万 |
获赞/粉丝比评分(5分)
| 得分 | 比值 | 说明 |
|---|---|---|
| 5分 | ≥15 | 粉丝质量极高(历史爆款多) |
| 4分 | 10-15 | 粉丝质量高 |
| 3分 | 5-10 | 正常 |
| 2分 | 2-5 | 偏低(新号或粉丝活跃度低) |
| 1分 | <2 | 极低 |
---
维度二:内容表现(35分)
基于近7天作品数据评估内容市场表现,使用diggCount/commentCount/shareCount替代playCount依赖
| 指标 | 满分 | 数据来源 | 说明 |
|---|---|---|---|
| 平均点赞数 | 13分 | avg(works.diggCount) | 内容认可度 |
| 平均评论数 | 9分 | avg(works.commentCount) | 用户参与深度 |
| 平均分享数 | 7分 | avg(works.shareCount) | 传播力 |
| 传播系数 | 6分 | avg(shareCount/diggCount) | 分享/点赞比,衡量自发传播力 |
若近7天无作品(works为空),内容表现维度得0分
平均点赞数评分(13分)
| 得分 | 平均点赞 | 对应量级 |
|---|---|---|
| 13分 | ≥100万 | 现象级 |
| 11分 | 50-100万 | 超爆款 |
| 9分 | 10-50万 | 爆款 |
| 7分 | 1-10万 | 优秀 |
| 4分 | 1000-1万 | 中等 |
| 2分 | 100-1000 | 偏低 |
| 0分 | <100 | 较低 |
平均评论数评分(9分)
| 得分 | 平均评论 |
|---|---|
| 9分 | ≥1万 |
| 7分 | 5000-1万 |
| 5分 | 1000-5000 |
| 3分 | 100-1000 |
| 1分 | 10-100 |
| 0分 | <10 |
平均分享数评分(7分)
| 得分 | 平均分享 |
|---|---|
| 7分 | ≥10万 |
| 6分 | 1-10万 |
| 4分 | 1000-1万 |
| 2分 | 100-1000 |
| 1分 | 10-100 |
| 0分 | <10 |
传播系数评分(6分)
传播系数 = 分享数 / 点赞数(衡量用户自发传播意愿)
| 得分 | 传播系数 | 说明 |
|---|---|---|
| 6分 | ≥15% | 极强自发传播 |
| 5分 | 10-15% | 强传播力 |
| 4分 | 5-10% | 良好 |
| 2分 | 2-5% | 中等 |
| 1分 | <2% | 偏弱 |
---
维度三:运营活跃度(20分)
评估账号运营规范和活跃程度
| 指标 | 满分 | 评分标准 | 数据来源 |
|---|---|---|---|
| 更新频率 | 8分 | 近7天发布数 | len(works) |
| 发布时段 | 4分 | 是否在黄金时段 | works.createTime |
| 账号完整度 | 4分 | 简介是否非空 | signature |
| 作品总量 | 4分 | 历史作品数 | awemeCount |
更新频率评分(8分)
| 得分 | 近7天发布数 | 节奏 |
|---|---|---|
| 8分 | ≥7条 | 日更 |
| 6分 | 4-6条 | 高频 |
| 4分 | 2-3条 | 中频 |
| 2分 | 1条 | 低频 |
| 0分 | 0条 | 停更 |
发布时段评分(4分)
| 得分 | 时段 |
|---|---|
| 4分 | 黄金时段(11-13点/18-21点) |
| 3分 | 次优时段(7-9点/21-23点) |
| 1分 | 其他时段 |
| 0分 | 无作品可判断 |
账号完整度评分(4分)
| 得分 | 条件 |
|---|---|
| 4分 | 简介非空且>5字 |
| 2分 | 简介非空但≤5字 |
| 0分 | 简介为空 |
作品总量评分(4分)
| 得分 | 作品数 |
|---|---|
| 4分 | ≥300 |
| 3分 | 100-300 |
| 2分 | 30-100 |
| 1分 | 10-30 |
| 0分 | <10 |
---
维度四:平台指数(10分)
基于平台权威指数评估账号影响力
| 指标 | 满分 | 评分标准 | 数据来源 |
|---|---|---|---|
| 红狐指数 | 10分 | 见下表 | redfoxIndex |
若API未返回redfoxIndex(值为null),平台指数维度得0分
红狐指数评分(10分)
| 得分 | 红狐指数 | 影响力等级 |
|---|---|---|
| 10分 | ≥900 | 顶级影响力 |
| 8分 | 800-900 | 头部影响力 |
| 6分 | 700-800 | 中上影响力 |
| 4分 | 600-700 | 中等影响力 |
| 2分 | 500-600 | 初级影响力 |
| 0分 | <500 | 待提升 |
---
综合评分计算
综合评分 = 账号体量(0-35分) + 内容表现(0-35分) + 运营活跃度(0-20分) + 平台指数(0-10分)评级标准
| 得分 | 评级 | 说明 |
|---|---|---|
| 90-100 | 🏆 S级 | 标杆账号,行业领先 |
| 80-89 | ⭐ A级 | 优质账号,竞争力强 |
| 70-79 | ✅ B级 | 健康账号,有优化空间 |
| 60-69 | 📊 C级 | 中等账号,需重点优化 |
| 50-59 | ⚠️ D级 | 亚健康,需要调整 |
| <50 | ❌ E级 | 问题账号,急需优化 |
---
4. 优势/短板/建议生成逻辑
优势判断
| 条件 | 优势文案 |
|---|---|
| 账号体量≥28 | 账号体量雄厚 |
| 账号体量≥18 | 粉丝基础扎实 |
| 内容表现≥28 | 内容数据突出 |
| 内容表现≥18 | 内容表现良好 |
| 运营活跃度≥16 | 运营节奏健康 |
| 平台指数≥8 | 平台指数优秀 |
| 平台指数≥4 | 平台影响力良好 |
| 以上均不满足 | 有基础运营框架 |
取前2条输出,使用列表格式(+ 前缀)。
短板判断
| 条件 | 短板文案 |
|---|---|
| 账号体量<12 | 账号体量偏小 |
| 内容表现<10 | 近期内容表现较弱 |
| 内容表现==0 | 近7天无作品数据 |
| 运营活跃度<8 | 运营活跃度不足 |
| 平台指数==0 | 无平台指数数据 |
| 以上均不满足 | 整体表现均衡,持续优化即可 |
取前2条输出,使用列表格式(+ 前缀)。
建议生成
按短板优先级排序,至少3条:
| 条件 | 问题 | 建议 |
|---|---|---|
| 内容表现==0 | 近7天无作品更新 | 恢复稳定发布节奏,建议至少周更2-3条 |
| 内容表现<12 | 内容互动数据偏低 | 优化视频前3秒吸引力,增加互动引导话术 |
| 账号体量<12 | 粉丝基数偏小 | 通过热点内容+Dou+投放加速涨粉,聚焦垂直领域深耕 |
| 账号体量<22 | 账号体量有提升空间 | 持续产出爆款内容扩大影响力,探索跨平台引流 |
| 运营活跃度<10 | 运营活跃度不足 | 制定内容排期表保持日更或高频更新,完善账号简介 |
| 运营活跃度<16 | 运营节奏可优化 | 聚焦黄金时段(11-13点/18-21点)发布,提升内容曝光概率 |
| 平台指数==0 | 平台指数数据缺失 | 持续稳定运营以积累平台指数,提升内容质量与互动率 |
| 平台指数<4 | 平台指数偏低 | 提升内容质量与互动率,保持稳定更新以提升红狐指数 |
| 以上均不满足(兜底) | 持续优化方向 | 深耕垂直内容建立差异化标签,开启直播增强粉丝粘性 |
---
5. 输出模板
使用说明: 严格按模板输出,不可省略章节。所有评分精确到1位小数。以下为「人民日报」真实诊断报告示例:
重要: 在诊断报告之前,必须先输出评分计算明细(纯文本格式,分值以实际数据为准):
**维度一:账号体量(35分)**
+ 粉丝数 201,242,077(≥5000万)→ 22分
+ 获赞总数 18,112,283,863(≥10亿)→ 8分
+ 获赞/粉丝比 ≈ 90.0(≥15)→ 5分
+ **小计:35分(满分)**
**维度二:内容表现(35分)**
+ 20条作品:总点赞5,457,017 / 总评论133,195 / 总分享937,749
+ 平均点赞 ≈ 272,851(10-50万)→ 9分
+ 平均评论 ≈ 6,660(5000-1万)→ 7分
+ 平均分享 ≈ 46,887(1-10万)→ 6分
+ 传播系数 ≈ 17.2%(≥15%)→ 6分
+ **小计:28分**
**维度三:运营活跃度(20分)**
+ 更新频率 20条(≥7条)→ 8分
+ 发布时段 14/20条为黄金时段 → 4分
+ 账号完整度 简介非空且>5字 → 4分
+ 作品总量 10,992(≥300)→ 4分
+ **小计:20分(满分)**
**维度四:平台指数(10分)**
+ 红狐指数 920.5(≥900)→ 10分
+ **小计:10分(满分)**
**综合评分:93.0分 — 🏆 S级 标杆账号**以下为正式诊断报告:
> 以下诊断结果是基于人民日报上周在抖音平台发布的作品进行分析得出。
## 📋 人民日报 - 抖音账号诊断报告
### 基本信息
| 昵称 | 抖音号 | 地域 | 粉丝数 | 获赞 | 作品数 | 红狐指数 | 数据时间 |
|------|--------|------|--------|------|--------|---------|----------|
| 人民日报 | rmrbxmt | 中国·北京·北京 | 2.0亿 | 181.1亿 | 10,992 | 920.5 | 2026-06-02 00:17:31 |
**简介:** 参与、沟通、记录时代。
---
### 📊 核心数据
**账号体量:**
- 粉丝数 2.0亿 | 获赞 181.1亿 | 获赞/粉丝比 90.0
**近7天作品(20条,展示最近7条):**
| # | 发布时间 | 标题 | 点赞 | 评论 | 分享 | 互动 | 传播系数 |
|---|---------|------|------|------|------|------|----------|
| 🥇 | 2026-06-03 21:57 | [盗狗嫌疑人落网!小狗等主人下班时…](https://www.douyin.com/video/7647167835424263478) | 10.1万 | 54 | 1.1万 | 11.5万 | 11.1% |
| 🥈 | 2026-06-03 21:12 | [抓捕现场,在逃人员突然逃窜…](https://www.douyin.com/video/7647156256674680105) | 26.2万 | 32 | 5191 | 27.5万 | 2.0% |
| 🥉 | 2026-06-03 21:02 | [什么是正确政绩观?](https://www.douyin.com/video/7647153886305832232) | 6821 | 119 | 214 | 7562 | 3.1% |
| 4 | 2026-06-03 20:59 | ["世界向东看"!100秒看大国外交](https://www.douyin.com/video/7647152982408203555) | 1.6万 | 137 | 728 | 1.8万 | 4.6% |
| 5 | 2026-06-03 20:01 | [女子网购填写假地址调包退货…](https://www.douyin.com/video/7647138018230291748) | 2.9万 | 128 | 2386 | 3.3万 | 8.1% |
| 6 | 2026-06-03 19:59 | [货车备胎掉落高速,路过司机搬离](https://www.douyin.com/video/7647137552830385427) | 7.7万 | 122 | 938 | 8.1万 | 1.2% |
| 7 | 2026-06-03 18:52 | [女子被困阳台向派出所"隔空喊话"](https://www.douyin.com/video/7647120288076827945) | 11.7万 | 61 | 1617 | 12.3万 | 1.4% |
> 若playCount非null,追加"播放量"和"点赞率"列
---
### 🏆 综合评分
**总分:94.0 / 100分** — 🏆 标杆账号 S级
| 维度 | 得分 | 满分 | 得分率 |
|------|------|------|--------|
| 账号体量 | 35.0 | 35分 | 100.0% |
| 内容表现 | 29.0 | 35分 | 82.9% |
| 运营活跃度 | 20.0 | 20分 | 100.0% |
| 平台指数 | 10.0 | 10分 | 100.0% |
| **综合** | **94.0** | **100分** | **94.0%** |
**💪 优势:**
+ 账号体量雄厚
+ 平台指数优秀
**⚠️ 短板:**
+ 整体表现均衡,持续优化即可
---
### 💡 优化建议
1. **平均点赞有提升空间** → 增加轻量化、情感化选题比例,提升单条作品爆款率,拉高平均点赞至50万+
2. **评论互动深度可强化** → 在热点新闻末尾增加互动引导话术(如"你怎么看?"),提升用户评论参与度
3. **持续优化方向** → 深耕垂直内容建立差异化标签,开启直播增强粉丝粘性
---
*诊断时间:2026-06-04 | 数据来源:红狐数据 API | 数据更新:2026-06-02 00:17:31*---
6. 账号分类映射
API返回的 accountClassifyFirst 字段需映射为输出新词:
| API原词 | 输出新词 | API原词 | 输出新词 |
|---|---|---|---|
| 全部 | 全部 | 美食 | 美食 |
| 才艺技能 | 个人才艺 | 美妆 | 化妆美容 |
| 生活 | 生活vlog | 萌宠 | 动物 |
| 财经 | 财富理财 | 母婴亲子 | 亲子 |
| 二次元 | 二次元 | 汽车 | 汽车 |
| 家居家装 | 居家装修 | 情感心理 | 情感 |
| 教育培训 | 学习教育 | 三农 | 三农 |
| 剧情演绎 | 小剧场 | 医疗健康 | 健康医学 |
| 科技数码 | 数码科技 | 时尚 | 潮流风尚 |
| 旅游 | 旅行 | 舞蹈 | 舞蹈才艺 |
| 颜值 | 颜值造型 | 人文社科 | 人文 |
| 音乐 | 音乐 | 影视综艺 | 影视 |
| 健身 | 身体锻炼 | 体育 | 体育 |
| 明星八卦 | 明星娱乐 | 游戏 | 游戏 |
---
7. Agent 行为规范(强制)
数据来源限制
- 🔒 所有账号信息和作品数据必须通过红狐API获取
- ❌ 严禁从其他渠道自主获取或估算数据
- ❌ playCount为null时不估算播放量,不计算点赞率/互动率等依赖播放量的指标
- ✅ 所有诊断分析必须基于API返回的真实数据
未查询到账号
- 输出收录引导文案:
未查询到当前账号的相关信息,可提交当前抖音账号进行账号收录。
1. 回复抖音号(在抖音个人主页显示的ID,如 1212_1234),即可进行账号收录。30分钟后将自动为您推送诊断报告~
2. 下次再说;
- 等待用户回复抖音号后,调用账号收录接口进行收录(见步骤3b)
- 严禁生成无依据报告
输出格式铁律
- 在诊断报告之前,必须先输出评分计算明细(纯文本格式,分值以实际数据为准)
- 在诊断报告最前面必须输出数据说明:
> 以下诊断结果是基于{账号昵称}上周在抖音平台发布的作品进行分析得出。 - 诊断报告必须严格按照第5节输出模板的章节顺序输出
- 章节顺序:数据说明 → 基本信息 → 核心数据 → 综合评分 → 优化建议
- 不输出账号头像
- 每个章节内部的格式必须与模板一致
- 所有评分精确到1位小数
- 禁止输出评分明细表格,仅保留四维度汇总表
输出禁止项
- 🚫 禁止输出各指标的评分明细表格
- 🚫 禁止从第三方渠道补充或估算API未返回的字段
- 🚫 禁止生成无依据的诊断报告
数字格式化规范
- ≥1亿:显示为
X.X亿 - ≥1万:显示为
X.X万 - <1万:显示为带千分位的整数,如
9,876
特殊场景处理
- works为空(近7天无作品):内容表现得0分,运营活跃度中更新频率和发布时段均为0分
- playCount为null:如实标注"API未返回",不估算
- redfoxIndex为null:平台指数维度得0分
- similarAccounts为空:不输出相似账号板块
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
抖音账号诊断 - API调用脚本
基于红狐API接口 /story/api/dyUser/query 查询抖音账号数据和作品数据
"""
import os
import json
from typing import List, Dict, Optional
class DouyinUserAPI:
"""抖音用户API调用类 - 红狐API /story/api/dyUser/query & /story/api/dyUser/syncUserNotes"""
# API基础地址
BASE_URL = "https://redfox.hk"
# 接口路径(已验证可用)
QUERY_ENDPOINT = "/story/api/dyUser/query"
SYNC_ENDPOINT = "/story/api/dyUser/syncUserNotes"
# 环境变量名
ENV_VAR = "REDFOX_API_KEY"
def __init__(self, api_key: Optional[str] = None):
"""
初始化API客户端
Args:
api_key: API密钥(X-API-KEY),格式 ak_xxx,不传则从环境变量读取
"""
self.api_key = api_key or os.environ.get(self.ENV_VAR, "")
self.headers = {
"Content-Type": "application/json",
"X-API-KEY": self.api_key
}
def query_accounts(
self,
account_ids: Optional[List[str]] = None,
account_names: Optional[List[str]] = None,
source: str = "抖音账号诊断宗师-GitHub"
) -> Dict:
"""
查询抖音账号信息
Args:
account_ids: 抖音号列表(unique_id、short_id、uid)
account_names: 抖音昵称列表(模糊匹配nickname)
source: 来源标识
Returns:
dict: {
"success": bool,
"data": list or None,
"error": str or None,
"fallback_needed": bool # 是否需要降级为联网搜索
}
"""
import requests
url = f"{self.BASE_URL}{self.QUERY_ENDPOINT}"
# 构建请求体
payload = {"source": source}
if account_ids:
payload["accountIds"] = account_ids
if account_names:
payload["accountNames"] = account_names
if not account_ids and not account_names:
return {
"success": False,
"data": None,
"error": "accountIds 和 accountNames 至少提供一个",
"fallback_needed": False
}
try:
response = requests.post(url, json=payload, headers=self.headers, timeout=30)
result = response.json()
code = result.get("code")
msg = result.get("msg", "")
data = result.get("data")
# 成功(红狐API成功码为200或2000,兼容新旧版本)
if code in (200, 2000):
accounts = data if isinstance(data, list) else ([data] if data else [])
return {
"success": True,
"data": accounts,
"error": None,
"fallback_needed": False
}
# 积分不足 / 调用次数达上限
if code == 3201 or (code == 500 and ("积分" in msg or "次数" in msg or "上限" in msg)):
return {
"success": False,
"data": None,
"error": f"API业务错误: {msg}",
"fallback_needed": True
}
# 其他业务错误
return {
"success": False,
"data": None,
"error": f"API错误(code={code}): {msg}",
"fallback_needed": True
}
except requests.exceptions.ConnectionError:
return {
"success": False,
"data": None,
"error": "连接失败,请检查网络",
"fallback_needed": True
}
except requests.exceptions.Timeout:
return {
"success": False,
"data": None,
"error": "请求超时",
"fallback_needed": True
}
except Exception as e:
return {
"success": False,
"data": None,
"error": f"查询失败: {e}",
"fallback_needed": True
}
def sync_account(
self,
account_id: str,
source: str = "抖音账号诊断宗师-GitHub"
) -> Dict:
"""
调用账号收录接口,将账号加入数据同步队列
Args:
account_id: 抖音账号ID(unique_id、short_id、uid)
source: 调用来源标识
Returns:
dict: {
"success": bool,
"message": str,
"error": str or None
}
"""
import requests
url = f"{self.BASE_URL}{self.SYNC_ENDPOINT}"
payload = {
"accountId": account_id,
"source": source
}
print(f"\U0001f517 正在提交账号收录: {account_id}")
try:
response = requests.post(url, json=payload, headers=self.headers, timeout=30)
result = response.json()
code = result.get("code")
msg = result.get("msg", "")
if code == 200:
print(f"\u2705 收录申请已成功提交,系统将异步拉取数据")
return {
"success": True,
"message": "收录申请已成功提交,约30分钟后可重新诊断",
"error": None
}
elif code == 400:
print(f"\u274c 参数错误: {msg}")
return {
"success": False,
"message": "",
"error": f"参数错误: {msg}"
}
elif code == 500:
print(f"\u274c 业务异常: {msg}")
return {
"success": False,
"message": "",
"error": f"业务异常: {msg}"
}
else:
print(f"\u274c 未知错误(code={code}): {msg}")
return {
"success": False,
"message": "",
"error": f"未知错误(code={code}): {msg}"
}
except requests.exceptions.ConnectionError:
return {
"success": False,
"message": "",
"error": "连接失败,请检查网络"
}
except requests.exceptions.Timeout:
return {
"success": False,
"message": "",
"error": "请求超时"
}
except Exception as e:
return {
"success": False,
"message": "",
"error": f"收录失败: {e}"
}
def diagnose_account(
self,
account_name: Optional[str] = None,
account_id: Optional[str] = None
) -> Dict:
"""
诊断单个抖音账号(查询+数据整合)
Args:
account_name: 抖音昵称
account_id: 抖音号
Returns:
dict: {
"success": bool,
"account": dict or None, # 账号基本信息
"works": list, # 近7天作品列表
"similar_accounts": list, # 相似账号列表
"error": str or None,
"fallback_needed": bool
}
"""
if not account_name and not account_id:
return {
"success": False,
"account": None,
"works": [],
"similar_accounts": [],
"error": "请提供抖音昵称或抖音号",
"fallback_needed": False
}
# 构建查询参数
account_ids = [account_id] if account_id else None
account_names = [account_name] if account_name else None
print(f"🔍 正在查询抖音账号: {account_name or account_id}")
# 查询账号信息
result = self.query_accounts(
account_ids=account_ids,
account_names=account_names
)
if not result["success"]:
print(f"❌ 查询失败: {result['error']}")
return {
"success": False,
"account": None,
"works": [],
"similar_accounts": [],
"error": result["error"],
"fallback_needed": result["fallback_needed"]
}
accounts = result["data"]
if not accounts:
print(f"❌ 未查询到抖音账号: {account_name or account_id}")
return {
"success": False,
"account": None,
"works": [],
"similar_accounts": [],
"error": "未查询到账号",
"fallback_needed": True
}
# 取第一个匹配结果
account_data = accounts[0]
# 提取数据
account_info = {
"nickname": account_data.get("nickname", ""),
"accountId": account_data.get("accountId", ""),
"uid": account_data.get("uid", ""),
"avatarUrl": account_data.get("avatarUrl", ""),
"signature": account_data.get("signature", ""),
"gender": account_data.get("gender", ""),
"age": account_data.get("age"),
"country": account_data.get("country", ""),
"province": account_data.get("province", ""),
"city": account_data.get("city", ""),
"ipLocation": account_data.get("ipLocation", ""),
"followerCount": account_data.get("followerCount", 0),
"awemeCount": account_data.get("awemeCount", 0),
"totalFavorited": account_data.get("totalFavorited", 0),
"redfoxIndex": account_data.get("redfoxIndex"),
"crawlTime": account_data.get("crawlTime", ""),
}
works = account_data.get("works", [])
similar_accounts = account_data.get("similarAccounts", [])
print(f"✅ 查询成功: {account_info['nickname']} (粉丝: {format_number(account_info['followerCount'])})")
print(f" 作品数: {account_info['awemeCount']} | 近7天作品: {len(works)} | 相似账号: {len(similar_accounts)}")
return {
"success": True,
"account": account_info,
"works": works,
"similar_accounts": similar_accounts,
"error": None,
"fallback_needed": False
}
def calculate_works_stats(self, works: List[Dict]) -> Dict:
"""
基于近7天作品数据计算v4.0统计指标
四维度:账号体量(35) + 内容表现(35) + 运营活跃度(20) + 平台指数(10)
不依赖playCount,使用diggCount/commentCount/shareCount
Args:
works: 作品列表(DyWorkVO格式)
Returns:
dict: 统计数据
"""
if not works:
return {
"avg_digg_count": 0,
"avg_comment_count": 0,
"avg_share_count": 0,
"spread_coefficient": 0, # 传播系数 = 分享/点赞
"update_frequency": 0, # 近7天发布数
"publish_periods": [], # 发布时段列表
}
total_digg = sum(w.get("diggCount", 0) or 0 for w in works)
total_comment = sum(w.get("commentCount", 0) or 0 for w in works)
total_share = sum(w.get("shareCount", 0) or 0 for w in works)
n = len(works)
avg_digg = total_digg / n
avg_comment = total_comment / n
avg_share = total_share / n
# 传播系数 = 分享数/点赞数
spread_coefficient = (total_share / total_digg * 100) if total_digg > 0 else 0
# 发布时段
publish_periods = []
for w in works:
create_time = w.get("createTime", "")
if create_time:
try:
hour = int(create_time.split(" ")[1].split(":")[0])
publish_periods.append(hour)
except (IndexError, ValueError):
pass
return {
"avg_digg_count": int(avg_digg),
"avg_comment_count": int(avg_comment),
"avg_share_count": int(avg_share),
"spread_coefficient": round(spread_coefficient, 2), # 百分比
"update_frequency": n,
"publish_periods": publish_periods,
}
def format_number(num) -> str:
"""格式化数字显示"""
if num is None:
return "-"
try:
num = int(num)
except (ValueError, TypeError):
return str(num)
if num >= 100000000:
return f"{num/100000000:.1f}亿"
elif num >= 10000:
return f"{num/10000:.1f}万"
else:
return f"{num:,}"
# 账号分类映射:API原词 → 输出新词
CATEGORY_MAP = {
"全部": "全部",
"才艺技能": "个人才艺",
"生活": "生活vlog",
"财经": "财富理财",
"二次元": "二次元",
"家居家装": "居家装修",
"教育培训": "学习教育",
"剧情演绎": "小剧场",
"科技数码": "数码科技",
"旅游": "旅行",
"美食": "美食",
"美妆": "化妆美容",
"萌宠": "动物",
"母婴亲子": "亲子",
"汽车": "汽车",
"情感心理": "情感",
"三农": "三农",
"医疗健康": "健康医学",
"时尚": "潮流风尚",
"舞蹈": "舞蹈才艺",
"颜值": "颜值造型",
"人文社科": "人文",
"音乐": "音乐",
"影视综艺": "影视",
"健身": "身体锻炼",
"体育": "体育",
"明星八卦": "明星娱乐",
"游戏": "游戏",
}
def map_category(raw_category: str) -> str:
"""将API原词分类映射为输出新词"""
return CATEGORY_MAP.get(raw_category, raw_category)
def print_account_summary(result: Dict):
"""打印账号数据摘要"""
account = result.get("account", {})
works = result.get("works", [])
similar = result.get("similar_accounts", [])
print("\n" + "=" * 60)
print(f"📋 账号数据摘要")
print("=" * 60)
print(f"账号昵称: {account.get('nickname', '-')}")
print(f"抖音号: {account.get('accountId', '-')}")
print(f"UID: {account.get('uid', '-')}")
print(f"账号简介: {account.get('signature', '-')}")
print(f"性别: {account.get('gender', '-')}")
print(f"年龄: {account.get('age', '-')}")
print(f"地域: {account.get('province', '')}{account.get('city', '')}")
print(f"IP属地: {account.get('ipLocation', '-')}")
print(f"粉丝数: {format_number(account.get('followerCount'))}")
print(f"获赞总数: {format_number(account.get('totalFavorited'))}")
print(f"作品总数: {account.get('awemeCount', '-')}")
print(f"数据更新: {account.get('crawlTime', '-')}")
# 作品数据
if works:
api = DouyinUserAPI()
stats = api.calculate_works_stats(works)
print(f"\n📊 近7天作品统计(共{len(works)}条):")
print(f" 平均点赞数: {format_number(stats['avg_digg_count'])}")
print(f" 平均评论数: {format_number(stats['avg_comment_count'])}")
print(f" 平均分享数: {format_number(stats['avg_share_count'])}")
print(f" 传播系数: {stats['spread_coefficient']}%")
print(f" 更新频率: {stats['update_frequency']}条/7天")
print(f"\n🎬 作品列表:")
sorted_works = sorted(works, key=lambda w: w.get("diggCount", 0) or 0, reverse=True)
for i, work in enumerate(sorted_works[:5], 1):
title = work.get('title', '无标题')[:30]
digg = format_number(work.get('diggCount'))
comment = format_number(work.get('commentCount'))
share = format_number(work.get('shareCount'))
print(f" {i}. {title} | 点赞:{digg} | 评论:{comment} | 分享:{share}")
# 相似账号
if similar:
print(f"\n👥 相似账号(共{len(similar)}个):")
for s in similar[:5]:
classify = CATEGORY_MAP.get(s.get('accountClassifyFirst', ''), s.get('accountClassifyFirst', '-'))
print(f" - {s.get('nickname', '-')} | 粉丝:{format_number(s.get('followerCount'))} | 分类:{classify} | 红狐指数:{s.get('redfoxIndex', '-')}")
# 使用示例
if __name__ == "__main__":
api = DouyinUserAPI()
if not api.api_key:
print(f"❌ 未设置环境变量 {DouyinUserAPI.ENV_VAR}")
print(f"💡 请先运行: export {DouyinUserAPI.ENV_VAR}=你的API密钥值")
exit(1)
print(f"✅ API Key已配置: {api.api_key[:8]}...")
# 示例1:通过名称查询
print("\n=== 示例1:通过名称查询 ===")
result = api.diagnose_account(account_name="疯狂小杨哥")
if result["success"]:
print_account_summary(result)
elif result["fallback_needed"]:
print(f"⚠️ API不可用,需降级为联网搜索: {result['error']}")
print("\n" + "=" * 60 + "\n")
# 示例2:通过抖音号查询
print("=== 示例2:通过抖音号查询 ===")
result = api.diagnose_account(account_id="yangge_520")
if result["success"]:
print_account_summary(result)
elif result["fallback_needed"]:
print(f"⚠️ API不可用,需降级为联网搜索: {result['error']}")
📋 人民日报 - 抖音账号诊断报告
基本信息
| 昵称 | 抖音号 | 地域 | 粉丝数 | 获赞 | 作品数 | 数据时间 |
|---|---|---|---|---|---|---|
| 人民日报 | rmrbxmt | 北京·北京 | 2.0亿 | 181.1亿 | 10,992 | 2026-06-02 00:17:31 |
简介: 参与、沟通、记录时代。
---
📊 核心数据
账号体量:
- 粉丝数 2.0亿 | 获赞 181.1亿 | 获赞/粉丝比 90.0
近7天作品(20条,展示最近7条):
| # | 发布时间 | 标题 | 点赞 | 评论 | 分享 | 互动 | 传播系数 |
|---|---|---|---|---|---|---|---|
| 1 | 2026-06-03 21:57 | 盗狗嫌疑人落网!小狗等主人下班时… | 10.1万 | 54 | 1.1万 | 11.5万 | 11.1% |
| 2 | 2026-06-03 21:12 | 抓捕现场,在逃人员突然逃窜… | 26.2万 | 32 | 5191 | 27.5万 | 2.0% |
| 3 | 2026-06-03 21:02 | 什么是正确政绩观? | 6821 | 119 | 214 | 7562 | 3.1% |
| 4 | 2026-06-03 20:59 | "世界向东看"!100秒看大国外交 | 1.6万 | 137 | 728 | 1.8万 | 4.6% |
| 5 | 2026-06-03 20:01 | 女子网购填写假地址调包退货… | 2.9万 | 128 | 2386 | 3.3万 | 8.1% |
| 6 | 2026-06-03 19:59 | 货车备胎掉落高速,路过司机搬离 | 7.7万 | 122 | 938 | 8.1万 | 1.2% |
| 7 | 2026-06-03 18:52 | 女子被困阳台向派出所"隔空喊话" | 11.7万 | 61 | 1617 | 12.3万 | 1.4% |
若playCount非null,追加"播放量"和"点赞率"列
---
🏆 综合评分
总分:93.0 / 100分 — 🏆 标杆账号 S级
| 维度 | 得分 | 满分 | 得分率 |
|---|---|---|---|
| 账号体量 | 40.0 | 40分 | 100.0% |
| 内容表现 | 33.0 | 40分 | 82.5% |
| 运营活跃度 | 20.0 | 20分 | 100.0% |
| 综合 | 93.0 | 100分 | 93.0% |
💪 优势: 账号体量雄厚(2亿粉丝满级);内容数据突出(传播系数17.2%极强自发传播) ⚠️ 短板: 整体表现均衡,持续优化即可
---
💡 优化建议
1. 平均点赞有提升空间 → 增加轻量化、情感化选题比例,提升单条作品爆款率,拉高平均点赞至50万+ 2. 评论互动深度可强化 → 在热点新闻末尾增加互动引导话术(如"你怎么看?"),提升用户评论参与度 3. 持续优化方向 → 深耕垂直内容建立差异化标签,开启直播增强粉丝粘性
---
诊断时间:2026-06-04 | 数据来源:红狐数据API | 数据更新:2026-06-02 00:17:31
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
抖音账号诊断报告生成器 v4.0
基于红狐API /story/api/dyUser/query 接口返回的数据生成标准诊断报告
四维度评估:账号体量(35分) + 内容表现(35分) + 运营活跃度(20分) + 平台指数(10分)
"""
import json
from datetime import datetime
from typing import Dict, List, Optional
# \u8d26\u53f7\u5206\u7c7b\u6620\u5c04: API\u539f\u8bcd \u2192 \u8f93\u51fa\u65b0\u8bcd
CATEGORY_MAP = {
"全部": "全部",
"才艺技能": "个人才艺",
"生活": "生活vlog",
"财经": "财富理财",
"二次元": "二次元",
"家居家装": "居家装修",
"教育培训": "学习教育",
"剧情演绎": "小剧场",
"科技数码": "数码科技",
"旅游": "旅行",
"美食": "美食",
"美妆": "化妆美容",
"萌宠": "动物",
"母婴亲子": "亲子",
"汽车": "汽车",
"情感心理": "情感",
"三农": "三农",
"医疗健康": "健康医学",
"时尚": "潮流风尚",
"舞蹈": "舞蹈才艺",
"颜值": "颜值造型",
"人文社科": "人文",
"音乐": "音乐",
"影视综艺": "影视",
"健身": "身体锻炼",
"体育": "体育",
"明星八卦": "明星娱乐",
"游戏": "游戏",
}
def map_category(raw: str) -> str:
"""将API原词分类映射为输出新词"""
return CATEGORY_MAP.get(raw, raw)
def format_number(num) -> str:
"""格式化数字显示"""
if num is None:
return "-"
try:
num = int(num)
except (ValueError, TypeError):
return str(num)
if num >= 100000000:
return f"{num / 100000000:.1f}亿"
elif num >= 10000:
return f"{num / 10000:.1f}万"
else:
return f"{num:,}"
class DouyinDiagnosisReportV3:
"""抖音账号诊断宗师报告生成器 v4.1 - 四维度评估体系
账号体量(35分) + 内容表现(35分) + 运营活跃度(20分) + 平台指数(10分)
"""
# 全角冒号常量,避免Python 3.12+源码全角标点SyntaxError
_C = "\uff1a"
def __init__(self, account_data: Dict):
"""
初始化报告生成器
Args:
account_data: 红狐API /story/api/dyUser/query 返回的账号数据(单条)
"""
self.data = account_data
self.works = account_data.get("works", [])
self.similar_accounts = account_data.get("similarAccounts", [])
# ==================== 主入口 ====================
def generate_report(self) -> str:
"""生成完整诊断报告,严格按固定模板输出"""
sections = [
self._section_scoring_breakdown(),
self._section_data_disclaimer(),
self._section_basic_info(),
self._section_core_data(),
self._section_comprehensive_score(),
self._section_optimization(),
self._section_footer(),
]
return "\n".join(sections)
# ==================== 章节0:评分计算明细 ====================
@staticmethod
def _fmt(num) -> str:
"""格式化数字显示,带千位分隔符"""
if num is None:
return "-"
try:
num = int(num)
except (ValueError, TypeError):
return str(num)
return f"{num:,}"
def _section_scoring_breakdown(self) -> str:
"""生成评分计算明细,在诊断报告之前输出"""
follower = self.data.get("followerCount", 0) or 0
favorited = self.data.get("totalFavorited", 0) or 0
ratio = favorited / follower if follower > 0 else 0
works = self.works
n = len(works)
aweme_count = self.data.get("awemeCount", 0) or 0
sig = self.data.get("signature", "") or ""
redfox_index = self.data.get("redfoxIndex")
# ---- 维度一:账号体量(35分) ----
follower_levels = [
(50000000, 22, "\u22655000\u4e07"), (10000000, 19, "1000-5000\u4e07"),
(5000000, 16, "500-1000\u4e07"), (1000000, 12, "100-500\u4e07"),
(500000, 9, "50-100\u4e07"), (100000, 5, "10-50\u4e07"),
(10000, 2, "1-10\u4e07"), (0, 0, "<1\u4e07"),
]
s1_f = 0; cond_f = ""
for th, sc, cond in follower_levels:
if follower >= th:
s1_f, cond_f = sc, cond; break
favorited_levels = [
(1000000000, 8, "\u226510\u4ebf"), (100000000, 6, "1-10\u4ebf"),
(10000000, 5, "1000\u4e07-1\u4ebf"), (1000000, 3, "100-1000\u4e07"),
(100000, 1, "10-100\u4e07"), (0, 0, "<10\u4e07"),
]
s2_fav = 0; cond_fav = ""
for th, sc, cond in favorited_levels:
if favorited >= th:
s2_fav, cond_fav = sc, cond; break
ratio_levels = [
(15, 5, "\u226515"), (10, 4, "10-15"),
(5, 3, "5-10"), (2, 2, "2-5"), (0, 1, "<2"),
]
s3_r = 0; cond_r = ""
for th, sc, cond in ratio_levels:
if ratio >= th:
s3_r, cond_r = sc, cond; break
body_sub = s1_f + s2_fav + s3_r
# ---- 维度二:内容表现(35分) ----
total_digg = sum(w.get("diggCount", 0) or 0 for w in works)
total_comment = sum(w.get("commentCount", 0) or 0 for w in works)
total_share = sum(w.get("shareCount", 0) or 0 for w in works)
avg_digg = total_digg / n if n > 0 else 0
avg_comment = total_comment / n if n > 0 else 0
avg_share = total_share / n if n > 0 else 0
spread_coeff = (total_share / total_digg * 100) if total_digg > 0 else 0
digg_levels = [
(1000000, 13, "\u2265100\u4e07"), (500000, 11, "50-100\u4e07"),
(100000, 9, "10-50\u4e07"), (10000, 7, "1-10\u4e07"),
(1000, 4, "1000-1\u4e07"), (100, 2, "100-1000"), (0, 0, "<100"),
]
s1_d = 0; cond_d = ""
for th, sc, cond in digg_levels:
if avg_digg >= th:
s1_d, cond_d = sc, cond; break
comment_levels = [
(10000, 9, "\u22651\u4e07"), (5000, 7, "5000-1\u4e07"),
(1000, 5, "1000-5000"), (100, 3, "100-1000"),
(10, 1, "10-100"), (0, 0, "<10"),
]
s2_c = 0; cond_c = ""
for th, sc, cond in comment_levels:
if avg_comment >= th:
s2_c, cond_c = sc, cond; break
share_levels = [
(100000, 7, "\u226510\u4e07"), (10000, 6, "1-10\u4e07"),
(1000, 4, "1000-1\u4e07"), (100, 2, "100-1000"),
(10, 1, "10-100"), (0, 0, "<10"),
]
s3_s = 0; cond_s = ""
for th, sc, cond in share_levels:
if avg_share >= th:
s3_s, cond_s = sc, cond; break
spread_levels = [
(15, 6, "\u226515%"), (10, 5, "10-15%"),
(5, 4, "5-10%"), (2, 2, "2-5%"), (0, 1, "<2%"),
]
s4_sp = 0; cond_sp = ""
for th, sc, cond in spread_levels:
if spread_coeff >= th:
s4_sp, cond_sp = sc, cond; break
content_sub = s1_d + s2_c + s3_s + s4_sp
# ---- 维度三:运营活跃度(20分) ----
freq_levels = [
(7, 8, "\u22657\u6761"), (4, 6, "4-6\u6761"),
(2, 4, "2-3\u6761"), (1, 2, "1\u6761"), (0, 0, "0\u6761"),
]
s1_fr = 0; cond_fr = ""
for th, sc, cond in freq_levels:
if n >= th:
s1_fr, cond_fr = sc, cond; break
# 发布时段
period_score, period_desc, golden_count = self._get_publish_period_detail()
s2_pp = period_score
# 账号完整度
if sig.strip() and len(sig.strip()) > 5:
s3_sig, sig_desc = 4, "\u7b80\u4ecb\u975e\u7a7a\u4e14>5\u5b57"
elif sig.strip():
s3_sig, sig_desc = 2, "\u7b80\u4ecb\u975e\u7a7a\u4f46\u22645\u5b57"
else:
s3_sig, sig_desc = 0, "\u7b80\u4ecb\u4e3a\u7a7a"
aweme_levels = [
(300, 4, "\u2265300"), (100, 3, "100-300"),
(30, 2, "30-100"), (10, 1, "10-30"), (0, 0, "<10"),
]
s4_aw = 0; cond_aw = ""
for th, sc, cond in aweme_levels:
if aweme_count >= th:
s4_aw, cond_aw = sc, cond; break
op_sub = s1_fr + s2_pp + s3_sig + s4_aw
# ---- 维度四:平台指数(10分) ----
if redfox_index is None:
s1_rx, cond_rx = 0, "\u672a\u8fd4\u56de"
else:
redfox_levels = [
(900, 10, "\u2265900"), (800, 8, "800-900"),
(700, 6, "700-800"), (600, 4, "600-700"),
(500, 2, "500-600"), (0, 0, "<500"),
]
s1_rx = 0; cond_rx = ""
for th, sc, cond in redfox_levels:
if redfox_index >= th:
s1_rx, cond_rx = sc, cond; break
platform_sub = s1_rx
total = body_sub + content_sub + op_sub + platform_sub
grade_icon, grade_name, grade_letter = self._get_grade(total)
# 构建输出文本
fmt = self._fmt
lines = []
lines.append(f"**维度一:账号体量(35分)**")
lines.append(f"+ 粉丝数 {fmt(follower)}({cond_f})→ {s1_f}分")
lines.append(f"+ 获赞总数 {fmt(favorited)}({cond_fav})→ {s2_fav}分")
lines.append(f"+ 获赞/粉丝比 ≈ {ratio:.1f}({cond_r})→ {s3_r}分")
if body_sub == 35:
lines.append(f"+ **小计:{body_sub}分(满分)**")
else:
lines.append(f"+ **小计:{body_sub}分**")
lines.append("")
lines.append(f"**维度二:内容表现(35分)**")
if n > 0:
lines.append(f"+ {n}条作品:总点赞{fmt(total_digg)} / 总评论{fmt(total_comment)} / 总分享{fmt(total_share)}")
lines.append(f"+ 平均点赞 ≈ {fmt(int(avg_digg))}({cond_d})→ {s1_d}分")
lines.append(f"+ 平均评论 ≈ {fmt(int(avg_comment))}({cond_c})→ {s2_c}分")
lines.append(f"+ 平均分享 ≈ {fmt(int(avg_share))}({cond_s})→ {s3_s}分")
lines.append(f"+ 传播系数 ≈ {spread_coeff:.1f}%({cond_sp})→ {s4_sp}分")
else:
lines.append("+ 近7天无作品数据")
lines.append(f"+ **小计:{content_sub}分**")
lines.append("")
lines.append(f"**维度三:运营活跃度(20分)**")
lines.append(f"+ 更新频率 {n}条({cond_fr})→ {s1_fr}分")
lines.append(f"+ 发布时段 {golden_count}/{n}条为黄金时段 → {s2_pp}分")
lines.append(f"+ 账号完整度 {sig_desc} → {s3_sig}分")
lines.append(f"+ 作品总量 {fmt(aweme_count)}({cond_aw})→ {s4_aw}分")
if op_sub == 20:
lines.append(f"+ **小计:{op_sub}分(满分)**")
else:
lines.append(f"+ **小计:{op_sub}分**")
lines.append("")
lines.append(f"**维度四:平台指数(10分)**")
if redfox_index is not None:
lines.append(f"+ 红狐指数 {redfox_index:.1f}({cond_rx})→ {s1_rx}分")
else:
lines.append(f"+ 红狐指数 未返回 → 0分")
if platform_sub == 10:
lines.append(f"+ **小计:{platform_sub}分(满分)**")
else:
lines.append(f"+ **小计:{platform_sub}分**")
lines.append("")
lines.append(f"**综合评分:{total:.1f}分 — {grade_icon} {grade_letter} {grade_name}**")
return "\n".join(lines) + "\n"
def _get_publish_period_detail(self):
"""获取发布时段评分详情
Returns: (score, desc, golden_count)"""
if not self.works:
return 0, "\u65e0\u4f5c\u54c1\u53ef\u5224\u65ad", 0
hours = []
for w in self.works:
ct = w.get("createTime", "")
if ct:
try:
hour = int(ct.split(" ")[1].split(":")[0])
hours.append(hour)
except (IndexError, ValueError):
pass
if not hours:
return 0, "\u65e0\u4f5c\u54c1\u53ef\u5224\u65ad", 0
n = len(hours)
golden = sum(1 for h in hours if (11 <= h <= 13) or (18 <= h <= 21))
suboptimal = sum(1 for h in hours if (7 <= h <= 9) or (21 <= h <= 23))
if golden >= n / 2:
return 4, "\u9ec4\u91d1\u65f6\u6bb5(11-13/18-21)", golden
elif golden + suboptimal >= n / 2:
return 3, "\u6b21\u4f18\u65f6\u6bb5(7-9/21-23)", golden
else:
return 1, "\u5176\u4ed6\u65f6\u6bb5", golden
# ==================== 章节0b:数据说明 ====================
def _section_data_disclaimer(self) -> str:
nickname = self.data.get("nickname", "未知")
return f"> 以下诊断结果是基于{nickname}上周在抖音平台发布的作品进行分析得出。\n\n"
# ==================== 章节1:基本信息 ====================
def _section_basic_info(self) -> str:
nickname = self.data.get("nickname", "未知")
account_id = self.data.get("accountId", "-")
country = self.data.get("country", "")
province = self.data.get("province", "")
city = self.data.get("city", "")
location_parts = [p for p in [country, province, city] if p]
location = "·".join(location_parts) if location_parts else "-"
follower_count = format_number(self.data.get("followerCount", 0))
total_favorited = format_number(self.data.get("totalFavorited", 0))
aweme_count = self.data.get("awemeCount", 0)
redfox_index = self.data.get("redfoxIndex")
redfox_display = f"{redfox_index:.1f}" if redfox_index is not None else "-"
crawl_time = self.data.get("crawlTime", "-")
signature = self.data.get("signature", "")
sig_display = signature if signature and signature.strip() else "未设置"
c = self._C
return f"""## 📋 {nickname} - 抖音账号诊断报告
### 基本信息
| 昵称 | 抖音号 | 地域 | 粉丝数 | 获赞 | 作品数 | 红狐指数 | 数据时间 |
|------|--------|------|--------|------|--------|---------|----------|
| {nickname} | {account_id} | {location} | {follower_count} | {total_favorited} | {aweme_count} | {redfox_display} | {crawl_time} |
**简介{c}** {sig_display}
---"""
# ==================== 章节2:核心数据 ====================
def _section_core_data(self) -> str:
follower_count = self.data.get("followerCount", 0)
total_favorited = self.data.get("totalFavorited", 0)
ratio = (total_favorited / follower_count) if follower_count > 0 else 0
# 账号体量数据
c = self._C
body = (
f"### \U0001f4ca \u6838\u5fc3\u6570\u636e\n\n"
f"**\u8d26\u53f7\u4f53\u91cf{c}**\n"
f"- \u7c89\u4e1d\u6570 {format_number(follower_count)} | \u83b7\u8d5e {format_number(total_favorited)} | \u83b7\u8d5e/\u7c89\u4e1d\u6bd4 {ratio:.1f}\n\n"
f"**\u8fd17\u5929\u4f5c\u54c1({len(self.works)}\u6761){c}**"
)
if not self.works:
body += "> 近7天无作品数据\n"
else:
# 作品表格
header = "| # | 发布时间 | 标题 | 点赞 | 评论 | 分享 | 互动 | 传播系数 |"
sep = "|---|---------|------|------|------|------|------|---------|"
rows = []
for i, w in enumerate(self.works, 1):
title = (w.get("title") or w.get("desc") or "\u65e0\u6807\u9898")[:20]
create_time = w.get("createTime", "-")
if create_time and len(create_time) > 16:
create_time = create_time[:16]
digg = format_number(w.get("diggCount", 0))
comment = format_number(w.get("commentCount", 0))
share = format_number(w.get("shareCount", 0))
interactive = format_number(w.get("interactiveCount", 0))
digg_count = w.get("diggCount", 0) or 0
share_count = w.get("shareCount", 0) or 0
spread = f"{share_count / digg_count * 100:.1f}%" if digg_count > 0 else "-"
# \u524d3\u540d\u7528\u5956\u724c emoji\uff0c\u5176\u4f59\u7528\u6570\u5b57
medal = {1: "\U0001f947", 2: "\U0001f948", 3: "\U0001f949"}
rank_display = medal.get(i, str(i))
rows.append(f"| {rank_display} | {create_time} | {title} | {digg} | {comment} | {share} | {interactive} | {spread} |")
body += header + "\n" + sep + "\n" + "\n".join(rows) + "\n"
# playCount非null时追加说明
has_play = any(w.get("playCount") is not None for w in self.works)
if has_play:
body += '\n> playCount有值时,可追加"播放量"和"点赞率"列'
return body + "\n---"
# ==================== 章节3:综合评分 ====================
def _section_comprehensive_score(self) -> str:
# 计算四维度得分
body_score, _ = self._score_body()
content_score, _ = self._score_content()
operation_score, _ = self._score_operation()
platform_score, _ = self._score_platform()
total = body_score + content_score + operation_score + platform_score
# 评级
grade_icon, grade_name, grade_letter = self._get_grade(total)
# 得分率
body_rate = f"{body_score / 35 * 100:.1f}%"
content_rate = f"{content_score / 35 * 100:.1f}%"
op_rate = f"{operation_score / 20 * 100:.1f}%"
platform_rate = f"{platform_score / 10 * 100:.1f}%" if platform_score > 0 else "0.0%"
total_rate = f"{total:.1f}%"
c = self._C
# 优势/短板(列表格式)
advantages = self._get_advantages(body_score, content_score, operation_score, platform_score)
weaknesses = self._get_weaknesses(body_score, content_score, operation_score, platform_score)
adv_lines = "\n".join(f"+ {a}" for a in advantages)
weak_lines = "\n".join(f"+ {w}" for w in weaknesses)
return f"""### 🏆 综合评分
**总分{c}{total:.1f} / 100分** — {grade_icon} {grade_name} {grade_letter}
| 维度 | 得分 | 满分 | 得分率 |
|------|------|------|--------|
| 账号体量 | {body_score:.1f} | 35分 | {body_rate} |
| 内容表现 | {content_score:.1f} | 35分 | {content_rate} |
| 运营活跃度 | {operation_score:.1f} | 20分 | {op_rate} |
| 平台指数 | {platform_score:.1f} | 10分 | {platform_rate} |
| **综合** | **{total:.1f}** | **100分** | **{total_rate}** |
**💪 优势{c}**
{adv_lines}
**⚠️ 短板{c}**
{weak_lines}
---"""
# ==================== 章节4:优化建议 ====================
def _section_optimization(self) -> str:
suggestions = self._generate_suggestions()
items = []
for i, (problem, advice) in enumerate(suggestions[:3], 1):
items.append(f"{i}. **{problem}** → {advice}")
return "### 💡 优化建议\n\n" + "\n".join(items) + "\n\n---"
# ==================== 页脚 ====================
def _section_footer(self) -> str:
today = datetime.now().strftime("%Y-%m-%d")
crawl_time = self.data.get("crawlTime", "-")
return f"\n*诊断时间:{today} | 数据来源:红狐API `/story/api/dyUser/query` | 数据更新:{crawl_time}*"
# ==================== 维度一:账号体量(40分) ====================
def _score_body(self):
"""账号体量 = 粉丝数(22) + 获赞总数(8) + 获赞/粉丝比(5)
Returns: (score, details_list)"""
follower = self.data.get("followerCount", 0) or 0
favorited = self.data.get("totalFavorited", 0) or 0
ratio = favorited / follower if follower > 0 else 0
details = []
# 粉丝数(22分)
follower_levels = [
(50000000, 22, "超头部"), (10000000, 19, "头部"),
(5000000, 16, "准头部"), (1000000, 12, "中腰部"),
(500000, 9, "中小"), (100000, 5, "小型"),
(10000, 2, "微型"), (0, 0, "新号"),
]
s1, level = 0, ""
for threshold, score, label in follower_levels:
if follower >= threshold:
s1, level = score, label
break
details.append(f"粉丝数 {format_number(follower)} → {s1}/22分({level})")
# 获赞总数(8分)
favorited_levels = [
(1000000000, 8), (100000000, 6), (10000000, 5),
(1000000, 3), (100000, 1), (0, 0),
]
s2 = 0
for threshold, score in favorited_levels:
if favorited >= threshold:
s2 = score
break
details.append(f"获赞总数 {format_number(favorited)} → {s2}/8分")
# 获赞/粉丝比(5分)
ratio_levels = [
(15, 5, "粉丝质量极高"), (10, 4, "粉丝质量高"),
(5, 3, "正常"), (2, 2, "偏低"), (0, 1, "极低"),
]
s3, ratio_desc = 0, ""
for threshold, score, desc in ratio_levels:
if ratio >= threshold:
s3, ratio_desc = score, desc
break
details.append(f"获赞/粉丝比 {ratio:.1f} → {s3}/5分({ratio_desc})")
return s1 + s2 + s3, details
# ==================== 维度二:内容表现(40分) ====================
def _score_content(self):
"""内容表现 = 平均点赞(13) + 平均评论(9) + 平均分享(7) + 传播系数(6)
若近7天无作品,得0分
Returns: (score, details_list)"""
if not self.works:
return 0, ["近7天无作品,内容表现得0分"]
n = len(self.works)
total_digg = sum(w.get("diggCount", 0) or 0 for w in self.works)
total_comment = sum(w.get("commentCount", 0) or 0 for w in self.works)
total_share = sum(w.get("shareCount", 0) or 0 for w in self.works)
avg_digg = total_digg / n
avg_comment = total_comment / n
avg_share = total_share / n
spread_coeff = (total_share / total_digg * 100) if total_digg > 0 else 0
details = []
# 平均点赞数(13分)
digg_levels = [
(1000000, 13, "现象级"), (500000, 11, "超爆款"),
(100000, 9, "爆款"), (10000, 7, "优秀"),
(1000, 4, "中等"), (100, 2, "偏低"), (0, 0, "较低"),
]
s1, digg_label = 0, ""
for threshold, score, label in digg_levels:
if avg_digg >= threshold:
s1, digg_label = score, label
break
details.append(f"平均点赞数 {format_number(int(avg_digg))} → {s1}/13分({digg_label})")
# 平均评论数(9分)
comment_levels = [
(10000, 9), (5000, 7), (1000, 5), (100, 3), (10, 1), (0, 0),
]
s2 = 0
for threshold, score in comment_levels:
if avg_comment >= threshold:
s2 = score
break
details.append(f"平均评论数 {format_number(int(avg_comment))} → {s2}/9分")
# 平均分享数(7分)
share_levels = [
(100000, 7), (10000, 6), (1000, 4), (100, 2), (10, 1), (0, 0),
]
s3 = 0
for threshold, score in share_levels:
if avg_share >= threshold:
s3 = score
break
details.append(f"平均分享数 {format_number(int(avg_share))} → {s3}/7分")
# 传播系数(6分)
spread_levels = [
(15, 6, "极强自发传播"), (10, 5, "强传播力"),
(5, 4, "良好"), (2, 2, "中等"), (0, 1, "偏弱"),
]
s4, spread_desc = 0, ""
for threshold, score, desc in spread_levels:
if spread_coeff >= threshold:
s4, spread_desc = score, desc
break
details.append(f"传播系数 {spread_coeff:.1f}% → {s4}/6分({spread_desc})")
return s1 + s2 + s3 + s4, details
# ==================== 维度三:运营活跃度(20分) ====================
def _score_operation(self):
"""运营活跃度 = 更新频率(8) + 发布时段(4) + 账号完整度(4) + 作品总量(4)
Returns: (score, details_list)"""
details = []
# 更新频率(8分)
work_count = len(self.works)
freq_levels = [
(7, 8, "日更"), (4, 6, "高频"),
(2, 4, "中频"), (1, 2, "低频"), (0, 0, "停更"),
]
s1, freq_desc = 0, ""
for threshold, score, desc in freq_levels:
if work_count >= threshold:
s1, freq_desc = score, desc
break
details.append(f"更新频率 {work_count}条/7天 → {s1}/8分({freq_desc})")
# 发布时段(4分)
s2, period_desc = self._score_publish_period()
details.append(f"发布时段 {period_desc} → {s2}/4分")
# 账号完整度(4分)
sig = self.data.get("signature", "") or ""
if sig.strip() and len(sig.strip()) > 5:
s3, comp_desc = 4, "简介完整(>5字)"
elif sig.strip():
s3, comp_desc = 2, "简介较短(<=5字)"
else:
s3, comp_desc = 0, "无简介"
details.append(f"账号完整度 {comp_desc} → {s3}/4分")
# 作品总量(4分)
aweme_count = self.data.get("awemeCount", 0) or 0
aweme_levels = [
(300, 4), (100, 3), (30, 2), (10, 1), (0, 0),
]
s4 = 0
for threshold, score in aweme_levels:
if aweme_count >= threshold:
s4 = score
break
details.append(f"作品总量 {aweme_count} → {s4}/4分")
return s1 + s2 + s3 + s4, details
def _score_publish_period(self):
"""发布时段评分:黄金时段11-13/18-21得4分,次优7-9/21-23得3分
Returns: (score, period_desc)"""
if not self.works:
return 0, "无作品可判断"
hours = []
for w in self.works:
ct = w.get("createTime", "")
if ct:
try:
hour = int(ct.split(" ")[1].split(":")[0])
hours.append(hour)
except (IndexError, ValueError):
pass
if not hours:
return 0, "无作品可判断"
# 取多数时段
golden = sum(1 for h in hours if (11 <= h <= 13) or (18 <= h <= 21))
suboptimal = sum(1 for h in hours if (7 <= h <= 9) or (21 <= h <= 23))
if golden >= len(hours) / 2:
return 4, "黄金时段(11-13/18-21)"
elif golden + suboptimal >= len(hours) / 2:
return 3, "次优时段(7-9/21-23)"
else:
return 1, "其他时段"
# ==================== 维度四:平台指数(10分) ====================
def _score_platform(self):
"""平台指数 = 红狐指数(10)
若API未返回redfoxIndex(值为null),得0分
Returns: (score, details_list)"""
redfox_index = self.data.get("redfoxIndex")
if redfox_index is None:
return 0, ["红狐指数 API未返回 → 0/10分"]
# 红狐指数(10分)
redfox_levels = [
(900, 10, "顶级影响力"), (800, 8, "头部影响力"),
(700, 6, "中上影响力"), (600, 4, "中等影响力"),
(500, 2, "初级影响力"), (0, 0, "待提升"),
]
s1, level = 0, ""
for threshold, score, label in redfox_levels:
if redfox_index >= threshold:
s1, level = score, label
break
return s1, [f"红狐指数 {redfox_index:.1f} → {s1}/10分({level})"]
# ==================== 辅助方法 ====================
def _get_grade(self, score: float) -> tuple:
"""评级:S/A/B/C/D/E"""
if score >= 90:
return ("🏆", "标杆账号", "S级")
elif score >= 80:
return ("⭐", "优质账号", "A级")
elif score >= 70:
return ("✅", "健康账号", "B级")
elif score >= 60:
return ("📊", "中等账号", "C级")
elif score >= 50:
return ("⚠️", "亚健康", "D级")
else:
return ("❌", "问题账号", "E级")
def _get_advantages(self, body: float, content: float, operation: float, platform: float) -> list:
"""获取1-2个核心优势"""
items = []
if body >= 28:
items.append("账号体量雄厚")
elif body >= 18:
items.append("粉丝基础扎实")
if content >= 28:
items.append("内容数据突出")
elif content >= 18:
items.append("内容表现良好")
if operation >= 16:
items.append("运营节奏健康")
if platform >= 8:
items.append("平台指数优秀")
elif platform >= 4:
items.append("平台影响力良好")
if not items:
items.append("有基础运营框架")
return items[:2]
def _get_weaknesses(self, body: float, content: float, operation: float, platform: float) -> list:
"""获取1-2个核心短板"""
items = []
if body < 12:
items.append("账号体量偏小")
if content < 10:
items.append("近期内容表现较弱")
elif content == 0:
items.append("近7天无作品数据")
if operation < 8:
items.append("运营活跃度不足")
if platform == 0:
items.append("无平台指数数据")
if not items:
items.append("整体表现均衡,持续优化即可")
return items[:2]
def _generate_suggestions(self) -> List[tuple]:
"""基于评分数据生成3条优化建议"""
suggestions = []
body, _ = self._score_body()
content, _ = self._score_content()
operation, _ = self._score_operation()
platform, _ = self._score_platform()
# 按短板优先排序
if content == 0:
suggestions.append(("近7天无作品更新", "恢复稳定发布节奏,建议至少周更2-3条"))
elif content < 12:
suggestions.append(("内容互动数据偏低", "优化视频前3秒吸引力,增加互动引导话术"))
if body < 12:
suggestions.append(("粉丝基数偏小", "通过热点内容+Dou+投放加速涨粉,聚焦垂直领域深耕"))
elif body < 22:
suggestions.append(("账号体量有提升空间", "持续产出爆款内容扩大影响力,探索跨平台引流"))
if operation < 10:
suggestions.append(("运营活跃度不足", "制定内容排期表保持日更或高频更新,完善账号简介"))
elif operation < 16:
suggestions.append(("运营节奏可优化", "聚焦黄金时段(11-13点/18-21点)发布,提升内容曝光概率"))
if platform == 0:
suggestions.append(("平台指数数据缺失", "持续稳定运营以积累平台指数,提升内容质量与互动率"))
elif platform < 4:
suggestions.append(("平台指数偏低", "提升内容质量与互动率,保持稳定更新以提升红狐指数"))
# 至少3条
if len(suggestions) < 3:
suggestions.append(("持续优化方向", "深耕垂直内容建立差异化标签,开启直播增强粉丝粘性"))
return suggestions[:3]
# ==================== 使用示例 ====================
if __name__ == "__main__":
# 模拟范丞丞的API返回数据
sample_data = {
"nickname": "范丞丞",
"avatarUrl": "https://example.com/avatar.jpg",
"accountId": "CCHardErThAnEVER",
"uid": "84676974127",
"signature": "",
"gender": "未知",
"age": 25,
"country": "中国",
"province": "浙江",
"city": "金华",
"ipLocation": "浙江",
"followerCount": 20366567,
"awemeCount": 236,
"totalFavorited": 390844290,
"crawlTime": "2026-06-02 01:57:18",
"redfoxIndex": 780.5,
"works": [
{
"awemeId": "7481xxx1",
"title": "新作品来了",
"coverUrl": "https://example.com/cover1.jpg",
"desc": "",
"createTime": "2026-05-28 19:30:00",
"diggCount": 2165213,
"commentCount": 38286,
"shareCount": 260216,
"playCount": None,
"interactiveCount": 2443715,
"workUrl": "https://www.douyin.com/video/7481xxx1"
},
{
"awemeId": "7481xxx2",
"title": "日常分享",
"coverUrl": "https://example.com/cover2.jpg",
"desc": "",
"createTime": "2026-05-26 12:15:00",
"diggCount": 1222713,
"commentCount": 33662,
"shareCount": 87111,
"playCount": None,
"interactiveCount": 1343486,
"workUrl": "https://www.douyin.com/video/7481xxx2"
}
],
"similarAccounts": []
}
generator = DouyinDiagnosisReportV3(sample_data)
report = generator.generate_report()
print(report)
with open("douyin_diagnosis_report_v3.md", "w", encoding="utf-8") as f:
f.write(report)
print("\n✅ 报告已保存到 douyin_diagnosis_report_v3.md")