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