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()