分享一下一段Python代码。
# 获取B站粉丝数量
# 冰河之刃
# 2020-08-02
import requests
import json
url = "https://api.bilibili.com/x/relation/stat?vmid=490458635"
payload = {}
# 发起请求
response = requests.request("GET", url, data=payload)
# print(response.text.encode('utf8'))
# 解析JSON
userInfo = json.loads(response.text.encode('utf8'))
print("mid:"+str(userInfo["data"]["mid"]))
print("关注数:"+str(userInfo["data"]["following"]))
# print(userInfo["data"]["whisper"])
# print(userInfo["data"]["black"])
print("粉丝数:" + str(userInfo["data"]["follower"]))