bilibili-API-collect/docs/user/contract.md
SocialSisterYi 7d89ece2ac
🚀调整项目结构
2023-02-22 01:00:06 +08:00

131 lines
3.6 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.

# 加入老粉计划
> https://api.bilibili.com/x/v1/contract/add_contract
*请求方式POST*
是否需要登录:`是`
认证方式Cookie(SESSDATA)
**正文参数 (application/x-www-form-urlencoded)**
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
|----------|-----|--------|-----|-----|
| aid | str | `空串` | | |
| up_mid | str | UP主UID | 必要 | |
| source | str | `4` | | |
| scene | str | `105` | | |
| platform | str | `web` | | |
| mobi_app | str | `pc` | | |
| csrf | str | 用户csrf | 必要 | |
**json回复**
根对象:
| 字段名 | 类型 | 内容 | 备注 |
|---------|-----|------|-------------------------|
| code | num | 响应码 | 0成功<br/>158001`不满足条件` |
| message | str | 0 | |
| ttl | num | 1 | |
| data | obj | 信息本体 | |
`data`对象
| 字段名 | 类型 | 内容 | 备注 |
|---------------|------|-----------------------------------|-----|
| allow_message | bool | `true` | |
| input_text | str | `UP主加油看好你噢` | |
| input_title | str | `感谢你对UP主的特别支持“老粉”可期私信留言鼓励下TA吧 ` | |
**示例:**
```shell
curl --location --request POST 'https://api.bilibili.com/x/v1/contract/add_contract' \
--header 'Cookie: SESSDATA=xxx' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'up_mid=2' \
--data-urlencode 'csrf=xxx'
```
<details>
<summary>点击查看</summary>
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"allow_message": true,
"input_text": "UP主加油看好你噢",
"input_title": "感谢你对UP主的特别支持“老粉”可期私信留言鼓励下TA吧 "
}
}
```
</details>
# 老粉计划发送留言
> https://api.bilibili.com/x/v1/contract/add_message
*请求方式POST*
认证方式Cookie (SESSDATA)
**正文参数 (application/x-www-form-urlencoded)**
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
|---------|-----|--------|-----|-----|
| aid | str | `空串` | | |
| up_mid | str | UP主UID | 必要 | |
| source | str | `4` | | |
| scene | str | `105` | | |
| content | str | 留言内容 | 必要 | |
| csrf | str | 用户csrf | 必要 | |
**json回复**
根对象:
| 字段名 | 类型 | 内容 | 备注 |
|---------|-----|------|------------------------------|
| code | num | 响应码 | 0成功<br/>158005您跟up主还不是契约关系 |
| message | str | 0 | |
| ttl | num | 1 | |
| data | obj | 信息本体 | |
`data`对象
| 字段名 | 类型 | 内容 | 备注 |
|---------------|-----|------------------|-----|
| success_toast | str | `提交成功UP主已收到留言~` | |
**示例:**
```shell
curl --location --request POST 'https://api.bilibili.com/x/v1/contract/add_message' \
--header 'Cookie: SESSDATA=xxx' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'up_mid=2' \
--data-urlencode 'content=..' \
--data-urlencode 'csrf=xxx'
```
<details>
<summary>点击查看</summary>
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"success_toast": "提交成功UP主已收到留言~"
}
}
```
</details>