本项目是一个基于 Python 的 B 站弹幕分析工具,支持自动抓取视频弹幕、清洗分词、生成词云及情感分析报告。
一、项目解决的问题
日常做视频复盘时,常见痛点是:
- 弹幕采集麻烦:每次手动导出/复制,效率很低。
- 词云质量不稳定:不清洗会被'哈哈哈/666/这边那边'污染。
- 舆情判断缺标准:没有统一口径,沟通时容易'拍脑袋'。
该项目把整条链路打通了:
抓取 → 清洗 → 关键词 → 词云 → 情感 → 报告
二、功能特性
- 自动解析
BVID -> CID,抓取弹幕 XML - 导出结构化数据:CSV / JSON / TXT
jieba分词 + 干扰词清洗SnowNLP情感分析(正/中/负分布)wordcloud生成高密度中文词云 PNG- 自动生成 Markdown 舆情报告
三、项目结构
bilibili-danmaku/
├── SKILL.md
├── README.md
├── README.en.md
├── requirements.txt
├── scripts/
│ ├── ensure_env.sh
│ ├── fetch_danmaku.py
│ ├── fetch.sh
│ ├── analyze_danmaku.py
│ └── analyze.sh
├── references/
│ ├── methodology.md
│ └── stopwords.default.txt
└── output/
四、源码部署方式
1)安装依赖
cd bilibili-danmaku
bash scripts/ensure_env.sh
2)抓取弹幕
python3 scripts/fetch_danmaku.py \
--url "https://www.bilibili.com/video/BV17JfuBqEqg" \
--outdir "./output"
支持短链:
python3 scripts/fetch_danmaku.py --url "https://b23.tv/gO0nMGs" --outdir "./output"
3)分析并出报告
bash scripts/analyze.sh "./output/<xxx>_danmaku.csv" "./output/<xxx>_meta.json" "./output" "task_name"
输出文件:
task_name_top_words.jsontask_name_sentiment.jsontask_name_wordcloud.pngtask_name_report.md


