bilibili-API-collect/article/info.md

171 lines
6.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 专栏基本信息
- [获取专栏文章基本信息](#获取专栏文章基本信息)
---
## 获取专栏文章基本信息
> http://api.bilibili.com/x/article/viewinfo
*请求方式GET*
认证方式CookieSESSDATA
**url参数**
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| ------ | ---- | -------- | ------ | ---- |
| id | num | 专栏cvid | 必要 | |
**json回复**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | ----------------------------------------------- |
| code | num | 返回值 | 0成功<br />-400请求错误<br />-404无此信息 |
| message | str | 错误信息 | 默认为0 |
| ttl | num | 1 | |
| data | obj | 信息本体 | |
`data`对象:
| 字段 | 类型 | 内容 | 备注 |
| ----------------- | ------ | ---------------- | ------------------------------------------------------------ |
| like | num | 是否点赞 | 0未点赞<br />1已点赞<br />需要登录(Cookie) <br />未登录为0 |
| attention | bool | 是否关注文章作者 | false未关注<br />true已关注<br />需要登录(Cookie) <br />未登录为false |
| favorite | bool | 是否收藏 | false未收藏<br />true已收藏<br />需要登录(Cookie) <br />未登录为false |
| coin | num | 为文章投币数 | |
| stats | obj | 状态数信息 | |
| title | str | 文章标题 | |
| banner_url | str | 文章头图url | |
| mid | num | 文章作者mid | |
| author_name | str | 文章作者昵称 | |
| is_author | bool | true | 作用尚不明确 |
| image_urls | array | 动态封面 | |
| origin_image_urls | array | 封面图片 | |
| shareable | bool | true | 作用尚不明确 |
| show_later_watch | bool | true | 作用尚不明确 |
| show_small_window | bool | true | 作用尚不明确 |
| in_list | bool | 是否收于文集 | false<br />true是 |
| pre | num | 上一篇文章cvid | 无为0 |
| next | num | 下一篇文章cvid | 无为0 |
| share_channels | array | 分享方式列表 | |
`stats`对象:
| 字段 | 类型 | 内容 | 备注 |
| -------- | ---- | ---------- | ---- |
| view | num | 阅读数 | |
| favorite | num | 收藏数 | |
| like | num | 点赞数 | |
| dislike | num | 点踩数 | |
| reply | num | 评论数 | |
| share | num | 分享数 | |
| coin | num | 投币数 | |
| dynamic | num | 动态转发数 | |
`data`中的`image_urls`数组:
| 项 | 类型 | 内容 | 备注 |
| ---- | ---- | --------------- | ---- |
| 0 | str | 动态封面图片url | |
`data`中的`origin_image_urls`数组:
| 项 | 类型 | 内容 | 备注 |
| ---- | ---- | --------------- | ---- |
| 0 | str | 文章封面图片url | |
`data`中的`share_channels`数组:
| 项 | 类型 | 内容 | 备注 |
| ---- | ---- | -------------- | ---- |
| 0 | obj | 分享项qq | |
| 1 | obj | 分享项qq空间 | |
| 2 | obj | 分享项:微信 | |
| 3 | obj | 分享项:朋友圈 | |
| 4 | obj | 分享项:微博 | |
`data`中的`share_channels`数组中的对象:
| 字段 | 类型 | 内容 | 备注 |
| ------------- | ---- | ----------- | ---- |
| name | str | 分享名称 | |
| picture | str | 分享图片url | |
| share_channel | str | 分享代号 | |
**示例:**
查询文章`cv2`的基本信息
```shell
curl -G 'http://api.bilibili.com/x/article/viewinfo' \
--data-urlencode 'id=2' \
-b 'SESSDATA=xxx'
```
<details>
<summary>查看响应示例:</summary>
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"like": 1,
"attention": true,
"favorite": false,
"coin": 0,
"stats": {
"view": 317712,
"favorite": 3249,
"like": 10176,
"dislike": 0,
"reply": 1333,
"share": 302,
"coin": 2002,
"dynamic": 28
},
"title": "专栏行为准则 ",
"banner_url": "https://i0.hdslb.com/bfs/article/131b1d41b857d5308f5bff36591d117bddc48d96.jpg@90p.webp",
"mid": 144900660,
"author_name": "专栏小天使",
"is_author": true,
"image_urls": ["https://i0.hdslb.com/bfs/article/0a72422ce8e77d8512f010d93b1b7f9bc4e64e52.jpg"],
"origin_image_urls": ["https://i0.hdslb.com/bfs/article/131b1d41b857d5308f5bff36591d117bddc48d96.jpg"],
"shareable": true,
"show_later_watch": true,
"show_small_window": true,
"in_list": false,
"pre": 115914,
"next": 38575,
"share_channels": [{
"name": "QQ",
"picture": "https://i0.hdslb.com/bfs/album/114ccfb3a999df9c4d11f274c8c61a804c8f8803.png",
"share_channel": "QQ"
}, {
"name": "QQ空间",
"picture": "https://i0.hdslb.com/bfs/album/30e9608bbce725bca45b5910866f60ab4d5e18b3.png",
"share_channel": "QZONE"
}, {
"name": "微信",
"picture": "https://i0.hdslb.com/bfs/album/658af3c22431cd78bb7c50be3394f7c032eba12c.png",
"share_channel": "WEIXIN"
}, {
"name": "朋友圈",
"picture": "https://i0.hdslb.com/bfs/album/c1ebcec8c5302f29f792d15f04e0d6dcef53ec27.png",
"share_channel": "WEIXIN_MONMENT"
}, {
"name": "微博",
"picture": "https://i0.hdslb.com/bfs/album/3707fc23f7d3e24022712320284b0de9aa78c87d.png",
"share_channel": "SINA"
}]
}
}
```
</details>