b站视频数据
2019-08-06 本文已影响0人
年画儿
找到视频的api接口 可以直接获取数据
import requests
import json
url = "https://api.bilibili.com/x/web-interface/view?aid=61908575&cid=107641262"
r = requests.get(url)
content = json.loads(r.text) #解析返回来的json
# print(content)
data = content.get("data") #或者 content["data"]
stat_ = data.get("stat")
# print(data)
# print(stat)
datas = {}
datas["aid"] = data["aid"]
datas["title"] = data["title"]
datas["ownername"] = data["owner"]["name"]
datas["view"] = stat_["view"]
datas["favorite"] = stat_["favorite"]
datas["coin"] = stat_["coin"]
datas["share"] = stat_["share"]
datas["like"] = stat_["like"]
print(datas)
#
# datas["data" : data]