Background#
I have previously written an article about finding the history of deleted videos on Bilibili, which includes two methods to obtain historical danmaku.
However, both of these methods essentially rely on users uploading and saving the danmaku themselves, so if it's a less popular anime, you may find that there are no danmaku available.
The most comprehensive danmaku library is still Bilibili's own database, so this time we will directly download the danmaku file from Bilibili's database using the anime title.
Historical Danmaku#
Obtaining the CID Number#
This platform used to support direct danmaku downloads, but it no longer does. However, it's okay because we can download them ourselves. After opening the website,
1. Click on 展开更多选项
(Expand more options)
数据源
(Data source) -> biliplus站内搜索
(biliplus site search)
Next, you can start keyword searching. You can use conditions to narrow down the scope, for example, entering ' 秋叶原之旅 @连载动画 ' will only include videos in the ongoing animation section.
Note that some early or unofficial submissions may not be indexed in the corresponding section, so you should not limit the section when searching.
Below are some commonly used section names, for more details, please refer to the documentation
- Ongoing Animation
- Completed Animation
- Japanese Movies
- Domestic Dramas
- Overseas Dramas
In addition, if you enter 秋叶原之旅 @m=928123
, it will only include videos uploaded by Bilibili's official anime account.
928123 is the mid number for Bilibili's official anime account, which can be found in the link to their personal space.
The table below provides the mid numbers for some official accounts
Official Account | mid |
---|---|
Bilibili Anime | 928123 |
Bilibili Anime Business Trip | 11783021 |
Bilibili Movie | 15773384 |
Miying Society | 4856007 |
2. After searching, you can get the AV number we want
3. In fact, with the AV number, we can convert it to a CID using existing APIs, but biliplus provides this functionality as well.
If you're interested, you can check out the API documentation collected by the experts.
Click to open
-> 视频cid历史
(Video CID history)
Downloading and Converting Danmaku#
Method 1
A tool provided by the experts for online merging of danmaku based on AV number or CID.
Method 2
- Note: The following APIs may become invalid due to updates on Bilibili. You can replace them with the API documentation.
Paste the CID number at the end of this link and visit to download. segment_index=1 represents danmaku from 0-6 minutes, and you need to increment it according to the video length to get the complete danmaku.
https://api.bilibili.com/x/v2/dm/web/seg.so?type=1&segment_index=1&oid=
After downloading, you will see a seg.so file. You can directly use an online converter or write your own parsing code to convert it. If you're interested, you can check out this documentation
Convert seg.so to ass format
Convert ass format to xml format
And now, we have successfully downloaded the danmaku file.