Skip to content

Latest commit

 

History

History
253 lines (161 loc) · 5.98 KB

weibo.md

File metadata and controls

253 lines (161 loc) · 5.98 KB

API 文档

微博

添加账号

  • 功能说明

用于添加微博网页版账号,cookie从https://weibo.com/的请求中获取。

  • URL

    /weibo/add_account

  • Method

    POST

  • Data Params

参数 必选 类型 说明
id true string 账户名(用于管理用户cookie)
cookie true string 微博cookie
  • Response
参数 必选 类型 说明
code true int 0: 成功 1: 参数错误 2: 服务器错误
data true struct 数据
msg true string 请求说明(成功、参数错误、服务器错误)

过期账号

  • 功能说明

用于标记账号过期,之后不再使用该账号发送请求。

  • URL

    /weibo/expire_account

  • Method

    POST

  • Data Params

参数 必选 类型 说明
id true string 账户名(用于管理用户cookie)
  • Response
参数 必选 类型 说明
code true int 0: 成功 1: 参数错误 2: 服务器错误
data true struct 数据
msg true string 请求说明(成功、参数错误、服务器错误)

获取账号列表

  • URL

    /weibo/account_list

  • Method

    GET

  • URL Params

    None

  • Response

参数 必选 类型 说明
code true int 0: 成功 1: 参数错误 2: 服务器错误
data true list [ 账户信息 ]
msg true string 请求说明(成功、参数错误、服务器错误)

账户信息

参数 必选 类型 说明
id true string 账户名(用于管理用户cookie)
cookie true string 微博cookie
ct true int 创建时间戳
ut true int 更新时间戳
expired true int 0: 有效 1: 过期 (请求失败时自动设为过期)

获取微博详情

  • 功能说明

由于微博允许游客访问,因此此接口可以不需要添加账号,直接调用。

  • URL

    /weibo/detail

  • Method

    GET

  • URL Params

参数 必选 类型 说明
id true string 微博id,从https://m.weibo.cn/找到需要的帖子打开详情页,url中detail/后面的数字就是id
  • Success Response
参数 必选 类型 说明
code true int 0: 成功 1: 参数错误 2: 服务器错误
data true struct 数据
msg true string 请求说明(成功、参数错误、服务器错误)

获取微博评论

  • URL

    /weibo/comments

  • Method

    GET

  • URL Params

参数 必选 类型 说明
id true string 微博id,从https://m.weibo.cn/找到需要的帖子打开详情页,url中detail/后面的数字就是id
offset false int 评论翻页偏移量, 默认0
limit false int 评论数量, 默认20
  • Success Response
参数 必选 类型 说明
code true int 0: 成功 1: 参数错误 2: 服务器错误
data true struct 数据
msg true string 请求说明(成功、参数错误、服务器错误)

获取评论回复

  • URL

    /weibo/replys

  • Method

    GET

  • URL Params

参数 必选 类型 说明
id true string 微博id,从https://m.weibo.cn/找到需要的帖子打开详情页,url中detail/后面的数字就是id
comment_id true string 微博评论id,从评论中获得到的id,例如: 5045096886306039
offset false int 评论翻页偏移量, 默认0
limit false int 评论数量, 默认20
  • Success Response
参数 必选 类型 说明
code true int 0: 成功 1: 参数错误 2: 服务器错误
data true struct 数据
msg true string 请求说明(成功、参数错误、服务器错误)

关键词搜索微博

  • URL

    /weibo/search

  • Method

    GET

  • URL Params

参数 必选 类型 说明
keyword true string 搜索词
offset false int 搜索翻页偏移量, 默认0
limit false int 结果数量, 默认10
  • Success Response
参数 必选 类型 说明
code true int 0: 成功 1: 参数错误 2: 服务器错误
data true struct 数据
msg true string 请求说明(成功、参数错误、服务器错误)

微博媒体预览

  • 功能说明

由于微博所有接口返回的媒体资源链接均验证了referer,因此不能直接在网页中预览,此接口提供了预览功能,用法为http://127.0.0.1:8080/weibo/preview?url=xxx,其中xxx替换为媒体资源的地址(请求返回包含参数)即可。

  • URL

    /weibo/preview

  • Method

    GET

  • URL Params

参数 必选 类型 说明
url true string 媒体地址
  • Success Response
参数 必选 类型 说明
code true int 0: 成功 1: 参数错误 2: 服务器错误
data true struct 数据
msg true string 请求说明(成功、参数错误、服务器错误)

用户信息及作品获取

  • URL

    /weibo/user

  • Method

    GET

  • URL Params

参数 必选 类型 说明
id true string 用户id,用户详情页url中获取,例如: 2865435252
offset false int 作品翻页偏移量, 默认0
limit false int 作品返回数量, 默认5
  • Success Response
参数 必选 类型 说明
code true int 0: 成功 1: 参数错误 2: 服务器错误
data true struct 数据
msg true string 请求说明(成功、参数错误、服务器错误)