# A self hosted danmaku server exposes one API, and it wants a proxy if you are not in Asia

> A Python service that scrapes bullet comment data from public video sites, stores it, and serves it through an API compatible with the dandanplay platform, with a web interface for managing sources, tokens and libraries. It is AGPL licensed, actively released, and explicit about the fact that aggressive use will get your IP blocked.

**l429609201/misaka_danmu_server** — 一个功能强大的自托管弹幕（Danmaku）聚合与管理服务，兼容 弹弹play API 规范。

- Repository: https://github.com/l429609201/misaka_danmu_server
- Website: https://docs.misaka10876.top/
- Stars: 1,304 · Forks: 145
- Language: Python
- License: AGPL-3.0
- Published: 2026-10-19 · Updated: 2026-10-19 · Language: en
- Canonical page: https://hysenlabs.com/projects/l429609201-misaka-danmu-server

## One API, scraped from public video sites

The service is a self hosted danmaku aggregation and management system that is compatible with the dandanplay API specification. The stated purpose is to scrape danmaku from mainstream video websites and provide a unified, private danmaku API for your own media library, with a modern web interface for managing the danmaku collection, search sources, API tokens and system settings.

The API compatibility is the strategically important decision. The dandanplay platform publishes an API for fetching danmaku for a given title, and by implementing it the service can be pointed at by any client that already speaks it, rather than requiring a client rewrite. The README lists the clients it targets by name, among them yamby, hills, SenPlayer and a few others.

The project also builds on the dandanplay open platform, and the reference projects list includes danmuku, the emby-toolkit project, a MoviePilot plugin set, the bangumi-data offline alias index and the swagger-ui project, which suggests the API surface is documented in a machine readable form.

The licence is AGPL-3.0, which for a self hosted service that talks to a private client is a reasonable choice, but it does mean that if you expose the service to others over a network, the AGPL's network clause becomes relevant to how you distribute it. That is worth checking against your own situation rather than assuming.

The release cadence is fast. v2.8.9 came on 2026-08-22, v2.8.8 on 2026-08-21 and v2.8.7 on 2026-08-20, and the last push to the repository was on 2026-10-13 with the repository not archived. Three patch releases in three days is the pace of a project chasing upstream source changes, which is exactly what a scraper does.

## The README asks twice: use it sparingly, and mind where you run it

Two warnings sit at the top of the README, and they are the most important operational guidance in the project.

The first is a request to use the project on demand and not to abuse it. The project is meant as a supplement to a personal media library, all danmaku data is fetched in real time from third party public APIs or websites, and users are asked to use it reasonably and avoid putting unnecessary load on the source sites, because overly frequent requests may result in the address being blocked by the target website.

The second is about network and regional limits. The README recommends using a mainland China address, and warns that deploying or using the project from outside that region may result in being unable to reach these video sources because of network or regional copyright restrictions, and suggests that users outside the region configure a proxy or ensure their network environment can reach the domestic sites.

That second warning is a hard constraint, not a caveat. A scraper for a set of regional video sites is a scraper for those sites, and the whole value proposition disappears if the sources are unreachable. It also explains a good deal about the dependency list, which includes a Chinese cryptography library for the national SM2, SM3 and SM4 algorithms, a library for AES decryption used by one source, a Chinese to traditional conversion library, and an encoding detector, all of which point at sources with specific encodings and formats.

The disclaimer section repeats the same themes in legal form. The project is a technology neutral open source self hosted tool that aggregates comment data from public third party websites and APIs, it provides only aggregation, storage and API access for matching to media the user legally owns, and it does not produce, modify, store or distribute any video content. Users accept that scraping may violate the terms of service of the third party sites and bear the risk themselves, and the developer disclaims responsibility for service interruption caused by API changes, anti-scraping measures or network conditions.

For an adopter, the practical reading is that this is a project for personal use on media you own, in a network position where the sources are reachable, at a request rate that will not get you blocked.

## The web interface is the whole management surface

The web interface is not a thin admin panel, it is the primary way the service is operated, and the README enumerates what it covers.

There is search and manual import of danmaku, and management of the collected media library, the data sources and the episodes. There is creation and management of API tokens for third party clients, configuration of the priority and enabled state of the search sources, and a view of background task progress and system logs.

The danmaku source management is a distinct subsystem. Sources can be installed from a resource repository or by uploading an offline package, and there is backup and restore support for them. That is a significant design choice. Instead of hardcoding the scraping logic for each site, the sources are packaged, installable artefacts, and a user can add, remove, update and roll back them independently of the server code.

The metadata integration is what makes automatic matching work. The project integrates with TMDB, TVDB, Bangumi, Douban and IMDb, and the matching itself is described as smart, working from the file name or from metadata to pair your media files with the right danmaku. The dependency list explains how that is done: `thefuzz` and `python-Levenshtein` for fuzzy string matching used to improve search result ranking, and the `bangumi-data` dataset referenced in the reference projects for completing anime aliases and platform mappings as an offline index.

The automation story is the last piece. The service accepts webhooks from Sonarr, Radarr, Emby and similar, which is what turns it from a tool you run by hand into one that keeps itself current as your library changes.

The AI assisted matching is a sponsored feature, provided by a third party platform, and it uses the OpenAI compatible interface with a dependency on the OpenAI SDK and the Google Gemini SDK. The README says the support is for the AI assisted matching function specifically.

## The Python stack is large, and every dependency has a reason

The requirements file is a good map of what the service does, because the dependencies are unusual and each one maps to a specific capability.

The web layer is FastAPI with uvicorn and Starlette, and the database layer is SQLAlchemy with the asyncio extra, with `asyncpg` for PostgreSQL and `asyncmy` for MySQL, plus `apscheduler` for scheduled jobs. Configuration is `pydantic-settings`, and the environment variable naming in the compose file shows a nested settings model, with `DANMUAPI_SERVER__HOST`, `DANMUAPI_DATABASE__HOST` and similar double underscore names.

The scraping side is where the dependency list gets long. `httpx` with SOCKS support is the HTTP client, and the file carries a comment explaining that version 0.26 is required because that is when `AsyncClient` gained the `proxy` parameter, and the code uses `proxy` rather than the older `proxies`. `aiohttp` is present as the danmaku platform scraper's own dependency, and `wasmtime` is there for one source.

Text processing has its own set. `beautifulsoup4` and `lxml` for HTML parsing, `chardet` for detecting the encoding used by one video site, and `opencc-python-reimplemented` for converting between simplified and traditional Chinese. `pycryptodome` handles the AES decryption for one source, `gmssl` provides the national SM2, SM3 and SM4 algorithms, and `cryptography` is there for asymmetric signature verification.

The security surface is broad. `python-jose` with `cryptography` handles JWT, `passlib` with `bcrypt` handles passwords, and there is a comment explaining exactly why the bcrypt version is pinned below 4.1, because passlib was not adapted to the API changes in bcrypt 4.1 and the 72 byte password limit. `pyotp` implements TOTP for two factor authentication, and `webauthn` provides FIDO2 passkey support, so the service has a real authentication stack rather than a single password field.

Two newer capabilities are visible. `fastapi-mcp` and `mcp` provide Model Context Protocol support, with a comment explaining that fastapi-mcp 0.4.0 does not declare an `mcp<2` constraint and a loose resolution would install an incompatible mcp 2.x, so both are pinned exactly. And `docker` provides container management, `pyTelegramBotAPI` provides the Telegram notification channel, and `Pillow` is used to assemble search result posters into a grid image for the Telegram experience.

The optional pieces are the ones worth noticing. `redis` is only needed when the cache backend is set to Redis, and the compose file explains that the default is a hybrid mode combining an in-memory L1 with a database L2, with memory, Redis, database and hybrid all available.

## Deployment uses host networking, and that is a deliberate choice

The compose file is short and the choices in it are load bearing.

The service runs with `network_mode: "host"`, and the comment explains what that means: the container uses the host network directly, so 127.0.0.1 inside the container is 127.0.0.1 on the host, and the application is reachable directly on port 7768 without port mapping.

That is the right call for a scraper that needs to reach regional sites and that may need a proxy configured on the host, and it removes a whole class of DNS and hairpin routing problems. It also means the service is exposed on the host's interfaces, so the binding and firewall configuration become your responsibility rather than the compose file's.

The database is expected to run on the host too, with the default type MySQL on port 3306 and PostgreSQL as the alternative, and the environment file documents both, including the note that with host networking the host should be 127.0.0.1 and that inside a compose network you would use a service name such as danmu-mysql or danmu-postgres.

The security configuration in the environment example is the part to get right. The JWT secret key is documented as something to generate with `openssl rand -base64 32` and to change from the placeholder, and the initial admin user is configurable with the note that if no initial password is set, a random one is generated. There is also a MySQL root password variable and the PUID, PGID and UMASK settings for matching the host user so that mounted volumes are not permission problems.

The Dockerfile is a three stage build. The frontend is built on the native build platform with a Node 20 Alpine image, with a comment explaining that the HTML, CSS and JavaScript output is platform independent so there is no reason to pay for QEMU emulation. The Python dependencies are then installed into a target directory with bytecode generation disabled, and the comment there explains a subtlety worth noting: the dist-info directories are kept because the MCP SDK reads package versions through importlib.metadata, and deleting that metadata breaks route initialisation.

The final image sets the timezone to Asia/Shanghai so that log timestamps are correct, and disables bytecode writing.

## Two things to think about before you deploy it

The feature set is generous, and the two features with the widest blast radius are the Docker management integration and the MCP support.

Container management through the Docker SDK means the service can start and stop containers on the host it runs on. That is a very large privilege to give a service that scrapes third party websites and runs AI matching against an external API, and it is worth understanding exactly what the feature is for and whether you need it before you deploy with a socket mounted.

The MCP support is a more curious one. Exposing a service over the Model Context Protocol means an AI assistant can call it, which is a reasonable way to make the danmaku collection queryable, and also a new attack surface with its own authentication considerations. The dependency pins show the author is thinking about the version resolution side of it.

Beyond those, the operational question is the scraper itself. The service stores what it fetched, but the fetching is what puts load on someone else's servers, and the project is explicit about the balance it wants. A private instance with a handful of clients, refreshed on a schedule driven by webhooks, is the intended shape. A shared instance that many people point their clients at, with a large library and a high request rate, is the shape the project asks you not to build.

There is one more thing to verify before you rely on it: the compatibility claim is with the dandanplay API specification, and the reference to the dandanplay open platform and its API documentation suggests the implementation tracks a published protocol. If you are pairing the service with a specific client, check that client's expectations against the API documentation rather than assuming the compatibility holds for every client.

## Conclusion

Adopt misaka_danmu_server if you maintain a personal media library that benefits from bullet comments, you are deploying in a network position that can reach the source sites, and you are willing to run the webhooks that keep it in sync with Sonarr, Radarr or Emby. Do not adopt it as a public service or a high volume scraper, because the project explicitly asks for on demand use and warns that excessive requests get your address blocked by the target sites. Verify first that the sources you need are reachable from where you will run the container, that the database you choose is one of the two the configuration supports, and that the API tokens your client uses match the interface the client expects.

## FAQ

### What is misaka_danmu_server and what does it do?

It is a self hosted danmaku aggregation and management service that scrapes bullet comment data from public video websites and serves it through an API compatible with the dandanplay specification, with a web interface for managing the collection, search sources, API tokens and settings.

### Can I deploy misaka_danmu_server outside China?

The README warns that deploying or using the project overseas may make the video sources unreachable because of network or regional copyright restrictions, and suggests configuring a proxy or ensuring the network environment can reach the domestic sites. It recommends a mainland China address.

### Which databases does misaka_danmu_server support?

The configuration supports MySQL as the default and PostgreSQL as an alternative, with separate async drivers in the dependencies, asyncmy for MySQL and asyncpg for PostgreSQL, both driven by SQLAlchemy with the asyncio extra.

### How does the caching work in misaka_danmu_server?

The default is a hybrid mode combining an in-memory L1 with a database L2, so it needs no extra service. The cache backend can also be set to memory for pure in-memory, to Redis, or to database for pure database, with Redis settings for URL, max memory, socket timeout and connect timeout.

### How do the danmaku sources get installed and updated?

Sources can be loaded from a resource repository or installed by uploading an offline package, and the source management supports backup and restore. Each source has a configurable priority and enabled state, and the source list is managed from the web interface.

## Sources

- [l429609201/misaka_danmu_server on GitHub](https://github.com/l429609201/misaka_danmu_server)
- [License: AGPL-3.0](https://github.com/l429609201/misaka_danmu_server/blob/main/LICENSE)
- [Project website](https://docs.misaka10876.top/)
- [README](https://github.com/l429609201/misaka_danmu_server/blob/main/README.md)
- [Releases](https://github.com/l429609201/misaka_danmu_server/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/l429609201-misaka-danmu-server
