Skip to content

Commit 14948b4

Browse files
committed
更新文档
1 parent 0e80736 commit 14948b4

13 files changed

+819
-997
lines changed

docs/.vuepress/config/sidebar.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,8 @@ export default sidebar({
5353
children: [
5454
"install",
5555
"install-on-baota",
56-
"raw-danmu",
5756
"artplayer-danmu",
58-
"dplayer-danmu",
59-
"download-bilibili-danmu",
60-
"meting",
57+
"dplayer-danmu"
6158
],
6259
},
6360
],

docs/.vuepress/styles/palette.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// you can change colors here
22
$theme-color: #096dd9;
33

4-
$contentWidth: 960px;
4+
$contentWidth: 860px;

docs/OpenSw/Danmu.Server/README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,17 @@ dir:
2020

2121
因为作者免费提供那个弹幕服务器貌似是挂掉了,看了一下开源的[源码](https://github.com/MoePlayer/DPlayer-node),我决定自己撸了一个出来。
2222

23+
## 示例
24+
25+
- https://danmu.u2sb.com/bilibili/artplayer-v2.html
26+
- https://danmu.u2sb.com/bilibili/dplayer-v2.html
27+
- https://danmu.u2sb.com/bilibili/artplayer-v1.html
28+
2329
## 公共服务
2430

25-
[文档](https://www.u2sb.com/pages/15f418/)
31+
暂时只提供 BiliBili 弹幕解析服务,详见 API
2632

27-
> 公共服务器是我个人维护的,存在不稳定因素,随时可能会停止服务器,以后也有可能清理弹幕,请勿用于生产环境。
33+
地址为 `https://danmu.u2sb.com/`
2834

2935
## 反馈
3036

docs/OpenSw/Danmu.Server/artplayer-danmu.md

+65-67
Original file line numberDiff line numberDiff line change
@@ -10,91 +10,89 @@ redirectFrom:
1010

1111
适合 ArtPlayer 使用的弹幕
1212

13-
## API V1
14-
15-
### ArtPlayer 弹幕
16-
17-
#### API
18-
19-
- `/api/artplayer/v1/{id}.{format?}`
20-
- `/api/artplayer/v1/?id={id}`
21-
22-
#### 示例
23-
24-
- `https://danmu.u2sb.com/api/artplayer/v1/cENuyhsT2rMOCohK`
25-
- `https://danmu.u2sb.com/api/artplayer/v1/cENuyhsT2rMOCohK.json`
26-
- `https://danmu.u2sb.com/api/artplayer/v1/?id=cENuyhsT2rMOCohK`
13+
## API V2
2714

2815
### 解析 BiliBili 弹幕
2916

3017
#### 解释
3118

32-
- `id` aid 或 bvid,例如 `av810872``BV18b411j72u`
19+
- `bvid` 视频 bvid
3320
- `p` 分 P,例如 `1` `2`,省略时默认为 `1`
34-
- `format` 数据格式,`json``xml`
21+
- `format` 数据格式,`json`
3522

3623
#### API
3724

38-
- `/api/artplayer/v1/bilibili/{id}/{p:int?}.{format?}`
39-
- `/api/artplayer/v1/bilibili.{format}?bvid={id}&p={p}`
25+
- `/api/art/bilibili/v2/{bvid}.{format}`
26+
- `/api/art/bilibili/v2/{bvid}/{p:int}.{format}`
4027

4128
#### 示例
4229

43-
- `https://danmu.u2sb.com/api/artplayer/v1/bilibili/BV18b411j72u`
44-
- `https://danmu.u2sb.com/api/artplayer/v1/bilibili/BV18b411j72u.json`
45-
- `https://danmu.u2sb.com/api/artplayer/v1/bilibili/BV18b411j72u/2.json`
46-
- `https://danmu.u2sb.com/api/artplayer/v1/bilibili/?bvid=BV18b411j72u`
47-
48-
#### 返回
49-
50-
```xml
51-
<i xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
52-
<d p="12.544,1,25,16777215,1555668046,0,3600fffd,14955772062990336, 6">来了</d>
53-
<d p="7.739,1,25,16777215,1555668050,0,5689bb4c,14955774128160768, 8">第一,截图见证</d>
54-
<d p="30.225,1,25,16777215,1555668063,0,b21ea9d5,14955781264769024, 8">国风真美!!!</d>
55-
<d p="25.077,1,25,16777215,1555668091,0,260d013c,14955795885588482, 7">好像真的是第一</d>
56-
<d p="6.46,1,25,16777215,1555668096,0,8e084014,14955798307799044, 7">我好早</d>
57-
<d p="11.538,1,25,16777215,1555668098,0,e3027d1f,14955799643160580, 10">来了来了!</d>
58-
<d p="39.019,1,25,16777215,1555668105,0,3600fffd,14955802998079490, 9">那个说第一的,你错了,00:12那个是我,我才是第一</d>
59-
<d p="40.484,1,25,16777215,1555668200,0,d1f6347d,14955852705824768, 1">真的美爆了!⁽⁽ଘ( ˊᵕˋ )ଓ⁾⁾</d>
60-
</i>
61-
```
30+
- `https://danmu.u2sb.com/api/art/bilibili/v2/BV1JP41167xK.json`
6231

63-
```json
64-
{
65-
"code": 0,
66-
"data": [
67-
{
68-
"text": "来了",
69-
"time": 12.544,
70-
"color": "#FFFFFF",
71-
"size": 25,
72-
"border": false,
73-
"mode": 0
74-
},
75-
{
76-
"text": "第一,截图见证",
77-
"time": 7.739,
78-
"color": "#FFFFFF",
79-
"size": 25,
80-
"border": false,
81-
"mode": 0
82-
},
83-
{
84-
"text": "国风真美!!!",
85-
"time": 30.225,
86-
"color": "#FFFFFF",
87-
"size": 25,
88-
"border": false,
89-
"mode": 0
32+
```html
33+
<!DOCTYPE html>
34+
35+
<head>
36+
<meta charset="UTF-8" />
37+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
38+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
39+
<title>demo</title>
40+
<style>
41+
.art-container {
42+
width: 800px;
43+
height: 450px;
9044
}
91-
]
92-
}
45+
</style>
46+
</head>
47+
48+
<body>
49+
<h2>MessagePack 推荐</h2>
50+
<div id="art1" class="art-container"></div>
51+
52+
<h2>JSON 不推荐</h2>
53+
<div id="art2" class="art-container"></div>
54+
55+
<script type="module">
56+
import artplayer from "https://cdn.jsdelivr.net/npm/artplayer/+esm";
57+
import artdm from "https://cdn.jsdelivr.net/npm/artplayer-plugin-danmuku/+esm";
58+
import { getDanMuAsync } from "/assets/js/artMsgpackDm.js";
59+
60+
const Artplayer = artplayer.default;
61+
const artplayerPluginDanmuku = artdm.default;
62+
63+
const art1 = new Artplayer({
64+
container: "#art1",
65+
url: "/assets/video/1214946209-1-192.mp4",
66+
fullscreen: true,
67+
fullscreenWeb: true,
68+
plugins: [
69+
artplayerPluginDanmuku({
70+
danmuku: () => getDanMuAsync("/api/art/bilibili/v2/BV1JP41167xK"),
71+
}),
72+
],
73+
});
74+
75+
//不推荐
76+
const art2 = new Artplayer({
77+
container: "#art2",
78+
url: "/assets/video/1214946209-1-192.mp4",
79+
fullscreen: true,
80+
fullscreenWeb: true,
81+
plugins: [
82+
artplayerPluginDanmuku({
83+
danmuku: () =>
84+
fetch("/api/art/bilibili/v2/BV1JP41167xK.json").then((res) =>
85+
res.json()
86+
),
87+
}),
88+
],
89+
});
90+
</script>
91+
</body>
9392
```
9493

9594
## 示例
9695

97-
9896
<div ref="art0" />
9997

10098
```html

docs/OpenSw/Danmu.Server/assets/js/artplayerDemo.js

+5-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const danmuApi = "https://danmu.u2sb.com/api/bilibili/v2/BV1zt411t79A";
1+
const danmuApi = "https://danmu.u2sb.com/api/art/bilibili/v2/BV1JP41167xK";
22

33
export default {
44
mounted() {
@@ -11,37 +11,22 @@ export default {
1111
Promise.all([
1212
import("artplayer"),
1313
import("artplayer-plugin-danmuku"),
14-
import("https://danmu.u2sb.com/assets/dm/dm.js"),
14+
import("https://danmu.u2sb.com/assets/js/artMsgpackDm.js"),
1515
]).then(
1616
([
1717
{ default: ArtPlayer },
1818
{ default: artplayerPluginDanmuku },
19-
{ DanMu },
19+
{ getDanMuAsync },
2020
]) => {
2121
this.art = new ArtPlayer({
2222
fullscreen: true,
2323
autoSize: true,
2424
setting: true,
2525
container: art0,
26-
url: "/assets/video/s_720.mp4",
26+
url: "https://danmu.u2sb.com/assets/video/1214946209-1-192.mp4",
2727
plugins: [
2828
artplayerPluginDanmuku({
29-
danmuku: () =>
30-
fetch(danmuApi)
31-
.then((res) => res.arrayBuffer())
32-
.then((buffer) => {
33-
let d =
34-
DanMu.Models.Protos.BiliBili.Dm.DmSegMobileReply.decode(
35-
new Uint8Array(buffer)
36-
);
37-
return d.elems.map((m) => ({
38-
text: m.content,
39-
time: m.progress / 1000,
40-
color: "#" + m.color.toString(16),
41-
border: false,
42-
mode: m.mode === 4 || m.mode === 5 ? 1 : 0,
43-
}));
44-
}),
29+
danmuku: () => getDanMuAsync(danmuApi),
4530
}),
4631
],
4732
});

docs/OpenSw/Danmu.Server/assets/js/dplayerDemo.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ export default {
55
this.dp = new DPlayer({
66
container: this.$refs.dp,
77
video: {
8-
url: "/assets/video/s_720.mp4",
9-
thumbnails: "/assets/video/thumbnails.jpg",
8+
url: "https://danmu.u2sb.com/assets/video/1214946209-1-192.mp4",
109
},
1110
danmaku: {
12-
api: "https://danmu.u2sb.com/api/dplayer/",
11+
api: "https://danmu.u2sb.com/api/dp/bilibili/",
1312
id: "cENuyhsT2rMOCohK",
1413
addition: [
15-
"https://danmu.u2sb.com/api/dplayer/v3/bilibili/BV1zt411t79A",
14+
"https://danmu.u2sb.com/api/dp/bilibili/v3/BV1JP41167xK.json",
1615
],
1716
},
1817
});

docs/OpenSw/Danmu.Server/download-bilibili-danmu.md

-54
This file was deleted.

docs/OpenSw/Danmu.Server/dplayer-danmu.md

-43
Original file line numberDiff line numberDiff line change
@@ -10,49 +10,6 @@ redirectFrom:
1010

1111
适合 DPlayer 使用的弹幕
1212

13-
## API V3
14-
15-
### DPlayer 弹幕
16-
17-
#### API
18-
19-
- `/api/dplayer/`
20-
21-
#### 示例
22-
23-
- `https://danmu.u2sb.com/api/dplayer/`
24-
25-
### 解析 BiliBili 弹幕
26-
27-
#### 解释
28-
29-
- `id` aid 或 bvid,例如 `av810872``BV18b411j72u`
30-
- `p` 分 P,例如 `1` `2`,省略时默认为 `1`
31-
32-
#### API
33-
34-
- `/api/dplayer/v3/bilibili/{id}/{p:int?}`
35-
- `/api/dplayer/v3/bilibili/danmu/?bvid={id}&p={p}`
36-
37-
#### 示例
38-
39-
- `https://danmu.u2sb.com/api/dplayer/v3/bilibili/BV18b411j72u`
40-
- `https://danmu.u2sb.com/api/dplayer/v3/bilibili/danmu/?bvid=BV18b411j72u`
41-
42-
#### 返回
43-
44-
```json
45-
{
46-
"code": 0,
47-
"data": [
48-
[12.544, 0, 16777215, "3600fffd", "来了"],
49-
[7.739, 0, 16777215, "5689bb4c", "第一,截图见证"],
50-
[30.225, 0, 16777215, "b21ea9d5", "国风真美!!!"],
51-
[25.077, 0, 16777215, "260d013c", "好像真的是第一"]
52-
]
53-
}
54-
```
55-
5613
## 示例
5714

5815
::: details 点击查看

0 commit comments

Comments
 (0)