You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
danmu/生成excel和数据可视化.py

20 lines
554 B

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