🎬 一个让AI与YouTube视频互动的模型上下文协议(MCP)服务器 - 提取视频信息、字幕和热门评论,无需下载。
uvx youtube-dlp-server
pip install youtube-dlp-server
youtube-dlp-server
git clone <repository-url>
cd youtube-dlp-server
pip install -e .
python -m youtube_dlp_server
提取全面的视频元数据:
{
"name": "get-video-info",
"arguments": {
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
}
提取字幕和字幕:
{
"name": "get-video-subtitles",
"arguments": {
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"languages": ["en", "es"],
"include_auto_captions": true
}
}
获取热门评论(最多20条,默认10条):
{
"name": "get-top-comments",
"arguments": {
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"count": 10
}
}
设置PROXY_URL环境变量:
# HTTP/HTTPS代理
export PROXY_URL="http://proxy.example.com:8080"
# 带认证的SOCKS代理
export PROXY_URL="socks5://user:pass@127.0.0.1:1080/"
# 使用代理运行
youtube-dlp-server
npx @modelcontextprotocol/inspector youtube-dlp-server
python -c "
import asyncio
from youtube_dlp_server.helper import extract_video_info
async def test():
info = await extract_video_info('https://www.youtube.com/watch?v=dQw4w9WgXcQ')
print(f'✅ 视频: {info[\"title\"]}')
asyncio.run(test())
"
MIT许可证 - 查看LICENSE文件了解详情。
为AI社区制作 ❤️