2020-04-11 20:57:23 +08:00
|
|
|
|
# 发布动态
|
|
|
|
|
|
2022-10-24 14:57:02 +08:00
|
|
|
|
+ [为图片动态上传图片](#为图片动态上传图片)
|
|
|
|
|
|
2021-11-03 15:32:55 +08:00
|
|
|
|
+ [发表纯文本动态](#发表纯文本动态)
|
|
|
|
|
|
2022-10-24 14:57:02 +08:00
|
|
|
|
---
|
2021-11-03 15:32:55 +08:00
|
|
|
|
|
2022-10-24 14:57:02 +08:00
|
|
|
|
## 为图片动态上传图片
|
2020-04-11 20:57:23 +08:00
|
|
|
|
|
2022-10-24 14:57:02 +08:00
|
|
|
|
> http://api.bilibili.com/x/dynamic/feed/draw/upload_bfs
|
2020-04-11 20:57:23 +08:00
|
|
|
|
|
2020-07-14 18:44:44 +08:00
|
|
|
|
*请求方式:POST*
|
2020-04-11 20:57:23 +08:00
|
|
|
|
|
2020-07-18 23:56:10 +08:00
|
|
|
|
认证方式:Cookie(SESSDATA)
|
2020-04-11 20:57:23 +08:00
|
|
|
|
|
|
|
|
|
注意:非日常类型像素宽高必须大于420
|
|
|
|
|
|
2022-10-24 14:57:02 +08:00
|
|
|
|
**正文参数 (multipart/form-data):**
|
2020-04-11 20:57:23 +08:00
|
|
|
|
|
2022-10-24 14:57:02 +08:00
|
|
|
|
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
|
|
|
|
|
| -------- | ---- | ------------------------ | ------ | ------------------------------------------------------------ |
|
|
|
|
|
| file_up | file | 需要上传的图片文件 | 必要 | 格式仅支持jpg png gif |
|
|
|
|
|
| category | str | 图片类型 | 必要 | daily:日常(动态)<br />draw:绘画(画友)<br />cos:摄影(COSPLAY) |
|
|
|
|
|
| biz | str | | | |
|
|
|
|
|
| csrf | str | CSRF Token(位于cookie) | 必要 | |
|
2020-04-11 20:57:23 +08:00
|
|
|
|
|
|
|
|
|
**json回复:**
|
|
|
|
|
|
2020-04-16 18:47:19 +08:00
|
|
|
|
根对象:
|
|
|
|
|
|
2020-04-11 20:57:23 +08:00
|
|
|
|
| 字段 | 类型 | 内容 | 备注 |
|
|
|
|
|
| ------- | ---- | -------- | ------------------------------------------------------------ |
|
|
|
|
|
| code | num | 返回值 | 0:成功 <br />-1:未添加图片<br />-2:参数错误<br />-3:图片尺寸过小<br />-4:账号未登录<br />-7:图片信息错误 |
|
|
|
|
|
| message | str | 错误信息 | 默认为success |
|
|
|
|
|
| data | obj | 信息本体 | 仅在正确时既`code=0`时为有效信息 |
|
|
|
|
|
|
|
|
|
|
`data`对象:
|
|
|
|
|
|
|
|
|
|
| 字段 | 类型 | 内容 | 备注 |
|
|
|
|
|
| ------------ | ---- | -------------- | ---- |
|
2020-12-17 20:37:55 +08:00
|
|
|
|
| image_url | str | 已上传图片url | |
|
2020-04-11 20:57:23 +08:00
|
|
|
|
| image_width | num | 已上传图片宽度 | 像素 |
|
|
|
|
|
| image_height | num | 已上传图片高度 | 像素 |
|
|
|
|
|
|
2022-10-24 14:57:02 +08:00
|
|
|
|
**示例:**
|
2020-04-11 20:57:23 +08:00
|
|
|
|
|
|
|
|
|
上传了一张图片`test.png`类型为`日常`
|
|
|
|
|
|
2020-07-18 23:56:10 +08:00
|
|
|
|
```shell
|
2022-10-24 14:57:02 +08:00
|
|
|
|
curl 'http://api.bilibili.com/x/dynamic/feed/draw/upload_bfs' \
|
2020-10-16 19:31:41 +08:00
|
|
|
|
-F 'file_up=@test.png' \
|
2020-07-18 23:56:10 +08:00
|
|
|
|
-F 'category=daily'
|
|
|
|
|
-b 'SESSDATA=xxx'
|
|
|
|
|
```
|
2020-04-11 20:57:23 +08:00
|
|
|
|
|
2020-08-31 16:37:38 +08:00
|
|
|
|
<details>
|
|
|
|
|
<summary>查看响应示例:</summary>
|
|
|
|
|
|
2020-04-11 20:57:23 +08:00
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"code":0,
|
|
|
|
|
"message":"success",
|
|
|
|
|
"data":{
|
2022-10-24 14:57:02 +08:00
|
|
|
|
"image_url":"http:\/\/i0.hdslb.com\/bfs\/album\/13f9523efe186a8066b2d72e80283cea2437eb62.png",
|
2020-04-11 20:57:23 +08:00
|
|
|
|
"image_width":1225,
|
|
|
|
|
"image_height":850
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2020-08-31 16:37:38 +08:00
|
|
|
|
</details>
|
2021-11-03 15:32:55 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 发表纯文本动态
|
|
|
|
|
|
|
|
|
|
> http://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/create
|
|
|
|
|
|
|
|
|
|
*请求方式:POST*
|
|
|
|
|
|
2022-10-24 14:57:02 +08:00
|
|
|
|
认证方式:Cookie (SESSDATA)
|
2021-11-03 15:32:55 +08:00
|
|
|
|
|
|
|
|
|
**正文参数(multipart/form-data):**
|
|
|
|
|
|
2022-10-24 14:57:02 +08:00
|
|
|
|
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
|
|
|
|
|
| --- | --- | --- | --- | --- |
|
|
|
|
|
| dynamic_id | num | 0 | 必要 | |
|
|
|
|
|
| type | num | 4 | 必要 | |
|
|
|
|
|
| rid | num | 0 | 必要 | |
|
|
|
|
|
| content | str | 动态内容 | 必要 | |
|
|
|
|
|
| up_choose_comment | num | 0 | 非必要 | |
|
|
|
|
|
| up_close_comment | num | 0 | 非必要 | |
|
|
|
|
|
| extension | json | 位置信息 | 非必要 | |
|
|
|
|
|
| at_uids | str | 动态中 at 到的用户的 uid | 非必要 | 使用逗号`,`分隔 |
|
|
|
|
|
| ctrl | array | 特殊格式控制 (如 at 别人时的蓝字体和链接) | 非必要 | |
|
|
|
|
|
| csrf_token | str | CSRF Token (位于 cookie) | 非必要 | |
|
|
|
|
|
| csrf | str | CSRF Token (位于 cookie) | 非必要 | |
|
2021-11-03 15:32:55 +08:00
|
|
|
|
|
|
|
|
|
extension参数值:
|
|
|
|
|
```json
|
2022-07-13 15:15:18 +08:00
|
|
|
|
{"emoji_type":1,"lbs_cfg":{"title":"**市","poi":"156330200","show_title":"**市","type":1,"address":"**市","location":{"lng":显示的经度数值,"lat":显示的纬度数值},"distance":0},"flag_cfg":{},"from_cfg":{"location":{"lat":用户实际纬度数值,"lng":用户实际经度数值}}}
|
2021-11-03 15:32:55 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
ctrl单个对象(注意用的时候是数组出现):
|
|
|
|
|
| 参数名 | 类型 | 内容 |
|
|
|
|
|
| --- | --- | --- |
|
|
|
|
|
| location | num | 从全文第几个字开始变蓝 |
|
|
|
|
|
| type | num | 1 (可能1代表链接到用户uid) |
|
|
|
|
|
| length | num | 这一段变蓝多少字 |
|
|
|
|
|
| data | str | 链接目标(被at人的uid) |
|
|
|
|
|
|
|
|
|
|
**json回复:**
|
|
|
|
|
|
|
|
|
|
根对象:
|
|
|
|
|
|
2022-10-24 14:57:02 +08:00
|
|
|
|
| 字段 | 类型 | 内容 | 备注 |
|
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
|
| code | num | 返回值 | 0:成功 |
|
|
|
|
|
| message | str | 错误信息 | 成功为空 |
|
|
|
|
|
| data | obj | 数据本体 | |
|
2021-11-03 15:32:55 +08:00
|
|
|
|
|
2022-10-24 14:57:02 +08:00
|
|
|
|
`data`对象:
|
2021-11-03 15:32:55 +08:00
|
|
|
|
|
2022-10-24 14:57:02 +08:00
|
|
|
|
| 字段 | 类型 | 内容 | 备注 |
|
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
|
| result | num | 0 | |
|
|
|
|
|
| errmsg | str | 像是服务器日志一样的东西 | |
|
|
|
|
|
| dynamic_id | num | 动态 id | |
|
|
|
|
|
| create_result | num | 1 | |
|
|
|
|
|
| dynamic_id_str | str | 动态 id | 字符串格式 |
|
|
|
|
|
| \_gt_ | num | 0 | |
|
2021-11-03 15:32:55 +08:00
|
|
|
|
|
|
|
|
|
<details>
|
|
|
|
|
<summary>查看示例(纯文本)</summary>
|
|
|
|
|
|
|
|
|
|
```bash
|
2022-10-24 14:57:02 +08:00
|
|
|
|
curl 'http://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/create' \
|
|
|
|
|
--data-urlencode 'dynamic_id=0' \
|
|
|
|
|
--data-urlencode 'type=4' \
|
|
|
|
|
--data-urlencode 'rid=0' \
|
|
|
|
|
--data-urlencode 'content=Hello Bug~' \
|
|
|
|
|
--data-urlencode 'up_choose_comment=0' \
|
|
|
|
|
--data-urlencode 'up_close_comment=0' \
|
|
|
|
|
--data-urlencode 'extension={"emoji_type":1,"from":{"emoji_type":1},"flag_cfg":{}}' \
|
|
|
|
|
--data-urlencode 'at_uids=' \
|
|
|
|
|
--data-urlencode 'ctrl=[]' \
|
|
|
|
|
--data-urlencode 'csrf_token=de2731532b4ab96bc8536da948932668' \
|
|
|
|
|
--data-urlencode 'csrf=de2731532b4ab96bc8536da948932668' \
|
|
|
|
|
-b 'SESSDATA=******'
|
2021-11-03 15:32:55 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"code": 0,
|
|
|
|
|
"msg": "",
|
|
|
|
|
"message": "",
|
|
|
|
|
"data": {
|
|
|
|
|
"result": 0,
|
|
|
|
|
"errmsg": "; Create dynamic:588320531406678918, res:0, result:1; Push create kafka:0; Push create databus:0; Register comment result:0; Add outbox result:1",
|
|
|
|
|
"dynamic_id": 588320531406678918,
|
|
|
|
|
"create_result": 1,
|
|
|
|
|
"dynamic_id_str": "588320531406678918",
|
|
|
|
|
"_gt_": 0
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
|
|
<details>
|
|
|
|
|
<summary>查看示例(at两个人)</summary>
|
|
|
|
|
|
|
|
|
|
动态正文
|
|
|
|
|
```
|
|
|
|
|
[热词系列_神仙UP]@暮光小猿wzt @社会易姐QwQ
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
at_uids
|
|
|
|
|
```
|
|
|
|
|
15858903,293793435
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
ctrl
|
|
|
|
|
```json
|
|
|
|
|
[
|
|
|
|
|
{ "location": 11, "type": 1, "length": 9, "data": "15858903" },
|
|
|
|
|
{ "location": 20, "type": 1, "length": 9, "data": "293793435" }
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
命令
|
|
|
|
|
```bash
|
2022-10-24 14:57:02 +08:00
|
|
|
|
curl 'http://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/create' \
|
|
|
|
|
--data-urlencode 'dynamic_id': '0' \
|
|
|
|
|
--data-urlencode 'type': '4' \
|
|
|
|
|
--data-urlencode 'rid': '0' \
|
|
|
|
|
--data-urlencode 'content': '[热词系列_神仙UP]@暮光小猿wzt @社会易姐QwQ ' \
|
|
|
|
|
--data-urlencode 'up_choose_comment': '0' \
|
|
|
|
|
--data-urlencode 'up_close_comment': '0' \
|
|
|
|
|
--data-urlencode 'extension': '{"emoji_type":1,"from":{"emoji_type":1},"flag_cfg":{}}' \
|
|
|
|
|
--data-urlencode 'at_uids': '15858903,293793435' \
|
|
|
|
|
--data-urlencode 'ctrl': '[{"location":11,"type":1,"length":9,"data":"15858903"},{"location":20,"type":1,"length":9,"data":"293793435"}]' \
|
|
|
|
|
--data-urlencode 'csrf_token': 'de2731532b4ab96bc8536da948932668' \
|
|
|
|
|
--data-urlencode 'csrf': 'de2731532b4ab96bc8536da948932668' \
|
|
|
|
|
-b 'SESSDATA=******'
|
2021-11-03 15:32:55 +08:00
|
|
|
|
```
|
|
|
|
|
|
2022-07-13 15:15:18 +08:00
|
|
|
|
</details>
|