An MCP (Model Context Protocol) server that allows you to fetch subtitles for Bilibili videos.
Project description
Bilibili Subtitle Fetch MCP Server
This project provides an MCP (Model Context Protocol) server that allows you to fetch subtitles for Bilibili videos.
Features
- Fetches subtitles for Bilibili videos using a given URL.
- Supports specifying a preferred subtitle language.
- Supports outputting subtitles in plain text or with timestamps.
- Uses environment variables for Bilibili credentials.
Installation
Optionally: Install node.js, this will cause the fetch server to use a different HTML simplifier that is more robust.
Using uv (recommended)
When using uv no specific installation is needed. We will
use uvx to directly run bilibili-subtitle-fetch.
Using PIP
Alternatively you can install bilibili-subtitle-fetch via pip:
pip install bilibili-subtitle-fetch
After installation, you can run it as a script using:
python -m bilibili_subtitle_fetch
To run the MCP server, execute the server.py file:
python server.py
The server will start and listen for incoming requests.
Using the get_bilibili_subtitle Tool
Once the server is running and connected to your MCP client, you can use the get_bilibili_subtitle tool.
Tool Name: get_bilibili_subtitle
Description: Fetches subtitles for a given Bilibili video URL.
Parameters:
url(required, string): The URL of the Bilibili video (e.g., "https://www.bilibili.com/video/BV1fz4y1j7Mf/?p=2").preferred_lang(optional, string): The preferred subtitle language code (e.g., 'zh-CN', 'ai-zh', 'en'). Defaults to 'zh-CN'. Check the video page for available languages. 'ai-zh' is often AI-generated Chinese.output_format(optional, string): The desired format for the subtitles ('text' for plain text, 'timestamped' for text with timestamps). Defaults to 'text'.
Example Usage (via MCP Client):
{
"server_name": "bilibili-subtitle-getter",
"tool_name": "get_bilibili_subtitle",
"arguments": {
"url": "https://www.bilibili.com/video/BV1fz4y1j7Mf/?p=2",
"preferred_lang": "en",
"output_format": "timestamped"
}
}
Replace "your_server_name" with the actual name or identifier your MCP client uses to connect to this server.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bilibili_subtitle_fetch-0.1.2.tar.gz.
File metadata
- Download URL: bilibili_subtitle_fetch-0.1.2.tar.gz
- Upload date:
- Size: 45.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b04dc9c8d260cb60757f2640dce626d1b79ffe074356c8f445358d33a07fb60a
|
|
| MD5 |
8995175ef9a4e0aea59d7a2f8c30ce9a
|
|
| BLAKE2b-256 |
b2c49e03276d4d1b84f7997bb86b382791825658157e2e11abfe0dbabefb60f4
|
File details
Details for the file bilibili_subtitle_fetch-0.1.2-py3-none-any.whl.
File metadata
- Download URL: bilibili_subtitle_fetch-0.1.2-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d6224b7760b0b52f1912260b0f5fe7d5a28d99afe981a8852d572d4a597d4e7
|
|
| MD5 |
44290a3b6dad56b124f5c9bb028b3040
|
|
| BLAKE2b-256 |
966a5d3440ff9e85e67a2304b7e15f9c6f6043fa06f2d4046b4382c1412e47ea
|