1737 字
9 分钟

Docker Deployment Guide for Misaka Danmu Server

What is Misaka Danmu Server#

Misaka Danmu Server is a powerful self-hosted danmaku (live comment) aggregation and management service, compatible with the dandanplay API specification. It fetches danmaku data in real-time from multiple video platforms, providing bullet comment support for your private media library (Emby, Jellyfin, Plex, etc.).

l429609201
/
misaka_danmu_server
Waiting for api.github.com...
00K
0K
0K
Waiting...

Core Features#

  • Intelligent Matching: Automatically match media content via filenames or metadata (TMDB, TVDB, etc.)
  • Web Management Interface: Intuitive UI for searching/importing danmaku, managing media sources, creating API tokens, and configuring search priorities
  • Danmaku Source Management: Install sources from repositories or upload offline packages, with backup/restore functionality
  • Metadata Integration: Integrates TMDB, TVDB, Bangumi, Douban, and IMDb
  • Automation Support: Supports Sonarr, Radarr, and Emby webhooks for automatic danmaku import
  • Multi-player Compatibility: Works with SenPlayer, Infuse, and other players supporting custom danmaku APIs

Comparison with danmu_api#

If you only need a lightweight danmaku service, check out my previous danmu_api deployment tutorial. Here’s a comparison of the two:

Featuredanmu_apimisaka_danmu_server
Basic danmaku fetchingYesYes
dandanplay API compatibleYesYes
Web management interfaceNoYes
Media library/metadata matchingNoYes (TMDB/TVDB/Bangumi/Douban/IMDb)
Webhook automationNoYes (Sonarr/Radarr/Emby)
Danmaku source managementLimitedYes (full source management)
Token authorization systemSimpleYes (complete permission control)
Deployment complexitySimple (no database)Medium (requires MySQL)
Use casePersonal lightweight useComplete media library management

Prerequisites#

Server Requirements#

  • Memory: 2GB+ recommended
  • Disk: 20GB+ recommended
  • Network: Chinese mainland IP recommended; overseas IPs may have limited access to some danmaku sources due to network or copyright restrictions

Install Docker#

If Docker is not installed, run:

If you use Dokploy, you can also use the official template. I have submitted a PR and it’s pending merge.

https://github.com/Dokploy/templates/pull/624#issuecomment-3686872830

Terminal window
curl -fsSL https://get.docker.com | sh

Docker Compose Deployment#

Create Project Directory#

Terminal window
mkdir -p ~/misaka-danmu && cd ~/misaka-danmu

Create docker-compose.yml#

Terminal window
vim docker-compose.yml

Paste the following configuration:

version: "3.8"
services:
mysql:
image: mysql:8.1.0-oracle
container_name: danmu-mysql
restart: unless-stopped
environment:
# !!! Important: Replace with your strong password !!!
MYSQL_ROOT_PASSWORD: "your_strong_root_password" # Database root password
MYSQL_DATABASE: "danmuapi" # Database name
MYSQL_USER: "danmuapi" # Database username
MYSQL_PASSWORD: "your_strong_user_password" # Database password
TZ: "Asia/Shanghai"
volumes:
- ./db-data:/var/lib/mysql
command:
- '--character-set-server=utf8mb4'
- '--collation-server=utf8mb4_unicode_ci'
- '--binlog_expire_logs_seconds=259200' # Auto-clean binlog older than 3 days
- '--default-authentication-plugin=mysql_native_password'
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -u$${MYSQL_USER} -p$${MYSQL_PASSWORD}"]
interval: 5s
timeout: 3s
retries: 5
start_period: 30s
networks:
- misaka-net
danmu-app:
image: l429609201/misaka_danmu_server:latest
container_name: misaka-danmu-server
restart: unless-stopped
depends_on:
mysql:
condition: service_healthy
environment:
- PUID=1000
- PGID=1000
- UMASK=0022
- TZ=Asia/Shanghai
# --- Database Configuration ---
- DANMUAPI_DATABASE__TYPE=mysql
- DANMUAPI_DATABASE__HOST=mysql
- DANMUAPI_DATABASE__PORT=3306
- DANMUAPI_DATABASE__NAME=danmuapi
# !!! Important: Use the same credentials as mysql container !!!
- DANMUAPI_DATABASE__USER=danmuapi
- DANMUAPI_DATABASE__PASSWORD=your_strong_user_password
# --- Initial Admin Configuration ---
- DANMUAPI_ADMIN__INITIAL_USER=admin
volumes:
- ./config:/app/config
ports:
- "7768:7768"
networks:
- misaka-net
networks:
misaka-net:
driver: bridge

Cloud Database Configuration#

If you’re using a cloud database, here’s a reference configuration:

version: "3.8"
services:
danmu-app:
image: l429609201/misaka_danmu_server:latest
container_name: misaka-danmu-server
restart: unless-stopped
network_mode: "host"
environment:
- PUID=1000
- PGID=1000
- UMASK=0022
- TZ=Asia/Shanghai
- DANMUAPI_DATABASE__TYPE=mysql
- DANMUAPI_DATABASE__HOST=10.8.0.118
- DANMUAPI_DATABASE__PORT=3306
- DANMUAPI_DATABASE__NAME=misaka
- DANMUAPI_DATABASE__USER=misaka
- DANMUAPI_DATABASE__PASSWORD=PASSWORD
- DANMUAPI_ADMIN__INITIAL_USER=admin
volumes:
- ./config:/app/config

Replace all passwords with your own strong passwords.

Start the Service#

Terminal window
docker compose up -d

View startup logs:

Terminal window
docker compose logs -f danmu

The initial admin password will be displayed on first startup - make sure to save it:

[INFO] Initial admin password: xxxxxx

Initial Configuration#

Access Web Management Interface#

Open your browser and navigate to http://your-server-ip:7768

Log in with the admin account:

  • Username: admin (or your configured DANMUAPI_ADMIN__INITIAL_USER)
  • Password: The initial password shown in the startup logs

Danmaku Source Configuration#

  1. Go to System Settings > Danmaku Source Management
  2. Click Install from Repository to get the latest danmaku sources
  3. Enable or disable specific sources as needed
  4. Adjust source priorities

Token Management#

To allow players to access the danmaku API, you need to create a token:

  1. Go to System Settings > Token Management
  2. Click Create Token
  3. Add a note (e.g., “SenPlayer”) and save
  4. Copy the generated token for player configuration

Player Configuration#

SenPlayer#

  1. Open SenPlayer, go to Settings > Danmaku Settings > Custom Danmaku API
  2. Enter the API address: http://your-server-ip:7768/{Token}
    • Replace {Token} with the token generated in the management interface
  3. When playing a video, click the Danmaku button > Search Danmaku
  4. Select your danmaku API and wait for the search to complete, then select the corresponding episode

Infuse#

  1. Go to Settings > Metadata > Danmaku
  2. Select Custom
  3. Enter the API address: http://your-server-ip:7768/{Token}

Yamby (Android)#

  1. Open Yamby, go to danmaku settings
  2. Select custom danmaku API
  3. Enter API address: http://your-server-ip:7768/api/v1/{Token}
  4. Only supports manual danmaku search

Hills (Android/Windows)#

One of the most feature-complete players:

  1. Go to Settings > Danmaku > Custom API
  2. Enter API address: http://your-server-ip:7768/api/v1/{Token}
  3. Supports both auto-matching and manual search

Afusekt (Android/Android TV)#

Supports dual platforms:

  1. Go to Settings > Danmaku Settings
  2. Select custom danmaku server
  3. Enter API address: http://your-server-ip:7768/api/v1/{Token}

dd-danmaku (Browser Extension)#

For web-based players:

  1. Install the browser extension
  2. Configure API address in extension settings
  3. Danmaku will auto-load when visiting video sites

API Path Compatibility#

The service has special route handling - all these formats work correctly:

  • http://IP:7768/api/v1/{Token}
  • http://IP:7768/api/v1/{Token}/api/v2
  • http://IP:7768/{Token}
  • http://IP:7768/{Token}/api/v2

This ensures compatibility with various players.

Advanced Configuration#

Webhook Automation#

Misaka Danmu Server supports receiving notifications from media servers via webhooks to automatically fetch danmaku.

Emby Webhook#

  1. Install the Webhook plugin in Emby
  2. Configure the Webhook URL: http://your-server-ip:7768/webhook/emby
  3. Select events to trigger (e.g., new media added)

Sonarr/Radarr Webhook#

  1. Go to Sonarr/Radarr Settings > Connect
  2. Add a Webhook connection
  3. URL: http://your-server-ip:7768/webhook/sonarr or /webhook/radarr
  4. Select trigger events (e.g., download complete)

Detailed Webhook Configuration#

Jellyfin Webhook#

  1. Install the Webhook plugin in Jellyfin
  2. Go to Dashboard > Plugins > Webhook
  3. Add Generic Destination
  4. Configure Webhook URL: http://your-server-ip:7768/api/webhook/jellyfin?api_key=your_api_key
  5. Only check Item Added event
  6. Enable Send All Properties

Plex Webhook (via Tautulli)#

Plex native Webhook requires Plex Pass subscription and can’t handle batch imports. We recommend using free Tautulli:

  1. Install Tautulli
  2. Go to Settings > Notification Agents > Add Webhook
  3. Configure Webhook URL: http://your-server-ip:7768/api/webhook/plex?api_key=your_api_key
  4. Select Recently Added trigger
  5. Configure JSON data template (refer to official docs)

Media Library Acquisition#

The media library acquisition feature supports reading media entries from multiple sources for automated danmaku import.

Media Server Integration#

Supports reading media libraries from Emby, Jellyfin, Plex:

  1. Go to Settings > Media Acquisition
  2. Select media server type
  3. Enter server address and API Key
  4. Click Test Connection to verify
  5. Save to sync entries from the media server

Local Directory Scanning#

Supports scanning local folders to identify media files:

  1. Configure local directory path
  2. System will identify media based on filename and directory structure
  3. Supports recursive scanning of subdirectories

Recommended directory structure:

Media Library/
├── Movies/
│ ├── Movie Name (2024)/
│ │ └── Movie Name (2024).mkv
│ └── ...
└── TV Shows/
├── Series Name/
│ ├── Season 01/
│ │ ├── Series Name S01E01.mkv
│ │ └── Series Name S01E02.mkv
│ └── Season 02/
│ └── ...
└── ...

Local Danmaku File Scanning#

Supports detecting and importing existing .xml danmaku files:

  1. Configure danmaku file directory
  2. System will scan and identify dandanplay format XML files
  3. Auto-associate with corresponding media entries

Danmaku file naming conventions:

  • Movies: Movie Name (Year).xml
  • Episodes: Series Name S01E01.xml or Series Name Season1Episode1.xml

Metadata Source Configuration#

In System Settings > Metadata Configuration you can configure each metadata source:

  1. Visit TMDB and register
  2. Go to Settings > API > Apply for developer access
  3. Get API v3 key
  4. Enter the API Key in danmaku service’s Search Settings

TVDB#

  1. Visit TVDB and register
  2. Go to Dashboard to generate API Key
  3. Configure in danmaku service

Supports two authentication methods:

  • Access Token: Simple method, suitable for personal use
  • OAuth Authentication: Suitable for multi-user scenarios

Douban#

Douban uses web scraping, no official API required. Optionally configure Cookie for better stability.

IMDb#

No authentication required, supports both third-party API and HTML parsing methods.

Priority Recommendations#

Adjust priorities based on your media library type:

  • General: TMDB > TVDB > Bangumi > Douban > IMDb
  • Anime-focused: Bangumi > TMDB > TVDB
  • Chinese content: Douban > TMDB > IMDb

AI Feature Configuration#

Misaka Danmu Server supports using AI to enhance matching capabilities, including intelligent matching, season mapping, and alias validation.

Supported AI Providers#

ProviderRatingNotes
DeepSeek⭐⭐⭐⭐⭐Best value Chinese LLM, fast response
SiliconFlow⭐⭐⭐⭐Multiple open-source models, China-friendly
OpenAI⭐⭐⭐Good results, but requires proxy in China
Google Gemini⭐⭐⭐Good results, but requires proxy in China

Configuration Steps#

  1. Go to Settings > AI-Assisted Enhancement
  2. Select AI provider
  3. Enter API Key
  4. Set Base URL (usually use default)
  5. Select model name
  6. Click Test Connection to verify

Cost reference: DeepSeek charges ¥1/million tokens input, ¥2/million tokens output. Since each call uses very few tokens, monthly costs are typically just a few yuan.

Telegram Bot#

You can manage the danmaku service remotely via Telegram Bot, supporting search/import, library management, task monitoring, and more.

balge
/
misaka-danmuku-bot
Waiting for api.github.com...
00K
0K
0K
Waiting...

Requirement: Danmaku library version > v2.0.4

Refer to the project documentation for detailed configuration.

Danmaku Source Management#

Online Repository Installation#

  1. Go to System Settings > Danmaku Source Management
  2. Configure repository URL (supports GitHub or CDN acceleration):
https://github.com/l429609201/Misaka-Scraper-Resources
  1. Click Install from Repository
  2. System will auto backup current sources, download latest files, install and reload

Offline Package Installation#

If you can’t access online repositories:

  1. Download the platform-specific offline package from Releases page
  2. Upload the offline package in Web UI
  3. System will auto install and reload

Backup and Recovery#

  • Auto Backup: System auto-backups current sources during updates
  • Manual Backup: Click backup button on source management page
  • Recovery: Select backup file to restore

Danmaku Library Management#

Entry Management#

On the Danmaku Library page you can:

  • View, edit, delete entries
  • Search by title
  • Filter by type (movies, TV shows, anime, etc.)

Each entry contains:

  • Basic info (title, year, etc.)
  • Alias list
  • Multiple danmaku sources (Bilibili, iQiyi, etc.)

Manual Entry Creation#

For works not in danmaku sources, you can manually create entries:

  1. Click New Entry
  2. Fill in work information
  3. Can import local XML danmaku files

XML Danmaku Import#

Supports importing dandanplay format danmaku files:

  • Single file import: Select individual XML file
  • Batch import: Select multiple XML files

TMDB Auto Enhancement#

When enabled, the system will automatically add aliases to entries via TMDB scheduled tasks, improving player matching success rate.

Danmaku API Feature Configuration#

Advanced Token Settings#

When creating tokens, you can configure:

  • Validity period: Token expiration time
  • Daily call limit: Prevent abuse

Danmaku Output Settings#

  • Sampling limit: Recommended 3000-5000 (desktop), lower for mobile
  • Random colors: Assign random colors to danmaku
  • Blacklist filtering: Supports keywords and regex

Custom Storage Path#

You can use variables to customize danmaku storage paths:

  • ${title} - Work title
  • ${season} - Season
  • ${episode} - Episode number
  • ${episodeId} - Episode ID

Auto Fallback Options#

  • Match fallback: Auto fetch from sources when local results unavailable
  • Search fallback: Try backup sources when primary source has no results
  • Sequential fallback: Try other sources when primary source has no valid episodes
  • Pre-download: Auto download next episode danmaku in background

Command System#

You can use special commands in the search interface (case-insensitive):

CommandDescription
@View available commands
@QLHCClear cache
@SXDMRefresh danmaku (multi-step selection)
@CXLKCheck rate-limiting status
@CXRWQuery task status

Filter Configuration#

Entry Title Filtering#

On search results page, you can filter entries by keywords:

  • Supports partial matching
  • Case-insensitive
  • Supports mixed Chinese and English

Episode Name Filtering#

On entry detail page, you can filter episode lists:

  • S01, Season 1 - Filter by season
  • E05, Episode 5 - Filter by episode
  • Special, OVA - Filter special content

Reverse Proxy Configuration#

To access via domain name, configure an Nginx reverse proxy:

server {
listen 443 ssl http2;
server_name danmu.example.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://127.0.0.1:7768;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}

After configuration, update the API address in your player to https://danmu.example.com/{Token}.

Updating the Service#

Terminal window
cd ~/misaka-danmu
docker compose pull
docker compose up -d

Important Notes#

Network Environment#

  • Deploying with a Chinese mainland IP is recommended; overseas servers may have limited access to some danmaku sources due to network restrictions
  • If using an overseas server, you may need to configure a proxy

Fair Use#

The project author explicitly states in the documentation:

All danmaku data is obtained from third-party public APIs or websites. Please use responsibly and avoid abuse that may result in IP bans.

Disclaimer#

Misaka Danmu Server only provides danmaku data aggregation, storage, and API access functionality. It does not produce, modify, store, or distribute video content itself. Users are responsible for their own usage.

References#

Docker Deployment Guide for Misaka Danmu Server
https://catcat.blog/en/2025/12/misaka-danmu-server-deploy/
作者
猫猫博客
发布于
2025-12-24
许可协议
CC BY-NC-SA 4.0