標(biāo)題:
bilibili信息獲取器 python語言
[打印本頁]
作者:
2544155047
時(shí)間:
2021-8-22 10:02
標(biāo)題:
bilibili信息獲取器 python語言
我用的是python語言
這個(gè)bilibili粉絲獲取器可以獲取bilibili up主的很多信息,只要你一運(yùn)行代碼,他就會(huì)讓你輸入要查詢的up主的UID,就可以了,還有一些功能我還未開發(fā),敬請(qǐng)期待�。�!
代碼:
#python
import requests #導(dǎo)入requests庫
import json #導(dǎo)入json庫
date = input("UID:") #將date變量設(shè)為屏幕輸入內(nèi)容
UID = int(date) #將date變量轉(zhuǎn)換整型常量,并把它設(shè)為UID的值
print("請(qǐng)輸入你想了解的UP主的信息(填序號(hào))")
print("1.名字")
print("2.UID")
print("3.性別")
print("4.簽名")
print("5.LV等級(jí)")
print("6.認(rèn)證")
print("7.是否成為大會(huì)員")
print("8.粉絲數(shù)")
print("9.生成報(bào)告")
date = input()
dateint = int(date)
if dateint == 1:
URL = requests.get('https://api.bilibili.com/x/web-interface/card?mid=%d' % (UID)) #訪問bilibili的api獲取值
jsondate = json.loads(URL.text) #把json數(shù)據(jù)轉(zhuǎn)換成字典,字典名稱為jsondate
name = jsondate['data']['card']['name']
print(name)
if dateint == 2:
URL = requests.get('https://api.bilibili.com/x/web-interface/card?mid=%d' % (UID))
jsondate = json.loads(URL.text)
mid = jsondate['data']['card']['mid']
print(mid)
if dateint == 3:
URL = requests.get('https://api.bilibili.com/x/web-interface/card?mid=%d' % (UID))
jsondate = json.loads(URL.text)
sex = jsondate['data']['card']['sex']
print(sex)
if dateint == 4:
URL = requests.get('https://api.bilibili.com/x/web-interface/card?mid=%d' % (UID))
jsondate = json.loads(URL.text)
sign = jsondate['data']['card']['sign']
if sign == "":
print("無數(shù)據(jù)")
else:
print(sign)
if dateint == 5:
URL = requests.get('https://api.bilibili.com/x/web-interface/card?mid=%d' % (UID))
jsondate = json.loads(URL.text)
level = jsondate['data']['card']['level_info']['current_level']
print(level)
if dateint == 6:
URL = requests.get('https://api.bilibili.com/x/web-interface/card?mid=%d' % (UID))
jsondate = json.loads(URL.text)
Authentication = jsondate['data']['card']['Official']['title']
if Authentication == "":
print("無數(shù)據(jù)")
else:
print(Authentication)
if dateint == 7:
URL = requests.get('https://api.bilibili.com/x/web-interface/card?mid=%d' % (UID))
jsondate = json.loads(URL.text)
vip = jsondate['data']['card']['vip']['vipType']
if vip == 0:
print("False")
else:
print("True")
if dateint == 8:
URL = requests.get('https://api.bilibili.com/x/web-interface/card?mid=%d' % (UID))
jsondate = json.loads(URL.text)
fans = jsondate['data']['follower']
print(fans)
if dateint == 9:
URL = requests.get('https://api.bilibili.com/x/web-interface/card?mid=%d' % (UID))
jsondate = json.loads(URL.text)
name = jsondate['data']['card']['name']
mid = jsondate['data']['card']['mid']
sex = jsondate['data']['card']['sex']
sign = jsondate['data']['card']['sign']
level = jsondate['data']['card']['level_info']['current_level']
Authentication = jsondate['data']['card']['Official']['title']
vip = jsondate['data']['card']['vip']['vipType']
fans = jsondate['data']['follower']
print("用戶名稱:")
print(name)
print("")
print("用戶UID:")
print(mid)
print("")
print("用戶性別:")
print(sex)
print("")
print("用戶簽名:")
if sign == "":
print("無數(shù)據(jù)")
else:
print(sign)
print("")
print("用戶等級(jí):")
print(level)
print("")
print("用戶認(rèn)證:")
if Authentication == "":
print("無數(shù)據(jù)")
else:
print(Authentication)
print("")
print("是否成為大會(huì)員:")
if vip == 0:
print("False")
else:
print("True")
print("")
print("用戶粉絲:")
print(fans)
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1