Skip to main content
Glama
kk520879

undoom-douyin-data-analysis

by kk520879

抖音数据分析 MCP 服务器

PyPI version Python 3.13+

基于原始抖音数据分析工具开发的 MCP (Model Context Protocol) 服务器,提供抖音视频和用户数据的采集、分析和导出功能。

🎉 现已发布到 PyPI,可直接安装使用!

功能特性

数据采集

  • 视频搜索: 根据关键词搜索抖音视频,采集标题、作者、点赞数、评论数等信息

  • 用户搜索: 根据关键词搜索抖音用户,采集用户名、抖音号、粉丝数、获赞数等信息

  • 自定义参数: 支持设置滚动次数和延迟时间,控制采集规模和速度

数据分析

  • 互动数据分析: 分析视频的点赞、评论、分享等互动数据,提供统计报告

  • 内容长度分析: 分析视频标题长度分布,了解内容特征

  • 关键词分析: 使用中文分词技术分析高频词汇,发现热门话题

数据导出

  • 多格式支持: 支持 JSON、Excel、CSV 格式导出

  • 分类导出: 可选择导出视频数据、用户数据或全部数据

  • 时间戳: 自动添加时间戳,避免文件覆盖

Related MCP server: Douyin API New MCP Server

安装和配置

方式一:从 PyPI 安装(推荐)

  1. 直接安装:

    pip install undoom-douyin-data-analysis
  2. 配置 MCP 客户端: 在你的 MCP 客户端配置文件中添加以下配置:

    {
      "mcpServers": {
        "undoom-douyin-data-analysis": {
          "command": "uvx",
          "args": [
            "--index-url",
            "https://pypi.tuna.tsinghua.edu.cn/simple",
            "--from",
            "undoom-douyin-data-analysis",
            "undoom-douyin-mcp"
          ]
        }
      }
    }

方式二:本地开发安装

  1. 克隆仓库:

    git clone <repository-url>
    cd undoom_Douyin_data_analysis
  2. 安装依赖:

    uv sync
  3. 本地运行:

    uv run undoom-douyin-mcp

环境要求

  • Python 3.13+

  • Chrome/Chromium 浏览器

  • 网络连接(访问抖音)

可用工具

1. search_douyin_videos

搜索抖音视频数据

参数:

  • keyword (必需): 搜索关键词

  • scroll_count (可选): 滚动次数,默认为10

  • delay (可选): 每次滚动的延迟时间(秒),默认为2.0

2. search_douyin_users

搜索抖音用户数据

3. analyze_interaction_data

分析视频互动数据(点赞、评论等)

4. analyze_content_length

分析视频标题长度分布

5. analyze_keywords

分析视频标题中的高频词汇

6. export_data

导出采集的数据

7. get_data_summary

获取当前采集数据的摘要信息

8. clear_data

清空当前采集的数据

可用资源

1. douyin://data/videos

当前采集的视频数据(JSON 格式)

2. douyin://data/users

当前采集的用户数据(JSON 格式)

3. douyin://analysis/summary

数据采集和分析摘要(文本格式)

使用示例

基本工作流程

  1. 搜索视频数据: 使用 search_douyin_videos 工具搜索关键词

  2. 分析数据: 使用 analyze_interaction_data 分析互动数据 使用 analyze_keywords 分析高频词汇

  3. 导出结果: 使用 export_data 导出为指定格式

项目信息

注意事项

  1. 网络环境: 需要能够访问抖音网站

  2. 浏览器依赖: 使用 DrissionPage 需要 Chrome/Chromium 浏览器

  3. 采集频率: 建议设置适当的延迟时间,避免过于频繁的请求

  4. 合规使用: 请遵守抖音的使用条款和相关法律法规

  5. 数据使用: 采集的数据仅供学习和研究使用,请勿用于商业用途

技术架构

  • MCP 协议: 基于 Model Context Protocol 实现

  • 异步处理: 使用 asyncio 进行异步操作

  • 数据解析: 使用 BeautifulSoup 解析 HTML

  • 中文分词: 使用 jieba 进行中文文本分析

  • 数据处理: 使用 pandas 进行数据操作和导出

Available Tools

8 tools
analyze_content_lengthC

分析视频标题长度分布

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

C2.9/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description is extremely minimal. It does not disclose any behavioral traits, such as what data the tool operates on, side effects, or whether it requires prior data ingestion. For a tool with no annotations, the description fails to compensate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no unnecessary words. It is appropriately front-loaded and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no parameters, no annotations, and no output schema, the description is too minimal to provide complete context. It does not explain what data is used, how results are presented, or when the tool should be invoked, leaving significant gaps for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has no parameters, and the schema coverage is 100%. With zero parameters, the baseline score is 4. The description adds meaning by specifying the analytical focus (title length distribution), which goes beyond the empty schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool analyzes the distribution of video title lengths. It uses a specific verb+resource combination, distinguishing it from other analysis tools that focus on different aspects. However, it does not explicitly differentiate from siblings like analyze_keywords or analyze_interaction_data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool versus alternatives. The description provides no context about prerequisites, data requirements, or scenarios where this tool is preferred over similar tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

analyze_interaction_dataB

分析视频互动数据(点赞、评论等)

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description must disclose behavioral traits. It only states the general purpose and examples, omitting details like whether it is read-only, what data it operates on, or any side effects. This is insufficient for a tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that immediately communicates the tool's purpose. Every word is necessary and nothing is superfluous.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a parameterless tool, the description is minimally adequate: it explains what the tool does. However, it does not specify the output format, scope, or how it relates to sibling tools like get_data_summary. Given the simplicity, a score of 3 is appropriate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so the baseline is 4. The description does not add parameter-specific meanings, but the lack of parameters makes this less critical.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool analyzes video interaction data, using a specific verb ('analyze') and resource ('interaction data'). It lists examples (likes, comments) but does not differentiate from sibling tools like get_data_summary or analyze_keywords.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives such as analyze_content_length or search_douyin_videos. The description provides no context about prerequisites or intended scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

analyze_keywordsC

分析视频标题中的高频词汇

ParametersJSON Schema
NameRequiredDescriptionDefault
top_nNo返回前N个高频词汇,默认为50

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description fails to disclose what the tool returns (e.g., list of words with frequencies), side effects, or prerequisites. It only states the basic operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence (6 words in Chinese) that directly states the function. It could be structured with sections, but it's efficient and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Missing context: no output schema, no explanation of input source (presumably video titles from previous searches), and no description of return format. The description is insufficient for a tool that likely generates a list of keywords.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with a single parameter described clearly in the schema. The tool description adds no additional semantics beyond what's in the schema, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool analyzes high-frequency words in video titles, distinguishing it from sibling tools that analyze content length or interaction data. However, it doesn't specify which video titles are analyzed (e.g., from a search context), which is a minor gap.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like search_douyin_videos or analyze_content_length. The description lacks context for decision-making.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

clear_dataB

清空当前采集的数据

ParametersJSON Schema
NameRequiredDescriptionDefault
data_typeNo要清空的数据类型all

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must fully disclose behavioral traits. It does not mention that the action is irreversible, the scope of 'collected data', or potential side effects. This is insufficient for a destructive tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single short phrase, front-loaded with the core action. Every word is necessary and there is no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with one parameter, the description is minimal but adequate to understand the primary function. However, it lacks safety-related context that would be expected for a data deletion tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, and the parameter description in the schema already explains the 'data_type' field. The tool description adds no additional semantics beyond what the schema provides, meeting the baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '清空当前采集的数据' clearly states the verb (clear) and resource (currently collected data). It is specific and distinguishes from sibling tools, which are analysis and export tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. Given it is a destructive action, explicit when-to-use or prerequisites would be helpful.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

export_dataC

导出采集的数据

ParametersJSON Schema
NameRequiredDescriptionDefault
formatNo导出格式json
data_typeNo导出数据类型videos
filenameNo文件名(不包含扩展名)douyin_data

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description must disclose behavioral traits. It only states 'export collected data' without clarifying whether the operation is destructive, requires authentication, or has any side effects. The agent is left to assume it's a safe read-export, but this is not explicit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise (one short phrase), with no unnecessary words. However, it is so brief that it may omit essential context, such as export format options or behavioral notes. It earns a high conciseness score but loses a point for not providing enough substantive content in its structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description lacks contextual completeness for a data export tool with three parameters and no output schema. It does not explain what happens after export (e.g., file download, storage location) or how the output is delivered. It also does not reference related tools like clear_data for post-export cleanup. The agent may not understand the full workflow.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema covers all three parameters with descriptions and defaults (format, data_type, filename). Since schema coverage is 100%, the description does not need to add parameter details. It adds no extra semantic context beyond what the schema provides, so a baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'export' and the resource 'collected data', but it lacks specificity about what types of data (videos, users) and formats, and does not differentiate from siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus its siblings (e.g., when to export vs analyze or search). It does not specify prerequisites or alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_data_summaryA

获取当前采集数据的摘要信息

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description does not disclose behavioral traits such as read-only nature, side effects, or prerequisites. For a tool with no parameters, it offers minimal transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence with no wasted words. It is appropriately front-loaded and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity (no parameters, no output schema, no annotations), the description is adequate but could be more informative about what the summary includes (e.g., metrics, time range).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are no parameters, so schema coverage is 100%. The description does not need to add parameter info, achieving the baseline of 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves summary information of currently collected data. It uses specific verb and resource, and distinguishes from sibling tools that perform specific analyses or actions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use for getting an overview of collected data but lacks explicit guidance on when to use or alternatives. Context from sibling tools suggests differentiation but is not stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_douyin_usersC

搜索抖音用户数据

ParametersJSON Schema
NameRequiredDescriptionDefault
keywordYes搜索关键词
scroll_countNo滚动次数,默认为10
delayNo每次滚动的延迟时间(秒),默认为2

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description does not disclose behavioral traits such as pagination, rate limits, or real-time nature. The only information is the basic search action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, short sentence with no filler. It is concise, though it could be expanded to include more useful information without losing brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has no output schema, and the description does not explain what the search returns (e.g., list of users, pagination details). For a search tool, this omission leaves the agent with incomplete context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Parameter descriptions are fully covered in the input schema (100%), so the tool description adds no additional meaning. The baseline score of 3 is appropriate because the schema already handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('search') and the resource ('Douyin user data'), making the tool's purpose immediately understandable. However, it does not differentiate from the sibling tool 'search_douyin_videos', which limits specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like 'search_douyin_videos'. The description lacks context about preferred use cases or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_douyin_videosC

搜索抖音视频数据

ParametersJSON Schema
NameRequiredDescriptionDefault
keywordYes搜索关键词
scroll_countNo滚动次数,默认为10
delayNo每次滚动的延迟时间(秒),默认为2

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description must convey behavior. It only states the basic purpose, failing to explain the scrolling mechanism implied by scroll_count and delay parameters, or what the result set looks like.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, concise and to the point. It could be expanded slightly for clarity, but it is efficiently brief.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema, and the description does not explain what data is returned or how the scrolling parameters affect results. The tool is not fully described for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% with basic descriptions for each parameter. The tool description adds no additional meaning beyond the schema, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states 'search Douyin video data', clearly indicating the action and resource. However, it does not distinguish from sibling tool 'search_douyin_users', which could cause confusion.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives, no prerequisites or exclusions. The agent is left to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 8 tool updatesv0.1.3
    • First observedanalyze_content_length
    • First observedanalyze_interaction_data
    • First observedanalyze_keywords
    • First observedclear_data
    • First observedexport_data
    • First observedget_data_summary
    • First observedsearch_douyin_users
    • First observedsearch_douyin_videos

TDQS

A3.5/5.0

Scored across 8 tools

Disambiguation5/5

Each tool has a distinct purpose: two search tools for users and videos, three analysis tools for different aspects (content length, interactions, keywords), and three data management tools (clear, export, summary). No overlap between tools.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case (e.g., search_douyin_users, analyze_keywords, clear_data). The naming is uniform and predictable.

Tool Count5/5

With 8 tools, the server covers the core workflow of searching, analyzing, and managing Douyin data without being too sparse or excessively numerous. The count fits the scope well.

Completeness4/5

The tool set covers the essential lifecycle: search, analyze (content length, interactions, keywords), and data management (clear, export, summary). A minor gap is the lack of a direct fetch for individual video or user details by ID, but search and analysis tools compensate adequately.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers