2020-04-11 20:57:23 +08:00
|
|
|
|
# 发布动态
|
|
|
|
|
|
2020-07-14 18:44:44 +08:00
|
|
|
|
## 为图片动态(相簿)上传图片
|
2020-04-11 20:57:23 +08:00
|
|
|
|
|
|
|
|
|
> http://api.vc.bilibili.com/api/v1/drawImage/upload
|
|
|
|
|
|
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
|
|
|
|
|
|
2020-06-08 22:44:46 +08:00
|
|
|
|
**正文参数(multipart/form-data):**
|
2020-04-11 20:57:23 +08:00
|
|
|
|
|
|
|
|
|
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
|
|
|
|
|
| -------- | ---- | ------------------ | ------ | ------------------------------------------------------------ |
|
2020-06-08 22:44:46 +08:00
|
|
|
|
| file_up | file | 需要上传的图片文件 | 必要 | 格式仅支持jpg png gif |
|
|
|
|
|
| category | str | 图片类型 | 必要 | daily:日常(动态)<br />draw:绘画(画友)<br />cos:摄影(COSPLAY) |
|
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 | 已上传图片高度 | 像素 |
|
|
|
|
|
|
|
|
|
|
示例:
|
|
|
|
|
|
|
|
|
|
上传了一张图片`test.png`类型为`日常`
|
|
|
|
|
|
2020-07-18 23:56:10 +08:00
|
|
|
|
```shell
|
2020-10-16 19:31:41 +08:00
|
|
|
|
curl 'http://api.vc.bilibili.com/api/v1/drawImage/upload' \
|
|
|
|
|
-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":{
|
2020-07-18 23:56:10 +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>
|