import pandas as pd from get_300urls import get_300videos_urls from get_danmu_about_AI import danmu_about_AI from generate_gif import generate_ def main(): # 定义与 AI 技术相关的关键字 AI_TECH_KEYWORDS = { "直播转播8K超高清": ["直播转播", "8K", "超高清"], "智能辅助解说": ["智能", "智能解说", "辅助解说"], "训练监测辅助": ["训练监测"], "实时打分量化分析": ["打分", "实时", "量化分析"], "3D全息视频技术": ["3D", "全息", "视频技术"], "无障碍建设为视障人士搭建设施": ["无障碍设施", "视障"], "赛时安保辅助赛事管理": ["安保", "赛事管理"], "信息咨询运动员专属GPT": ["信息咨询", "GPT"], "智能裁判系统精确计算分数": ["智能裁判", "系统计算"], "舆情监测实时侦测": ["舆情", "监测", "侦测"], "媒资修复史料焕新": ["媒资", "修复", "史料"] } # 关键词搜索 key = "2024巴黎奥运会" try: urls = get_300videos_urls(key) # 获取 300 个视频的 URL except Exception as e: print(f"Error fetching video URLs: {e}") return try: top_8_danmu, top_8_AI = danmu_about_AI(urls, AI_TECH_KEYWORDS) except Exception as e: print(f"Error processing danmu data: {e}") return # 打印结果 print("Top 8 AI technologies:") print(top_8_AI) print("Top 8 danmu:") print(top_8_danmu) # 将弹幕数据写入 Excel 文件 try: df = pd.DataFrame({'danmu': top_8_danmu}) df.to_excel("danmu_data.xlsx", index=False, engine='openpyxl') except Exception as e: print(f"Error saving data to Excel: {e}") return # 生成 GIF 文件 try: generate_("danmu_data.xlsx") except Exception as e: print(f"Error generating GIF: {e}") if __name__ == "__main__": main()