用uid抓个人信息

https://api.bilibili.com/x/space/acc/info?mid={{uid}}

列示

{
    "code": 0,
    "message": "0",
    "ttl": 1,
    "data": {
        "mid": 6475865,
        "name": "脆角鲨鲨",
        "sex": "女",
        "face": "https://i2.hdslb.com/bfs/face/a5b5f49c89049a4181c515cab353c3fe8d146518.jpg",
        "face_nft": 0,
        "face_nft_type": 0,
        "sign": "一起努力成为更好的人吧,粉丝群:813064515 ",
        "rank": 10000,
        "level": 5,
        "jointime": 0,
        "moral": 0,
        "silence": 0,
        "coins": 0,
        "fans_badge": true,
        "fans_medal": {
            "show": true,
            "wear": true,
            "medal": {
                "uid": 6475865,
                "target_id": 16081433,
                "medal_id": 1055548,
                "level": 22,
                "medal_name": "饲羊园",
                "medal_color": 1725515,
                "intimacy": 34,
                "next_intimacy": 2500,
                "day_limit": 250000,
                "medal_color_start": 1725515,
                "medal_color_end": 5414290,
                "medal_color_border": 6809855,
                "is_lighted": 1,
                "guard_level": 3,
                "light_status": 1,
                "wearing_status": 1,
                "score": 50002034
            }
        },
        "official": {
            "role": 0,
            "title": "",
            "desc": "",
            "type": -1
        },
        "vip": {
            "type": 1,
            "status": 1,
            "due_date": 1686844800000,
            "vip_pay_type": 1,
            "theme_type": 0,
            "label": {
                "path": "",
                "text": "大会员",
                "label_theme": "vip",
                "text_color": "#FFFFFF",
                "bg_style": 1,
                "bg_color": "#FB7299",
                "border_color": "",
                "use_img_label": true,
                "img_label_uri_hans": "",
                "img_label_uri_hant": "",
                "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/3788b674c69072f1ee252b79a31ecc8c43af3039.png",
                "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/jwXBWRVwa5.png"
            },
            "avatar_subscript": 1,
            "nickname_color": "#FB7299",
            "role": 1,
            "avatar_subscript_url": "",
            "tv_vip_status": 0,
            "tv_vip_pay_type": 0,
            "tv_due_date": 1626364800
        },
        "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": true,
        "top_photo": "http://i0.hdslb.com/bfs/space/44873d3568bdcb3d850d234e02a19602972450f1.png",
        "theme": {},
        "sys_notice": {},
        "live_room": {
            "roomStatus": 1,
            "liveStatus": 1,
            "url": "https://live.bilibili.com/2646668?broadcast_type=0\u0026is_room_feed=1",
            "title": "【新v】努力还债中!",
            "cover": "http://i0.hdslb.com/bfs/live/new_room_cover/b1e02964e6deed953729b8f8f0b3dbf410a0d212.jpg",
            "roomid": 2646668,
            "roundStatus": 0,
            "broadcast_type": 0,
            "watched_show": {
                "switch": true,
                "num": 249,
                "text_small": "249",
                "text_large": "249人看过",
                "icon": "https://i0.hdslb.com/bfs/live/a725a9e61242ef44d764ac911691a7ce07f36c1d.png",
                "icon_location": "",
                "icon_web": "https://i0.hdslb.com/bfs/live/8d9d0f33ef8bf6f308742752d13dd0df731df19c.png"
            }
        },
        "birthday": "11-03",
        "school": null,
        "profession": {
            "name": "",
            "department": "",
            "title": "",
            "is_show": 0
        },
        "tags": null,
        "series": {
            "user_upgrade_status": 3,
            "show_upgrade_window": false
        },
        "is_senior_member": 0,
        "mcn_info": null,
        "gaia_res_type": 0,
        "gaia_data": null,
        "is_risk": false,
        "elec": {
            "show_info": {
                "show": false,
                "state": -1,
                "title": "充电",
                "icon": "https://i0.hdslb.com/bfs/garb/item/33e2e72d9a0c855f036b4cb55448f44af67a0635.png",
                "jump_url": "https://www.bilibili.com/h5/upower/index?mid=6475865\u0026navhide=1\u0026oid=6475865"
            }
        },
        "contract": {
            "is_display": false,
            "is_follow_display": false
        }
    }
}

获得直播状态

https://api.live.bilibili.com/room/v1/Room/room_init?id={{uid}}

列示

{
    "code": 0,
    "msg": "ok",
    "message": "ok",
    "data": {
        "room_id": 6475865,
        "short_id": 0,
        "uid": 241865070,
        "need_p2p": 0,
        "is_hidden": false,
        "is_locked": false,
        "is_portrait": false,
        "live_status": 0,
        "hidden_till": 0,
        "lock_till": 0,
        "encrypted": false,
        "pwd_verified": false,
        "live_time": -62170012800,
        "room_shield": 0,
        "is_sp": 0,
        "special_type": 0
    }
}

抓取直播间信息

用直播间id抓取直播间信息

https://api.live.bilibili.com/xlive/web-room/v1/index/getRoomBaseInfo?room_ids={{room_id}}&req_biz=video

用uid抓取直播间信息

https://api.live.bilibili.com/xlive/web-room/v1/index/getRoomBaseInfo?uid={{uid}}&req_biz=video

使用房间号抓取的结果范例

{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
    "by_uids": {},
    "by_room_ids": {
        "2646668": {
            "room_id": 2646668,
            "uid": 6475865,
            "area_id": 371,
            "live_status": 1,
            "live_url": "https://live.bilibili.com/2646668",
            "parent_area_id": 9,
            "title": "【新v】努力还债中!",
            "parent_area_name": "虚拟主播",
            "area_name": "虚拟日常",
            "live_time": "2023-05-26 15:25:09",
            "description": "粉丝群:813064515 欢迎回家",
            "tags": "软妹,甜妹",
            "attention": 2419,
            "online": 6232,
            "short_id": 0,
            "uname": "脆角鲨鲨",
            "cover": "http://i0.hdslb.com/bfs/live/new_room_cover/b1e02964e6deed953729b8f8f0b3dbf410a0d212.jpg",
            "background": "",
            "join_slide": 1,
            "live_id": 374925888751952524,
            "live_id_str": "374925888751952524"
        }
    }
} }

大概信息

  • code:返回状态码,值为0表示请求成功。
  • message:返回信息,值为0表示没有错误。
  • ttl:数据缓存时间,单位为秒。
  • data:API返回的具体数据。
  • by_uids:根据用户id查询的数据,但在该响应中没有返回任何信息。
  • by_room_ids:根据房间id查询的数据。
  • room_id:直播间id。
  • uid:直播间主播的用户id。
  • area_id:直播间所属分区的id。
  • live_status:直播间状态,值为1表示正在直播,值为0表示未直播。
  • live_url:直播间的链接地址。
  • parent_area_id:直播间所属的上级分区id
  • title:直播间的标题。
  • parent_area_name:直播间所属的上级分区的名称。
  • area_name:直播间所属的分区名称。
  • live_time:直播开始时间。
  • description:直播间的描述信息。
  • tags:直播间的标签。
  • attention:关注该直播间的用户数量。
  • online:当前直播间在线观看人数。
  • short_id:直播间的短id。
  • uname:直播间主播的昵称。
  • cover:直播间封面的图片链接。
  • background:直播间的背景图片链接。
  • join_slide:加入分区滑块的状态,值为1表示已加入,值为0表示未加入。
  • live_id:直播id。
  • live_id_str:直播id的字符串形式。

最后修改:2023 年 05 月 26 日
如果觉得我的文章对你有用,请随意赞赏