milmilmilmil
API Reference

External Danmaku

Search and import danmaku from third-party sources (Bilibili, etc.) and cache or persist the results

POST
/api/v1/danmaku/external/import

Fetches comments from the specified source/video/part and caches them for 24 hours under the episode id. Returns the comments inline. The cached entry can later be persisted via PATCH /imported/{episodeId}/save.

Authorization

bearerAuth
AuthorizationBearer <token>

Pass an API token obtained from POST /api/v1/auth/login or POST /api/v1/api-tokens. Tokens have the prefix mlml_.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/danmaku/external/import" \  -H "Content-Type: application/json" \  -d '{    "source": "string",    "videoId": "string",    "episodeId": "string"  }'
{  "source": "string",  "count": 0,  "saved": true,  "comments": [    {      "text": "string",      "time": 0.1,      "mode": "string",      "color": "string"    }  ]}
GET
/api/v1/danmaku/external/imported/{episodeId}

Combines saved (DB) and cached (temporary) entries across all sources, deduped by source.

Authorization

bearerAuth
AuthorizationBearer <token>

Pass an API token obtained from POST /api/v1/auth/login or POST /api/v1/api-tokens. Tokens have the prefix mlml_.

In: header

Path Parameters

episodeId*string

Response Body

application/json

curl -X GET "https://example.com/api/v1/danmaku/external/imported/string"
[  {    "source": "string",    "count": 0,    "saved": true,    "comments": [      {        "text": "string",        "time": 0.1,        "mode": "string",        "color": "string"      }    ]  }]
DELETE
/api/v1/danmaku/external/imported/{episodeId}

Deletes both DB and cache entries. Pass source to remove a single source; omit to clear every source.

Authorization

bearerAuth
AuthorizationBearer <token>

Pass an API token obtained from POST /api/v1/auth/login or POST /api/v1/api-tokens. Tokens have the prefix mlml_.

In: header

Path Parameters

episodeId*string

Query Parameters

source?string

Source identifier; omit to clear all sources for the episode

Response Body

curl -X DELETE "https://example.com/api/v1/danmaku/external/imported/string"
Empty
PATCH
/api/v1/danmaku/external/imported/{episodeId}/save

When save=true, promotes the cached entry for source into the DB. When save=false, demotes the DB entry back to cache and removes the persisted row.

Authorization

bearerAuth
AuthorizationBearer <token>

Pass an API token obtained from POST /api/v1/auth/login or POST /api/v1/api-tokens. Tokens have the prefix mlml_.

In: header

Path Parameters

episodeId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X PATCH "https://example.com/api/v1/danmaku/external/imported/string/save" \  -H "Content-Type: application/json" \  -d '{    "source": "string",    "save": true  }'
{  "saved": true}
GET
/api/v1/danmaku/external/parts

Multi-part videos (e.g. Bilibili 分P) return one VideoPart per part. Single-part videos return a slice of length 1.

Authorization

bearerAuth
AuthorizationBearer <token>

Pass an API token obtained from POST /api/v1/auth/login or POST /api/v1/api-tokens. Tokens have the prefix mlml_.

In: header

Query Parameters

source*string
videoId*string

Response Body

application/json

curl -X GET "https://example.com/api/v1/danmaku/external/parts?source=string&videoId=string"
[  {    "index": 0,    "title": "string",    "duration": 0  }]
GET
/api/v1/danmaku/external/search

Authorization

bearerAuth
AuthorizationBearer <token>

Pass an API token obtained from POST /api/v1/auth/login or POST /api/v1/api-tokens. Tokens have the prefix mlml_.

In: header

Query Parameters

source*string

Source identifier returned by /danmaku/external/sources

q*string

Search keyword

page?integer
Range1 <= value
Default1

Response Body

application/json

curl -X GET "https://example.com/api/v1/danmaku/external/search?source=string&q=string"
[  {    "videoId": "string",    "title": "string",    "danmakuCount": 0,    "duration": "string",    "thumbnail": "http://example.com"  }]
GET
/api/v1/danmaku/external/sources

Returns the registered source identifiers (e.g. bilibili) plus a display label.

Authorization

bearerAuth
AuthorizationBearer <token>

Pass an API token obtained from POST /api/v1/auth/login or POST /api/v1/api-tokens. Tokens have the prefix mlml_.

In: header

Response Body

application/json

curl -X GET "https://example.com/api/v1/danmaku/external/sources"
[  {    "name": "string",    "label": "string"  }]