From 644f359ab205f259d1982bfdd278e8790120186a Mon Sep 17 00:00:00 2001 From: ppfc5brxg <508446093@qq.com> Date: Mon, 16 Sep 2024 12:37:20 +0800 Subject: [PATCH] Update python.py --- python.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python.py b/python.py index d9ce735..30c033e 100644 --- a/python.py +++ b/python.py @@ -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: