2020-03-06 17:23:49 +08:00
|
|
|
|
# 视频快照
|
|
|
|
|
|
|
|
|
|
## 获取视频快照1(用于进度条预览)
|
|
|
|
|
api.bilibili.com/x/player/videoshot
|
|
|
|
|
|
|
|
|
|
*方式:GET*
|
|
|
|
|
|
|
|
|
|
参数:
|
|
|
|
|
| 参数名 | 内容 | 必要性 | 备注 |
|
|
|
|
|
| ------ | ------------------ | ------ | ------------- |
|
|
|
|
|
| aid | 视频avID | 必要 | |
|
|
|
|
|
| cid | 分P CID | 非必要 | 无为1P |
|
|
|
|
|
| index | json数组截取时间表 | 非必要 | 1需要 0不需要 |
|
|
|
|
|
|
|
|
|
|
**json回复:**
|
|
|
|
|
|
|
|
|
|
| 字段 | 类型 | 内容 | 备注 |
|
|
|
|
|
| ------- | ---- | -------- | -------------------------------- |
|
|
|
|
|
| code | num | 返回值 | 0成功 40001请求错误 40003无视频 |
|
|
|
|
|
| message | str | 错误信息 | 默认为0 |
|
|
|
|
|
| ttl | num | 1 | 作用尚不明确 |
|
|
|
|
|
| data | obj | 信息本体 | |
|
|
|
|
|
|
|
|
|
|
data 对象:
|
|
|
|
|
|
|
|
|
|
| 字段 | 类型 | 内容 | 备注 |
|
|
|
|
|
| ---------- | ----- | ---------------------- | --------- |
|
|
|
|
|
| pvdata | str | bin格式截取时间表url | |
|
|
|
|
|
| img_x_len | num | 每行图片数 | 一般为10 |
|
|
|
|
|
| img_y_len | num | 每列图片数 | 一般为10 |
|
|
|
|
|
| img_x_size | num | 每张图片长 | 一般为160 |
|
|
|
|
|
| img_y_size | num | 每张图片宽 | 一般为90 |
|
|
|
|
|
| image | array | 图片拼版 | |
|
|
|
|
|
| index | array | json数组格式截取时间表 | 无为空 |
|
|
|
|
|
|
|
|
|
|
image 数组(类型:str):
|
|
|
|
|
|
|
|
|
|
| 项 | 内容 | 备注 |
|
|
|
|
|
| ---- | ----------------- | -------------------------- |
|
|
|
|
|
| 0 | 图片拼版1 url | jpg |
|
|
|
|
|
| n | 图片拼版(n+1) url | 第一张拼版占满时延续第二张 |
|
|
|
|
|
| …… | …… | …… |
|
|
|
|
|
|
|
|
|
|
index 数组(类型:num):
|
|
|
|
|
|
|
|
|
|
| 项 | 内容 | 备注 |
|
|
|
|
|
| ---- | --------------- | --------------- |
|
|
|
|
|
| 0 | 恒为0 | |
|
|
|
|
|
| 1 | 图片1 截取时间 | 视频0秒截取时间 |
|
|
|
|
|
| n | 图片n 截取时间 | 单位为秒 |
|
|
|
|
|
| …… | …… | 单位为秒 |
|
|
|
|
|
|
|
|
|
|
示例:
|
|
|
|
|
|
|
|
|
|
http://api.bilibili.com/x/player/videoshot?aid=26273789&index=1
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"code": 0,
|
|
|
|
|
"message": "0",
|
|
|
|
|
"ttl": 1,
|
|
|
|
|
"data": {
|
|
|
|
|
"pvdata": "//i0.hdslb.com/bfs/videoshot/49075258.bin",
|
|
|
|
|
"img_x_len": 10,
|
|
|
|
|
"img_y_len": 10,
|
|
|
|
|
"img_x_size": 160,
|
|
|
|
|
"img_y_size": 90,
|
|
|
|
|
"image": ["//i0.hdslb.com/bfs/videoshot/49075258.jpg", "//i0.hdslb.com/bfs/videoshot/49075258-1.jpg"],
|
|
|
|
|
"index": [0, 0, 8, 14, 19, 25, 34, 40, 46, 56, 63, 70, 80, 87, 93, 100, 109, 117, 124, 133, 142, 148, 156, 164, 171, 179, 184, 192, 198, 206, 214, 223, 232, 239, 246, 254, 261, 269, 275, 283, 289, 299, 305, 310, 315, 322, 330, 339, 348, 358, 364, 371, 376, 382, 391, 404, 413, 421, 426, 434, 441, 452, 458, 463, 473, 479, 491, 497, 504, 514, 521, 528, 533, 540, 546, 552, 558, 567, 575, 586, 591, 602, 609, 615, 623, 629, 639, 647, 653, 658, 664, 670, 675, 684, 691, 698, 713, 724, 729, 737, 743, 754, 762, 772, 779, 784, 797, 803, 810, 817, 825, 834, 845, 851, 857, 867, 878, 888, 896, 903, 909, 914, 919, 928, 935, 944, 958, 970, 977, 988, 996, 1004, 1011, 1018, 1026, 1035, 1041, 1048, 1055, 1063, 1073, 1079, 1086, 1095, 1106, 1111, 1124, 1135, 1147, 1153, 1159, 1165, 1171, 1184, 1198, 1209, 1215, 1221, 1228, 1236, 1242, 1253, 1258, 1269, 1276, 1284, 1289, 1300, 1306, 1315, 1321, 1328, 1340, 1347, 1354, 1361, 1366, 1371, 1383, 1390, 1396, 1403, 1415]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 获取视频快照2 (用于封面预览)
|
|
|
|
|
|
|
|
|
|
api.bilibili.com/pvideo
|
|
|
|
|
*方式:GET*
|
|
|
|
|
|
|
|
|
|
内容与「获取视频快照1」加参数「index」=1相同,但url带有转义,仅限第1P
|
|
|
|
|
|
|
|
|
|
| 参数名 | 内容 | 必要性 | 备注 |
|
|
|
|
|
| ------ | -------- | ------ | ---- |
|
|
|
|
|
| aid | 视频avID | 必要 | |
|
|
|
|
|
|
|
|
|
|
**json回复:**
|
|
|
|
|
|
|
|
|
|
| 字段 | 类型 | 内容 | 备注 |
|
|
|
|
|
| ------- | ---- | -------- | ------------------------------- |
|
|
|
|
|
| code | num | 返回值 | 0成功 40001请求错误 -404无视频 |
|
|
|
|
|
| message | str | 错误信息 | 默认为0 |
|
|
|
|
|
| ttl | num | 1 | 作用尚不明确 |
|
|
|
|
|
| data | obj | 信息本体 | |
|
|
|
|
|
|
|
|
|
|
data 对象:
|
|
|
|
|
|
|
|
|
|
| 字段 | 类型 | 内容 | 备注 |
|
|
|
|
|
| ---------- | ----- | ---------------------- | --------- |
|
|
|
|
|
| pvdata | str | bin格式截取时间表url | |
|
|
|
|
|
| img_x_len | num | 每行图片数 | 一般为10 |
|
|
|
|
|
| img_y_len | num | 每列图片数 | 一般为10 |
|
|
|
|
|
| img_x_size | num | 每张图片长 | 一般为160 |
|
|
|
|
|
| img_y_size | num | 每张图片宽 | 一般为90 |
|
|
|
|
|
| image | array | 图片拼版 | |
|
|
|
|
|
| index | array | json数组格式截取时间表 | 无为空 |
|
|
|
|
|
|
|
|
|
|
image 数组(类型:str):
|
|
|
|
|
|
|
|
|
|
| 项 | 内容 | 备注 |
|
|
|
|
|
| ---- | ----------------- | -------------------------- |
|
|
|
|
|
| 0 | 图片拼版1 url | jpg |
|
|
|
|
|
| n | 图片拼版(n+1) url | 第一张拼版占满时延续第二张 |
|
|
|
|
|
| …… | …… | …… |
|
|
|
|
|
|
|
|
|
|
index 数组(类型:num):
|
|
|
|
|
|
|
|
|
|
| 项 | 内容 | 备注 |
|
|
|
|
|
| ---- | --------------- | --------------- |
|
|
|
|
|
| 0 | 恒为0 | |
|
|
|
|
|
| 1 | 图片1 截取时间 | 视频0秒截取时间 |
|
|
|
|
|
| n | 图片n 截取时间 | 单位为秒 |
|
|
|
|
|
| …… | …… | 单位为秒 |
|
|
|
|
|
|
|
|
|
|
示例:
|
|
|
|
|
|
|
|
|
|
http://api.bilibili.com/pvideo?aid=26273789
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"code": 0,
|
|
|
|
|
"message": "0",
|
|
|
|
|
"ttl": 1,
|
|
|
|
|
"data": {
|
|
|
|
|
"pvdata": "\/\/i0.hdslb.com\/bfs\/videoshot\/49075258.bin",
|
|
|
|
|
"img_x_len": 10,
|
|
|
|
|
"img_y_len": 10,
|
|
|
|
|
"img_x_size": 160,
|
|
|
|
|
"img_y_size": 90,
|
|
|
|
|
"image": ["\/\/i0.hdslb.com\/bfs\/videoshot\/49075258.jpg", "\/\/i0.hdslb.com\/bfs\/videoshot\/49075258-1.jpg"],
|
|
|
|
|
"index": [0, 0, 8, 14, 19, 25, 34, 40, 46, 56, 63, 70, 80, 87, 93, 100, 109, 117, 124, 133, 142, 148, 156, 164, 171, 179, 184, 192, 198, 206, 214, 223, 232, 239, 246, 254, 261, 269, 275, 283, 289, 299, 305, 310, 315, 322, 330, 339, 348, 358, 364, 371, 376, 382, 391, 404, 413, 421, 426, 434, 441, 452, 458, 463, 473, 479, 491, 497, 504, 514, 521, 528, 533, 540, 546, 552, 558, 567, 575, 586, 591, 602, 609, 615, 623, 629, 639, 647, 653, 658, 664, 670, 675, 684, 691, 698, 713, 724, 729, 737, 743, 754, 762, 772, 779, 784, 797, 803, 810, 817, 825, 834, 845, 851, 857, 867, 878, 888, 896, 903, 909, 914, 919, 928, 935, 944, 958, 970, 977, 988, 996, 1004, 1011, 1018, 1026, 1035, 1041, 1048, 1055, 1063, 1073, 1079, 1086, 1095, 1106, 1111, 1124, 1135, 1147, 1153, 1159, 1165, 1171, 1184, 1198, 1209, 1215, 1221, 1228, 1236, 1242, 1253, 1258, 1269, 1276, 1284, 1289, 1300, 1306, 1315, 1321, 1328, 1340, 1347, 1354, 1361, 1366, 1371, 1383, 1390, 1396, 1403, 1415]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 图片拼版
|
|
|
|
|
|
|
|
|
|
以160x90像素为一张,横向10张,纵向10张,从左到右从上到下进行裁剪
|
|
|
|
|
|
|
|
|
|
图1为0s,图2为8s,图3为14s,以此类推……
|
|
|
|
|
|
2020-03-07 16:14:18 +08:00
|
|
|
|
快照的截取时间根据视频画面变化程度决定,每个视频各不相同
|
|
|
|
|
|
2020-03-06 17:23:49 +08:00
|
|
|
|
示例拼版图片url:http://i0.hdslb.com/bfs/videoshot/49075258.jpg
|
|
|
|
|
|
|
|
|
|
![](http://i0.hdslb.com/bfs/videoshot/49075258.jpg)
|
|
|
|
|
|
|
|
|
|
## bin格式截取时间表
|
|
|
|
|
|
2020-03-07 16:14:18 +08:00
|
|
|
|
截取时间表的时间根据视频画面变化程度决定,每个视频各不相同
|
|
|
|
|
|
2020-03-06 17:23:49 +08:00
|
|
|
|
bin的内容为uint16数组,与json数组格式一一对应
|
|
|
|
|
|
|
|
|
|
0第项恒为0,从第1项开始作为截取图片的时间(秒)
|
|
|
|
|
|
|
|
|
|
示例bin格式截取时间表url:http://i0.hdslb.com/bfs/videoshot/49075258.bin
|
|
|
|
|
|
|
|
|
|
```
|
2020-03-07 16:14:18 +08:00
|
|
|
|
00h 0000 0000 0008 000E 0013 0019 0022 0028
|
|
|
|
|
01h 002E 0038 003F 0046 0050 0057 005D 0064
|
|
|
|
|
02h 006D 0075 007C 0085 008E 0094 009C 00A4
|
|
|
|
|
03h 00AB 00B3 00B8 00C0 00C6 00CE 00D6 00DF
|
|
|
|
|
04h 00E8 00EF 00F6 00FE 0105 010D 0113 011B
|
|
|
|
|
05h 0121 012B 0131 0136 013B 0142 014A 0153
|
|
|
|
|
06h 015C 0166 016C 0173 0178 017E 0187 0194
|
|
|
|
|
07h 019D 01A5 01AA 01B2 01B9 01C4 01CA 01CF
|
|
|
|
|
08h 01D9 01DF 01EB 01F1 01F8 0202 0209 0210
|
|
|
|
|
09h 0215 021C 0222 0228 022E 0237 023F 024A
|
|
|
|
|
0Ah 024F 025A 0261 0267 026F 0275 027F 0287
|
|
|
|
|
0Bh 028D 0292 0298 029E 02A3 02AC 02B3 02BA
|
|
|
|
|
0Ch 02C9 02D4 02D9 02E1 02E7 02F2 02FA 0304
|
|
|
|
|
0Dh 030B 0310 031D 0323 032A 0331 0339 0342
|
|
|
|
|
0Eh 034D 0353 0359 0363 036E 0378 0380 0387
|
|
|
|
|
0Fh 038D 0392 0397 03A0 03A7 03B0 03BE 03CA
|
|
|
|
|
10h 03D1 03DC 03E4 03EC 03F3 03FA 0402 040B
|
|
|
|
|
11h 0411 0418 041F 0427 0431 0437 043E 0447
|
|
|
|
|
12h 0452 0457 0464 046F 047B 0481 0487 048D
|
|
|
|
|
13h 0493 04A0 04AE 04B9 04BF 04C5 04CC 04D4
|
|
|
|
|
14h 04DA 04E5 04EA 04F5 04FC 0504 0509 0514
|
|
|
|
|
15h 051A 0523 0529 0530 053C 0543 054A 0551
|
|
|
|
|
16h 0556 055B 0567 056E 0574 057B 0587
|
|
|
|
|
|
2020-03-06 17:23:49 +08:00
|
|
|
|
```
|
|
|
|
|
|