Skip to main content

Convert bilibili danmaku file (XML) to styled subtitle file (ASS). 使用bilibili弹幕(XMl)生成ASS字幕文件。

This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
JSR Score
94%
Published
5 months ago (0.1.0)

@biliy-deno/danmaku2ass

forked from https://github.com/otakustay/danmaku-to-ass forked from https://github.com/justorez/biliy

Fix to use with Deno.
使用bilibili弹幕(XMl)生成ASS字幕文件。

Installation

Find more detalis here(jsr.io).

Quick Example

import fs from "fs";
import { generateASS } from "jsr:@biliy-deno/danmaku2ass";

const filename = "example.xml";
const xmlText = fs.readFileSync(filename, "utf-8");
const assText = generateASS(xmlText, { filename, title: "Quick Example" });
fs.writeFileSync(`${filename}.ass`, assText, "utf-8");
// default subtitle style
// convert function options.substyle
{
    fontSize: [25, 25, 36],
    fontName: '黑体',
    color: '#ffffff',
    outlineColor: null,
    backColor: null,
    outline: 2,
    shadow: 0,
    bold: false,
    padding: [2, 2, 2, 2],
    playResX: 1280,
    playResY: 720,
    scrollTime: 8,
    fixTime: 4,
    opacity: 0.6,
    bottomSpace: 60,
    includeRaw: true,
    mergeIn: -1,
    block: []
}

LICENSE

MIT

Add Package

deno add jsr:@biliy-deno/danmaku2ass

Import symbol

import * as mod from "@biliy-deno/danmaku2ass";

---- OR ----

Import directly with a jsr specifier

import * as mod from "jsr:@biliy-deno/danmaku2ass";

Add Package

npx jsr add @biliy-deno/danmaku2ass

Import symbol

import * as mod from "@biliy-deno/danmaku2ass";

Add Package

yarn dlx jsr add @biliy-deno/danmaku2ass

Import symbol

import * as mod from "@biliy-deno/danmaku2ass";

Add Package

pnpm dlx jsr add @biliy-deno/danmaku2ass

Import symbol

import * as mod from "@biliy-deno/danmaku2ass";

Add Package

bunx jsr add @biliy-deno/danmaku2ass

Import symbol

import * as mod from "@biliy-deno/danmaku2ass";