Skip to main content

MCP server for downloading Douyin videos and extracting text from audio

Project description

抖音无水印视频文本提取 MCP 服务器

PyPI version Python version

一个基于 Model Context Protocol (MCP) 的服务器,可以从抖音分享链接下载无水印视频,提取音频并转换为文本。

功能特性

  • 🎵 从抖音分享链接获取无水印视频
  • 🎧 自动提取视频音频
  • 📝 使用AI语音识别提取文本内容
  • 🧹 自动清理中间临时文件
  • 🔧 支持自定义API配置

安装

使用 uvx 安装(推荐)

uvx douyin-wenan-mcp-server

使用 pip 安装

pip install douyin-wenan-mcp-server

使用方法

1. 启动服务器

douyin-wenan-mcp-server

2. 在Claude Desktop中配置

在你的 claude_desktop_config.json 中添加:

{
  "mcpServers": {
    "douyin-wenan": {
      "command": "uvx",
      "args": ["douyin-wenan-mcp-server"],
      "env": {
        "DOUYIN_API_KEY": "your-api-key-here"
      }
    }
  }
}

3. 使用MCP工具

获取无水印下载链接

使用 get_douyin_download_link 工具:

# 在Claude中使用,无需API密钥
get_douyin_download_link("https://v.douyin.com/xxx")

提取视频文本

使用 extract_douyin_text 工具(需要设置环境变量 DOUYIN_API_KEY):

# 在Claude中使用
extract_douyin_text("https://v.douyin.com/xxx")

解析视频信息

使用 parse_douyin_video_info 工具:

parse_douyin_video_info("https://v.douyin.com/xxx")

API 配置

默认配置

服务器默认使用 SiliconFlow API:

  • API URL: https://api.siliconflow.cn/v1/audio/transcriptions
  • 模型: FunAudioLLM/SenseVoiceSmall

自定义配置

你可以自定义API配置:

extract_douyin_text(
    share_link="your-douyin-link",
    api_base_url="https://your-custom-api.com/transcriptions",
    model="your-custom-model"
)

环境变量配置

在Claude Desktop的配置文件中设置环境变量:

{
  "mcpServers": {
    "douyin-wenan": {
      "command": "uvx",
      "args": ["douyin-wenan-mcp-server"],
      "env": {
        "DOUYIN_API_KEY": "sk-your-api-key-here"
      }
    }
  }
}

工具说明

get_douyin_download_link

获取抖音视频的无水印下载链接,无需API密钥。

参数:

  • share_link: 抖音分享链接或包含链接的文本

返回:

  • 包含下载链接和视频信息的JSON格式数据

extract_douyin_text

完整的文本提取工具,执行以下步骤:

  1. 解析抖音分享链接
  2. 下载无水印视频
  3. 提取音频
  4. 转换音频为文本
  5. 清理临时文件

参数:

  • share_link: 抖音分享链接或包含链接的文本
  • api_base_url: API基础URL(可选)
  • model: 语音识别模型(可选)

环境变量:

  • DOUYIN_API_KEY: 语音识别API密钥(必需)

parse_douyin_video_info

仅解析视频基本信息,不下载视频。

参数:

  • share_link: 抖音分享链接

资源访问

  • douyin://video/{video_id}: 通过视频ID获取详细信息

依赖要求

  • Python 3.8+
  • ffmpeg(系统需要安装ffmpeg)
  • requests
  • ffmpeg-python
  • tqdm
  • mcp

安装 ffmpeg

macOS

brew install ffmpeg

Ubuntu/Debian

sudo apt update
sudo apt install ffmpeg

Windows

下载并安装 ffmpeg

开发

本地开发

git clone https://github.com/yzfly/douyin-wenan-mcp-server.git
cd douyin-wenan-mcp-server
pip install -e .

运行测试

python -m douyin_wenan_mcp_server.server

注意事项

  • 确保系统已安装 ffmpeg
  • 需要在环境变量中设置有效的语音识别API密钥 DOUYIN_API_KEY
  • 获取下载链接功能无需API密钥
  • 中间文件会自动清理,不会占用磁盘空间
  • 支持大部分抖音视频格式

许可证

MIT License

作者

贡献

欢迎提交 Issue 和 Pull Request!

更新日志

v0.1.0

  • 初始版本
  • 支持抖音视频文本提取
  • 支持获取无水印视频下载链接
  • 从环境变量读取API密钥
  • 自动清理临时文件
  • 支持自定义API配置

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

douyin_wenan_mcp_server-0.1.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

douyin_wenan_mcp_server-0.1.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file douyin_wenan_mcp_server-0.1.0.tar.gz.

File metadata

  • Download URL: douyin_wenan_mcp_server-0.1.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for douyin_wenan_mcp_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a7cc3b927f75492c40939ea08f4dde24dbd8f5aa9851ec2652d0b79417949886
MD5 0a07fc2b57d067d3de8afd52c9a0098c
BLAKE2b-256 567bafda659379cccc17a6d6fdc0f4b4273115dadf0bfce96ebdf3e2567b5757

See more details on using hashes here.

File details

Details for the file douyin_wenan_mcp_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for douyin_wenan_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9246692406804f65b4931dc55cba267e7431f815e3bac131f0a8be076eb8f7ce
MD5 481c977352987a9f97eb82010337dd60
BLAKE2b-256 b1f2e8582c3bea68e5614910aabd0c2c520cb849ffa33b0e8829a484997cd9e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page