弹幕文件

弹幕文件可以在

  • https://api.bilibili.com/x/v1/dm/list.so?oid={oid/cid}
  • https://comment.bilibili.com/{oid/cid}.xml
  • https://api.bilibili.com/x/v2/dm/history?type=1&oid={oid/cid}&date={yyyy-mm-dd}

下载
注:cid可以在https://www.bilibili.com/widget/getPageList?aid={aid/mid}获取

弹幕文件格式为xml,结构如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<i>
<chatserver>chat.bilibili.com</chatserver>
<chatid>{oid/cid}</chatid>
<mission>0</mission>
<maxlimit>{Max_Limit}</maxlimit>
<!--Max_Limit视视频长短而定 -->
<state>0</state>
<real_name>0</real_name>
<source>{Status}</source>
<!--历史弹幕中没有source -->
<!--"k-v"或"e-r","e-r"表示弹幕过期 -->
<d p="{time},{type},{size},{color},{timestamp},{pool},{uid_crc32},{row_id}">
{Text}
</d>
<!-- time为弹幕在视频里的时间 -->
<!-- type为弹幕类型 -->
<!-- size为字体大小 -->
<!-- color为十进制的RGB颜色 -->
<!-- timestamp为弹幕发送时间戳 -->
<!-- pool为弹幕池 -->
<!-- uid_crc32为发送者uid的crc32 -->
<!-- row_id用于标记顺序和历史弹幕 -->
<d>...</d>
...
</i>

弹幕类型

弹幕类型由typepool决定
type取值为[14-79],pool取值为[0-2]
弹幕类型如下:

pool\type 1 4 5 6 7 9
0 滚动弹幕 底部弹幕 顶部弹幕 逆向弹幕 特殊弹幕(1) /
1 / / / / 精确弹幕(2) /
2 / / / / / BAS弹幕(3)

特殊弹幕格式

  1. [{x1(0-1)|(px)},{y1},"{Aplha0(0-1)}-{Alpha1}",{Lifetime},"{Text}",{Z_Rotation},{Y_Rotation},{x2},{y2},{Move_Time(ms)},{Delay_Time(ms)},{Outline[01]},"{Fontname}",{Linear_Speedup[01]}[,"SVG_Path"]]
  2. [{x1(0-1)|(px)},{y1},"{Aplha0(0-1)}-{Alpha1}",{Lifetime},"{Text}",{Z_Rotation},{Y_Rotation},{x2},{y2},{Move_Time(ms)},{Delay_Time(ms)},{Outline[01]},"{Fontname}",{Linear_Speedup(Bool)}]
  3. B站官方BAS文档