From 1c7f81479e9782e0a634ccf1a85b2bf1e62cdfad Mon Sep 17 00:00:00 2001 From: pg78ac9nr <2401677463@qq.com> Date: Wed, 18 Sep 2024 20:45:31 +0800 Subject: [PATCH] ADD file via upload --- 生成excel和数据可视化.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 生成excel和数据可视化.py diff --git a/生成excel和数据可视化.py b/生成excel和数据可视化.py new file mode 100644 index 0000000..82e449f --- /dev/null +++ b/生成excel和数据可视化.py @@ -0,0 +1,20 @@ +def main(): + keyword = '2024巴黎奥运会' + video_ids = fetch_videos(keyword) + all_danmakus = [] + for video_id in video_ids: + danmakus = fetch_danmaku(video_id) + all_danmakus.extend(danmakus) + + keyword_counts = analyze_danmakus(all_danmakus) + top_danmaku_counts = top_danmakus(keyword_counts) + print(top_danmaku_counts) + + # 数据写入Excel + save_to_excel(top_danmaku_counts) + + # 数据可视化 + create_word_cloud(top_danmaku_counts) + +if __name__ == '__main__': + main() \ No newline at end of file