Update python.py

main
ppfc5brxg 2 months ago
parent e371d5fd1f
commit 644f359ab2

@ -37,8 +37,8 @@ def GetCid(): # 获取300个视频的 bvid
video_url = f"https://www.bilibili.com/video/{bvid}"
respons = requests.get(video_url, headers=headers)
current_cid = cid_pattern.search(respons.text).group(1)
print(f"获取到第{len(total_cid_list) + 1}个cid:{current_cid}")
total_cid_list.append(current_cid)
print(f"获取到第{len(cid_list) + 1}个cid:{current_cid}")
cid_list.append(current_cid)
if len(cid_list) >= 300:
break
# time.sleep(1)
@ -62,7 +62,7 @@ def Getdanmu(): # 遍历所有视频的 cid获取对应弹幕
else:
current_comment_dict[danmu] = 1
for k, v in current_comment_dict.items():
if k in total_comment_dict:
if k in comment_dict:
comment_dict[k] += v
else:
comment_dict[k] = v
@ -72,7 +72,7 @@ def Sortdanmu():
ai_pattern1 = re.compile(r'ai[\u4e00-\u9fff]', re.IGNORECASE)
ai_pattern2 = re.compile(r'[\u4e00-\u9fff]ai', re.IGNORECASE)
ai_comment = {}
for k, v in total_comment_dict.items():
for k, v in comment_dict.items():
if ai_pattern1.search(k) and 'aiden' not in k and 'Aiden' not in k:
ai_comment[k] = v
if ai_pattern2.search(k) and 'aiden' not in k and 'Adien' not in k:

Loading…
Cancel
Save