|
|
|
@ -1,4 +1,3 @@
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
import requests
|
|
|
|
|
from lxml import etree
|
|
|
|
@ -37,7 +36,6 @@ def get_videos_url(keyword,pages=1):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_danmu(video_id):
|
|
|
|
|
|
|
|
|
|
#打开视频页面,获取视频cid
|
|
|
|
|
response = requests.get(video_id, headers=headers)
|
|
|
|
|
video_cid = re.search(r'"cid":(\d*),', response.text).group(1)
|
|
|
|
@ -54,9 +52,7 @@ def get_danmu(video_id):
|
|
|
|
|
print("请求弹幕失败")
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def writeintxt (list,file_path):
|
|
|
|
|
with open(file_path, 'w', encoding='utf-8') as file:
|
|
|
|
|
for item in list:
|
|
|
|
|
file.write("%s\n" % item)
|
|
|
|
|
|
|
|
|
|