Deploy a Danmu Server for Your Movie Watching: danmu_api
What is danmu_api
danmu_api is an open-source JS danmu API backend project designed to let anyone easily deploy a danmu interface server. It supports fetching danmu directly from multiple video platforms (such as iQIYI, Youku, Tencent Video, Mango TV, Bilibili, etc.) without having to download danmu files in advance. Compared with another danmu service, misaka_danmu_server, it is more lightweight and simpler to deploy. If your needs are relatively light, this might be a better fit. Let’s first look at how to deploy danmu_api.
Main features include:
- Compatible with Dandanplay (a danmu player), supporting its search, detail query, and danmu-fetch APIs.
- Supports logging so you can view recent operation logs.
- Multiple deployment options: local, Docker, Vercel, Cloudflare, EdgeOne, and more.
- Configurable via environment variables, with options to toggle behavior such as token, which third-party danmu server to use as a fallback, concurrency, cookies, etc.
- Implemented in JavaScript (Node.js).
Feature Overview
From the README, it provides the following APIs and features: GitHub
| Feature | Example Endpoint | Usage / Notes |
|---|---|---|
| Search anime | GET /api/v2/search/anime?keyword=${queryTitle} | Search anime by keyword. GitHub |
| Match anime by title | POST /api/v2/match | For automatic matching: find the corresponding anime by a given keyword. GitHub |
| Search episodes | GET /api/v2/search/episodes | Search for all matching episodes. GitHub |
| Get anime details | GET /api/v2/bangumi/:animeId | Retrieve detailed data for a specific anime. GitHub |
| Get danmu comment | GET /api/v2/comment/:commentId?withRelated=true&chConvert=1 | Get the danmu content of a specific comment, with support for related comments and character conversion. GitHub |
| Logs | GET /api/logs | Recent logs (up to 500 lines), including both info and error level output. GitHub |
Feature Comparison
| Feature | danmu_api | misaka_danmu_server |
|---|---|---|
| Basic danmu fetching + API | ✅ | ✅ |
| API compatibility (Dandanplay / others) | Yes, compatible with Dandanplay APIs, etc. | Yes, follows the Dandanplay API spec and also supports custom player APIs (token routes, etc.). |
| Media library / metadata matching | —— (lighter weight) | ✅ Supports media library management + metadata from TMDB, TVDB, Bangumi, Douban, IMDb, etc. |
| Web admin UI | —— | ✅ Provides a Web UI to manage danmu library, search sources, episodes, tokens, etc. |
| Auto-sync / Webhook integration | —— | ✅ Supports Sonarr, Radarr, Emby, and other media servers triggering automatic danmu import via Webhooks. |
| Logs / history / debugging | danmu_api has log endpoints, etc. | misaka_danmu_server provides logs + background task status monitoring + UI-based system settings. |
| Multi-source config / search priority | Some environment variables to switch sources | More powerful: configure multiple search sources, enable/disable, and set priority in the Web UI. |
| Security / API authorization | danmu_api has token configuration, etc. | misaka offers a more complete token auth system with a management UI, plus permissions and an account system. |
Deployment
Vercel Deployment (Most Recommended)
One-click deployment
In general, it’s recommended to fork the repo and deploy manually rather than using the official one-click deploy button, as the latter cannot automatically pull updates.



- Set environment variables: After deployment, in the Vercel dashboard:
- Go to your project settings.
- In the “Environment Variables” section, add a
TOKENvariable and enter your API token. - Save the changes and redeploy.
- Example request:
https://{your_domian}.vercel.app/87654321/api/v2/search/anime?keyword=子夜归
Set up a custom domain
Be sure to bind a custom domain. The default Vercel domain, even if you choose Hong Kong, is usually blocked or throttled from mainland China.

Set the Token environment variable
Of course, you can also set this token when you first deploy. The steps here are for when you need to change the token later.

Update function regions
By default, the functions run in the US, which offers only average speed for CN users. You should switch regions according to your needs. But if, like me, you’re not on a Pro plan, you can only choose one region.
You need to disable the US region first, then select Hong Kong, and finally redeploy.

Docker Deployment
-
Pull the image:
docker pull logvar/danmu-api:latest -
Run the container:
docker run -d -p 9321:9321 --name danmu-api -e TOKEN=your_token_here logvar/danmu-api:latest- Use
-e TOKEN=your_token_hereto set theTOKENenvironment variable.
services:danmu-api:image: logvar/danmu-api:latestcontainer_name: danmu-apiports:- "9321:9321"environment:- TOKEN=your_token_here # 请将your_token_here 替换为实际的 Token 值restart: unless-stopped # 可选配置,容器退出时自动重启(非必需,可根据需求删除)- Or deploy with Docker Compose.
- Use
-
Test the API: Use
http://{ip}:9321/{TOKEN}to access the above APIs. If you need a domain name, you can put it behind a CDN, set the origin to this IP and port, and you’re good to go.
Using the API
Supported players include forward / senplayer / hills / 小幻 / yamby / eplayerx / afusekt and other players that support danmu APIs.
Take senplayer as an example:
- Get the API address of your deployment, e.g.
http://192.168.1.7:9321/87654321, where87654321is the default token. If you set a customTOKENenvironment variable, replace it with your actual token. - Enter the API address in the custom danmu API field under
Settings - Danmu Settings - Custom Danmu API. - In the playback screen, click
Danmu button - Search danmu, select your danmu API, and it will search based on the title. Wait for a while and then choose the episode.

Note: when configuring the API in 小幻, you need to append /api/v2 to the API base, e.g. https://{your_project}.vercel.app/87654321/api/v2.