ADD file via upload

main
p4oufk2iw 2 months ago
parent 432fc4d3de
commit 7071250053

@ -0,0 +1,26 @@
# 获取弹幕地址
def get_danmu_url(video_str):
url = video_str
response = requests.get(url=url, headers=headers)
html = response.text
cid = re.search('"cid":(.*?),', html).groups()[0]
danmu_url = f'https://comment.bilibili.com/{cid}.xml'
return danmu_url
# 获取视频地址
def get_vedio(bv):
vedio_url = "https://www.bilibili.com/video/"+bv
return vedio_url
# 获取bv号
def get_bvid(url, pos):
# 通过搜索api“https://api.bilibili.com/x/web-interface/search/all/v2?page=1-15&keyword=”获取前300个视频的bvid
res = requests.get(url=url, headers=headers).text
json_dict = json.loads(res)
return json_dict["data"]["result"][11]["data"][pos]["bvid"]
Loading…
Cancel
Save