ADD file via upload

main
py6qo2c5g 2 months ago
parent 3b8b572b09
commit 7c883c3798

16
2.py

@ -0,0 +1,16 @@
import requests
import xml.etree.ElementTree as ET
def get_danmaku(video_id):
url = "https://api.bilibili.com/x/v1/dm/list.so?oid={}".format(video_id)
response = requests.get(url)
if response.status_code == 200:
root = ET.fromstring(response.content)
danmaku_list = []
for d in root.findall('d'):
text = d.text
if text:
danmaku_list.append(text)
return danmaku_list
return []
Loading…
Cancel
Save