Bilibili收藏、关注查询Api

Bilibili收藏、关注查询Api

2020年10月08日 阅读:24 字数:1308 阅读时长:3 分钟

查询B站用户信息、收藏夹、关注列表Api,工作原理跨站请求伪造 (CSRF), 伪造请求头 , 调用官方 API

查询B站用户信息、收藏夹、关注列表Api,工作原理跨站请求伪造 (CSRF), 伪造请求头 , 调用官方 API

1、查询B站用户信息

根据用户ID查询昵称、头像、个性签名、粉丝勋章等信息

地址:https://api.timelessq.com/bilibili/info?mid=315883644

1.1、请求参数

参数名 位置 类型 必填 说明
mid
query
string
示例值:315883644
说明:B站用户ID

1.2、示例代码

var axios = require('axios');

var config = {
   method: 'get',
   url: 'https://api.timelessq.com/bilibili/info',
   params: { 
      'mid': '315883644'
   }
};

axios(config)
.then(function (response) {
   console.log(JSON.stringify(response.data));
})
.catch(function (error) {
   console.log(error);
});

1.3、返回响应

{
  "errno": 0,
  "errmsg": "",
  "data": {
    "mid": 315883644, // 用户ID
    "name": "六天一改下次一定", // 昵称
    "sex": "男",
    "face": "http://i0.hdslb.com/bfs/face/72ad117202d229fa3f590847c00097b65f51c2dc.jpg", // 头像
    "face_nft": 0,
    "face_nft_type": 0,
    "sign": "回去了,又是一年~", // 个性签名
    "rank": 10000,
    "level": 5,
    "jointime": 0,
    "moral": 0,
    "silence": 0,
    "coins": 0,
    "fans_badge": false,
    "fans_medal": {
      "show": true,
      "wear": true,
      "medal": {
        "uid": 315883644,
        "target_id": 402576555,
        "medal_id": 250333,
        "level": 2,
        "medal_name": "饼铛",
        "medal_color": 6067854,
        "intimacy": 28,
        "next_intimacy": 300,
        "day_limit": 1500,
        "medal_color_start": 6067854,
        "medal_color_end": 6067854,
        "medal_color_border": 6067854,
        "is_lighted": 1,
        "light_status": 1,
        "wearing_status": 1,
        "score": 229
      }
    },
    "official": {
      "role": 0,
      "title": "",
      "desc": "",
      "type": -1
    },
    "vip": { // 大会员信息
      "type": 2,
      "status": 1,
      "due_date": 1693238400000,
      "vip_pay_type": 0,
      "theme_type": 0,
      "label": {
        "path": "",
        "text": "年度大会员",
        "label_theme": "annual_vip",
        "text_color": "#FFFFFF",
        "bg_style": 1,
        "bg_color": "#FB7299",
        "border_color": ""
      },
      "avatar_subscript": 1,
      "nickname_color": "#FB7299",
      "role": 3,
      "avatar_subscript_url": ""
    },
    "pendant": {
      "pid": 0,
      "name": "",
      "image": "",
      "expire": 0,
      "image_enhance": "",
      "image_enhance_frame": ""
    },
    "nameplate": {
      "nid": 0,
      "name": "",
      "image": "",
      "image_small": "",
      "level": "",
      "condition": ""
    },
    "user_honour_info": {
      "mid": 0,
      "colour": null,
      "tags": []
    },
    "is_followed": false,
    "top_photo": "http://i1.hdslb.com/bfs/space/cb1c3ef50e22b6096fde67febe863494caefebad.png",
    "theme": {},
    "sys_notice": {},
    "live_room": {
      "roomStatus": 1,
      "liveStatus": 0,
      "url": "https://live.bilibili.com/11725214?broadcast_type=0&is_room_feed=1",
      "title": "新人上路求舰长守护!",
      "cover": "https://i0.hdslb.com/bfs/live/5701bf404332365ece81edbc9a9f266cebf17b0e.png",
      "roomid": 11725214,
      "roundStatus": 0,
      "broadcast_type": 0,
      "watched_show": {
        "switch": true,
        "num": 0,
        "text_small": "0",
        "text_large": "0人看过",
        "icon": "https://i0.hdslb.com/bfs/live/a725a9e61242ef44d764ac911691a7ce07f36c1d.png",
        "icon_location": "",
        "icon_web": "https://i0.hdslb.com/bfs/live/8d9d0f33ef8bf6f308742752d13dd0df731df19c.png"
      }
    },
    "birthday": "10-18",
    "school": {
      "name": ""
    },
    "profession": {
      "name": "",
      "department": "",
      "title": "",
      "is_show": 0
    },
    "tags": null,
    "series": {
      "user_upgrade_status": 3,
      "show_upgrade_window": false
    },
    "is_senior_member": 0
  }
}

2、查询收藏夹列表

地址:https://api.timelessq.com/bilibili/favorite

2.1、请求参数

参数名 位置 类型 必填 说明
mid
query
string
示例值:315883644
说明:B站用户ID

2.2、示例代码

var axios = require('axios');

var config = {
   method: 'get',
   url: 'https://api.timelessq.com/bilibili/favorite',
   params: { 
      'mid': '315883644'
   }
};

axios(config)
.then(function (response) {
   console.log(JSON.stringify(response.data));
})
.catch(function (error) {
   console.log(error);
});

2.3、响应示例

{
  "errno": 0,
  "errmsg": "",
  "data": {
    "count": 2,
    "list": [
      {
        "id": 162679244, // 收藏夹ID
        "fid": 1626792,
        "mid": 315883644, // 用户ID
        "attr": 20,
        "title": "动画", // 收藏夹名称
        "fav_state": 0,
        "media_count": 18 // 收藏夹内容数量
      },
      {
        "id": 1515113944,
        "fid": 15151139,
        "mid": 315883644,
        "attr": 22,
        "title": "快乐源泉",
        "fav_state": 0,
        "media_count": 6
      }
    ],
    "season": null
  }
}

3、查询收藏夹详情

地址:https://api.timelessq.com/bilibili/favorite

2.1、请求参数

参数名 位置 类型 必填 说明
id
query
integer
示例值:162679244
说明:收藏夹ID
page
query
integer
示例值:1
说明:页码
pageSize
query
integer
示例值:20
说明:每页个数

2.2、示例代码

var axios = require('axios');

var config = {
   method: 'get',
   url: 'https://api.timelessq.com/bilibili/resource',
   params: { 
      'id: '162679244',
      'page': 1,
      'pageSize': 20
   }
};

axios(config)
.then(function (response) {
   console.log(JSON.stringify(response.data));
})
.catch(function (error) {
   console.log(error);
});

2.3、响应示例

{
  "errno": 0,
  "errmsg": "",
  "data": {
    "info": {
      "id": 162679244,
      "fid": 1626792,
      "mid": 315883644,
      "attr": 20,
      "title": "动画", // 收藏夹名称
      "cover": "http://i0.hdslb.com/bfs/archive/6f84bacbd9563997a2485960660688d1e20361b6.jpg", // 收藏夹封面
      "upper": {
        "mid": 315883644,
        "name": "六天一改下次一定",
        "face": "http://i0.hdslb.com/bfs/face/72ad117202d229fa3f590847c00097b65f51c2dc.jpg",
        "followed": false,
        "vip_type": 2,
        "vip_statue": 1
      },
      "cover_type": 2,
      "cnt_info": {
        "collect": 0,
        "play": 0,
        "thumb_up": 0,
        "share": 0
      },
      "type": 11,
      "intro": "", // 简介
      "ctime": 1523483845, // 创建时间
      "mtime": 1578442520,
      "state": 0,
      "fav_state": 0,
      "like_state": 0,
      "media_count": 18 // 内容数量
    },
    "medias": [
      {
        "id": 854214567,
        "type": 2,
        "title": "深度揭秘手机芯片能效!到底谁功耗最高?为什么会翻车?", // 内容标题
        "cover": "http://i0.hdslb.com/bfs/archive/6f84bacbd9563997a2485960660688d1e20361b6.jpg", // 封面
        "intro": "我们花了整整三个月时间,测试了上万组数据,绘制出了全网首个手机处理器的能效曲线!到底谁的功耗最高?谁的能效最强?高通到底有多拉胯?翻车的原因又是什么?安卓和苹果差距多大?联发科的表现又是怎么样?台积电领先三星到底多远?这些疑问,本期视频全部解答!", // 简介
        "page": 1,
        "duration": 1560,
        "upper": { // Up主信息
          "mid": 25876945,
          "name": "极客湾Geekerwan",
          "face": "http://i1.hdslb.com/bfs/face/d0f7a7ee34a4a45c8390eb3a07e4d7f2d70bae91.jpg"
        },
        "attr": 0,
        "cnt_info": {
          "collect": 91051,
          "play": 2158194,
          "danmaku": 19119
        },
        "link": "bilibili://video/854214567",
        "ctime": 1652962329,
        "pubtime": 1652962329,
        "fav_time": 1652970312,
        "bv_id": "BV1z54y1Z7pr",
        "bvid": "BV1z54y1Z7pr",
        "season": null,
        "ogv": null,
        "ugc": {
          "first_cid": 725428645
        }
      },
      {
        "id": 338060665,
        "type": 2,
        "title": "【原神】八重酱:啊对对对",
        "cover": "http://i1.hdslb.com/bfs/archive/8f09343c71830912e83e878d6c5c561fd13b8e72.jpg",
        "intro": "感觉可以揉进无数的人物梗啊,真的太有趣了\n音源作者:绫人太太啊 BV1cm4y1D7LZ B站账号:https://space.bilibili.com/11131476\n                  片尾《pop子和pipi子日常》\n动作参考:叉烧葱香格里拉 BV1hu411271q B站账号:https://space.bilibili.com/29035076\n感谢以上创作者的优秀作品和巧妙灵感\n模型:miHoYo, NekoAndy",
        "page": 1,
        "duration": 45,
        "upper": {
          "mid": 1933225905,
          "name": "古德温的信",
          "face": "http://i0.hdslb.com/bfs/face/470139d198e5c8c19d413b6ddccae5c8032e3475.jpg"
        },
        "attr": 0,
        "cnt_info": {
          "collect": 205162,
          "play": 7525425,
          "danmaku": 2600
        },
        "link": "bilibili://video/338060665",
        "ctime": 1641957213,
        "pubtime": 1641957213,
        "fav_time": 1642425272,
        "bv_id": "BV1VR4y1g7KQ",
        "bvid": "BV1VR4y1g7KQ",
        "season": null,
        "ogv": null,
        "ugc": {
          "first_cid": 482527790
        }
      }
    ],
    "has_more": false
  }
}

4、查询关注列表

地址:https://api.timelessq.com/bilibili/favorite

2.1、请求参数

参数名 位置 类型 必填 说明
mid
query
string
示例值:315883644
说明:B站用户ID

2.2、示例代码

var axios = require('axios');

var config = {
   method: 'get',
   url: 'https://api.timelessq.com/bilibili/following',
   params: { 
      'mid': '315883644'
   }
};

axios(config)
.then(function (response) {
   console.log(JSON.stringify(response.data));
})
.catch(function (error) {
   console.log(error);
});

2.3、响应示例

{
  "errno": 0,
  "errmsg": "",
  "data": {
    "list": [
      {
        "mid": 82571698,
        "attribute": 0,
        "mtime": 1650775405,
        "tag": [],
        "special": 0,
        "contract_info": {
          "is_contractor": false,
          "ts": 0,
          "is_contract": false,
          "user_attr": 0
        },
        "uname": "知三冬", // Up主昵称
        "face": "http://i1.hdslb.com/bfs/face/c77c55994951fbf3be2f3ba19ac5852f4ec0fc4e.jpg", // Up主头像
        "sign": "我希望我能成为你的小众收藏和喜好。", // Up主个性签名
        "face_nft": 0,
        "official_verify": {
          "type": -1,
          "desc": ""
        },
        "vip": {
          "vipType": 2,
          "vipDueDate": 1698768000000,
          "dueRemark": "",
          "accessStatus": 0,
          "vipStatus": 1,
          "vipStatusWarn": "",
          "themeType": 0,
          "label": {
            "path": "",
            "text": "年度大会员",
            "label_theme": "annual_vip",
            "text_color": "#FFFFFF",
            "bg_style": 1,
            "bg_color": "#FB7299",
            "border_color": ""
          },
          "avatar_subscript": 1,
          "nickname_color": "#FB7299",
          "avatar_subscript_url": ""
        }
      },
      {
        "mid": 697166795,
        "attribute": 0,
        "mtime": 1650154229,
        "tag": [],
        "special": 0,
        "contract_info": {
          "is_contractor": false,
          "ts": 0,
          "is_contract": false,
          "user_attr": 0
        },
        "uname": "徐云流浪中国",
        "face": "http://i2.hdslb.com/bfs/face/a6ccd9bf04c088f365dbed73cf8e2ff95acd2fe6.jpg",
        "sign": "不看私信 有问题请在评论区留言",
        "face_nft": 0,
        "official_verify": {
          "type": 0,
          "desc": "bilibili 知名旅行UP主"
        },
        "vip": {
          "vipType": 2,
          "vipDueDate": 1680451200000,
          "dueRemark": "",
          "accessStatus": 0,
          "vipStatus": 1,
          "vipStatusWarn": "",
          "themeType": 0,
          "label": {
            "path": "",
            "text": "年度大会员",
            "label_theme": "annual_vip",
            "text_color": "#FFFFFF",
            "bg_style": 1,
            "bg_color": "#FB7299",
            "border_color": ""
          },
          "avatar_subscript": 1,
          "nickname_color": "#FB7299",
          "avatar_subscript_url": ""
        }
      }
    ],
    "re_version": 0,
    "total": 203 // 总数
  }
}

推荐阅读

恰饭区

评论区 (0)

0/500

还没有评论,快来抢第一吧