This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
运行此代码前需要安装以下库
requests:用于发送 HTTP 请求,获取网页和 API 数据
pandas:用于数据处理和 Excel 文件生成
jieba:中文分词工具,用于词云生成
wordcloud:生成词云图
matplotlib:绘图库,用于显示和保存词云图
beautifulsoup4:解析 HTML/XML 数据(此处用于解析弹幕 XML)
lxml:BeautifulSoup 的解析器,需配合使用
openpyxl:用于 pandas 写入 Excel 文件
numpy:数值计算库,词云生成可能依赖
Pillow:图像处理库,用于词云背景等图像处理
运行以下代码即可:
pip install requests pandas jieba wordcloud matplotlib beautifulsoup4 openpyxl numpy Pillow lxml