dankomaconv
v0.1.2
Published
Converters for producing DankomaJSONL data.
Downloads
488
Maintainers
Readme
dankomaconv.js
Converters for producing DankomaJSONL data.
Installation
As a library:
npm install dankomaconvFor the command-line tools, install globally:
npm install -g dankomaconvYou can also run them directly with npx:
npx dankomaconvCommand-line tools
dankomaconv.js provides several command-line converters. Most of them read
input from stdin and write DankomaJSONL to stdout.
| Command | Description |
| ---------------- | ------------------------------------ |
| bili2dankoma | Convert Bilibili danmaku data |
| nico2dankoma | Convert NicoNico danmaku data |
| ytchat2dankoma | Convert YouTube live chat data |
| legacyfix | Convert/fix legacy DankomaJSONL data |
| bilidanmafetch | Fetch Bilibili danmaku directly |
Basic usage
Most converters follow this pattern:
X2dankoma < source > dankoma.jsonlFor example:
bili2dankoma < danmaku.bin > dankoma.jsonlnico2dankoma < danmaku.json > dankoma.jsonlytchat2dankoma < chat.json > dankoma.jsonllegacyfix works the same way:
legacyfix < old.jsonl > dankoma.jsonlBecause the converters use standard input and output, they can also be chained with other Unix tools:
cat source.dat | bili2dankoma | legacyfix > dankoma.jsonlbilidanmafetch
bilidanmafetch is different: it fetches the danmaku from Bilibili directly
instead of reading from stdin.
bilidanmafetch <vid> [page] > dankoma.jsonlThe default page is 1:
bilidanmafetch BV1kx411c7UF > dankoma.jsonlTo fetch a specific page of a multipart video:
bilidanmafetch BV1kx411c7UF 3 > dankoma.jsonlAuthentication is provided through the BILI_COOKIE environment variable.
It must contain a SESSDATA cookie:
export BILI_COOKIE='SESSDATA=...; bili_jct=...'Then:
bilidanmafetch BV1kx411c7UF > dankoma.jsonlLogs are written to stderr, while the generated DankomaJSONL is written to
stdout. This means it is safe to redirect or pipe the output:
bilidanmafetch BV1kx411c7UF > dankoma.jsonlor:
bilidanmafetch BV1kx411c7UF | gzip > dankoma.jsonl.gzOutput format
All converter commands produce DankomaJSONL
on stdout.
Each line represents one danmaku record.
I'd probably put this **above the existing documentation link section or immediately after it**, because the README now answers the "what the fuck do I actually run?" question without making users dig through `doc/doc.md`.