Music Recommender
Analyze a user's NetEase Cloud Music playlist, profile their taste, and recommend songs with clickable Bilibili links (free, no membership required).
Workflow
Step 1 — Parse Playlist
Extract playlist ID from user's link. Supported formats:
Run the fetch script:
CODEBLOCK0
Output: JSON array of {name, artists, album} objects.
Step 2 — Analyze Taste
Read the JSON output. Profile the user's taste:
- 1. Top artists — count occurrences, identify top 10-20
- Language mix — estimate Chinese/English/Japanese/Korean ratio from song titles
- Genre tags — infer from artists and song names (e.g. 气声唱法, 90s怀旧, indie folk, dream pop)
- Era — identify decade distribution
- Mood — upbeat/melancholic/dreamy/energetic based on song names and artists
Summarize the taste profile in 3-5 bullet points.
Step 3 — Recommend
Based on the taste profile, recommend 10 songs that:
- - Match the user's preferences (similar artists, genres, mood)
- Are NOT already in their playlist
- Are diverse — mix of Chinese and foreign, different sub-genres
- Include both well-known and lesser-known picks
For each recommended song, search Bilibili for a playable link:
CODEBLOCK1
Output: INLINECODE3
Step 4 — Format Output
Present the recommendations as a plain text list (NOT HTML/markdown links) for Telegram compatibility:
CODEBLOCK2
Rules for Telegram formatting:
- - Use bold for section headers, NOT markdown links INLINECODE4
- Put URL on its own line after the song name
- Group by genre/language (华语/欧美/日语 etc.)
- Keep descriptions short (5-10 words)
Step 5 — Record & De-duplicate
IMPORTANT: Only recommend ONCE per day. Before recommending:
- 1. Check if today's recommendation file exists:
~/.openclaw/workspace/music-history/YYYY-MM-DD.json
If it exists, reply with today's list and say "今天已经推荐过了". Do NOT generate a new one.
- 2. If not, load the full history to avoid repeats:
python3 {baseDir}/scripts/history.py show
This outputs all previously recommended songs across all days.
- 3. When generating recommendations, exclude any song that appears in the history.
- 4. After generating, save today's recommendations:
python3 {baseDir}/scripts/history.py save
Pipe in JSON array: INLINECODE5
History Storage
CODEBLOCK6
Each file: JSON array of recommended songs for that day.
Step 6 — (Optional) Extra Save
If user wants to save elsewhere, offer to:
- - Write to Notion (Content Calendar or a Music DB)
- Generate an HTML page in the workspace
- Create a text file in the workspace
Notes
- - NetEase API endpoint: INLINECODE6
- Required headers:
User-Agent: Mozilla/5.0, Referer: https://music.163.com/, INLINECODE9 - Artist field is
ar (not artists) in NetEase API response - Bilibili search API: INLINECODE12
- Required headers for Bilibili:
User-Agent: Mozilla/5.0, INLINECODE14 - Default recommendation count: 10 songs
- Always use Bilibili links (free, no membership) instead of NetEase links
音乐推荐器
分析用户的网易云音乐歌单,描绘其音乐品味,并推荐带有可点击B站链接的歌曲(免费,无需会员)。
工作流程
第一步 — 解析歌单
从用户提供的链接中提取歌单ID。支持的格式:
- - https://music.163.com/playlist?id=XXXXX
- https://music.163.com/#/playlist?id=XXXXX
运行抓取脚本:
bash
python3 {baseDir}/scripts/fetchplaylist.py id> > /tmp/playlist_.json
输出:包含{name, artists, album}对象的JSON数组。
第二步 — 分析品味
读取JSON输出。描绘用户的音乐品味:
- 1. 热门歌手 — 统计出现次数,识别前10-20名
- 语言分布 — 根据歌曲名称估算中文/英文/日文/韩文比例
- 风格标签 — 从歌手和歌曲名称推断(例如:气声唱法、90年代怀旧、独立民谣、梦幻流行)
- 年代 — 识别年代分布
- 情绪 — 根据歌曲名称和歌手判断欢快/忧郁/梦幻/活力
用3-5个要点总结品味画像。
第三步 — 推荐
基于品味画像,推荐10首歌曲,要求:
- - 符合用户偏好(相似歌手、风格、情绪)
- 不在用户已有歌单中
- 多样化 — 中英文混合,不同子风格
- 包含知名和冷门选择
为每首推荐歌曲,在B站搜索可播放链接:
bash
python3 {baseDir}/scripts/search_bilibili.py <歌手> <歌曲> 官方MV
输出:BV_ID|TITLE|URL
第四步 — 格式化输出
以纯文本列表形式呈现推荐(非HTML/markdown链接),适配Telegram:
🎵 Vulpis 今日推荐歌单
华语女声:
- 1. 陈粒 — 奇妙能力歌
https://www.bilibili.com/video/BVxxxxx
- 2. ...
欧美梦幻:
- 6. ...
Telegram格式规则:
- - 使用粗体表示章节标题,不使用markdown链接text
- 在歌曲名称后单独一行放置URL
- 按风格/语言分组(华语/欧美/日语等)
- 保持描述简短(5-10字)
第五步 — 记录与去重
重要:每天仅推荐一次。 推荐前:
- 1. 检查今日推荐文件是否存在:
~/.openclaw/workspace/music-history/YYYY-MM-DD.json
如果存在,回复今日列表并提示今天已经推荐过了。不生成新的推荐。
- 2. 如果不存在,加载完整历史记录以避免重复:
bash
python3 {baseDir}/scripts/history.py show
输出所有历史推荐歌曲。
- 3. 生成推荐时,排除历史记录中出现的任何歌曲。
- 4. 生成后,保存今日推荐:
bash
python3 {baseDir}/scripts/history.py save
输入JSON数组:[{name:...,artists:...,bvid:...,url:...}]
历史记录存储
~/.openclaw/workspace/music-history/
├── 2026-03-29.json
├── 2026-03-30.json
└── ...
每个文件:当日推荐歌曲的JSON数组。
第六步 — (可选)额外保存
如果用户希望保存到其他位置,可提供:
- - 写入Notion(内容日历或音乐数据库)
- 在工作区生成HTML页面
- 在工作区创建文本文件
备注
- - 网易云API端点:https://music.163.com/api/v6/playlist/detail?id=&n=1000
- 必需请求头:User-Agent: Mozilla/5.0,Referer: https://music.163.com/,Cookie: os=pc;
- 网易云API响应中歌手字段为ar(非artists)
- B站搜索API:https://api.bilibili.com/x/web-interface/search/all/v2?keyword=
- B站必需请求头:User-Agent: Mozilla/5.0,Referer: https://www.bilibili.com/
- 默认推荐数量:10首歌曲
- 始终使用B站链接(免费,无需会员)而非网易云链接