You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
574 B

import requests
import openpyxl
url='https://api.bilibili.com/x/v1/dm/list.so?oid=1083801012'
headers={
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36'
}
response=requests.get(url=url,headers=headers)
response.encoding='utf-8'
# print(response.text)
import re
content_list=re.findall('<d p=".*?">(.*?)</d>',response.text)
for content in content_list:
with open('弹幕.txt',mode='a',encoding='utf-8') as f:
f.write(content)
f.write('\n')