微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🎵

你的私人音乐数据档案馆

lastfm · vv1.0.2
专业技能 安全 A 级 作者 gumadeiras 公开目录收录
1k 下载 202 安装 5k 收藏 2.2k 浏览

简介

基于 Last.fm 官方 API 的纯文档型音乐数据查询技能,帮助用户安全获取个人听歌历史、排行榜与音乐发现,无需代码执行风险。

原始描述

Access Last.fm listening history, music stats, and discovery. Query recent tracks, top artists/albums/tracks, loved tracks, similar artists, and global charts.

通过你的 Agent 添加

安装目录:lastfm/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/lastfm/
Codex CLI~/.codex/skills/lastfm/
DeepSeek Harness~/.agents/skills/lastfm/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

Last.fm Skill 是一个纯文档型的 API 使用指南,帮助用户通过标准 HTTP GET 请求访问 Last.fm 音乐数据平台。用户需配置 LASTFM_API_KEY 和 LASTFM_USER 两个环境变量,即可查询包括最近播放、历史统计、艺术家/专辑/曲目排行、相似推荐、全球榜单等 20 余种数据端点。所有接口均为只读操作,返回 JSON 格式数据,支持配合 jq 等工具进行后续处理。

显著优点

  1. 零代码执行风险:纯 Markdown 文档,无脚本文件,所有示例均为安全的 curl 命令
  2. 功能覆盖全面:涵盖用户数据(recent tracks、top artists、loved tracks)、音乐元数据(artist/album/track info)、发现功能(similar artists/tracks)、全局榜单(charts)及搜索能力
  3. 官方 API 背书:直接调用 Last.fm 官方服务,数据来源权威可靠
  4. 透明可审计:内容完全公开,用户可逐行检查所有 API 调用示例
  5. 灵活的时间维度:支持 overall、7day、1month、3month、6month、12month 等多种统计周期

潜在缺点与局限性

  1. 只读限制:当前版本仅支持查询操作,无法执行标记喜爱、修改播放记录等写入操作
  2. 依赖外部服务:所有功能依赖 Last.fm API 可用性,存在网络延迟或服务中断风险
  3. 需要手动配置:用户必须自行注册获取 API Key,对非技术用户有一定门槛
  4. 无内置数据处理:仅提供原始 API 调用示例,需配合 jq 等工具进行数据解析和格式化
  5. T3 来源等级:由个人开发者维护,非官方或知名组织背书

适合的目标群体

  • 音乐数据爱好者与量化自我(Quantified Self)实践者
  • 需要集成 Last.fm 数据到个人工作流的技术用户
  • 数据分析师、音乐博主、播客创作者
  • 希望备份或分析自己多年听歌历史的资深 Last.fm 用户
  • 对音乐推荐算法感兴趣的研究人员

使用风险

  1. API Key 泄露风险:若将 API Key 硬编码或误提交至版本控制,可能导致密钥滥用
  2. 隐私暴露:查询结果包含个人音乐偏好数据,分享时需注意脱敏
  3. 网络依赖:所有操作需联网,无法离线使用
  4. Rate Limit 不确定性:Last.fm 未明确文档化速率限制,高频调用可能触发限制
  5. 服务持续性:Last.fm 作为第三方服务,存在 API 变更或终止的可能性

技能正文


name: lastfm description: Access Last.fm listening history, music stats, and discovery. Query recent tracks, top artists/albums/tracks, loved tracks, similar artists, and global charts.

Last.fm API Skill

Access Last.fm listening history, music stats, and discovery.

Configuration

Required env vars (add to your shell profile or optionally ~/.clawdbot/.env):

  • LASTFM_API_KEY — your Last.fm API key (get one here)
  • LASTFM_USER — your Last.fm username

Base URL: http://ws.audioscrobbler.com/2.0/
Docs: https://lastfm-docs.github.io/api-docs/

Example Output

Here's what 17+ years of scrobbling looks like:

Total scrobbles: 519,778
Unique artists: 13,763
Unique tracks: 68,435
Unique albums: 33,637

Top Artists (all time):
• System of a Down (52,775 plays)
• Eminem (15,400 plays)
• Dashboard Confessional (10,166 plays)
• Edguy (10,161 plays)
• Metallica (9,927 plays)

Top Tracks (all time):
• System of a Down - Aerials (1,405 plays)
• System of a Down - Toxicity (1,215 plays)
• System of a Down - Sugar (1,149 plays)
• System of a Down - Chop Suey (1,116 plays)
• System of a Down - Prison Song (1,102 plays)

Quick Reference

All requests use GET with these base params:

?api_key=$LASTFM_API_KEY&format=json&user=$LASTFM_USER

User Endpoints

Recent Tracks (what's playing / recently played)
curl -s "http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=$LASTFM_USER&api_key=$LASTFM_API_KEY&format=json&limit=10"
  • First track with @attr.nowplaying=true is currently playing
  • Returns: artist, track name, album, timestamp, images
User Info (profile stats)
curl -s "http://ws.audioscrobbler.com/2.0/?method=user.getinfo&user=$LASTFM_USER&api_key=$LASTFM_API_KEY&format=json"
  • Returns: playcount, artist_count, track_count, album_count, registered date
Top Artists
curl -s "http://ws.audioscrobbler.com/2.0/?method=user.gettopartists&user=$LASTFM_USER&api_key=$LASTFM_API_KEY&format=json&period=7day&limit=10"
  • period: overall | 7day | 1month | 3month | 6month | 12month
Top Albums
curl -s "http://ws.audioscrobbler.com/2.0/?method=user.gettopalbums&user=$LASTFM_USER&api_key=$LASTFM_API_KEY&format=json&period=7day&limit=10"
Top Tracks
curl -s "http://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=$LASTFM_USER&api_key=$LASTFM_API_KEY&format=json&period=7day&limit=10"
Loved Tracks
curl -s "http://ws.audioscrobbler.com/2.0/?method=user.getlovedtracks&user=$LASTFM_USER&api_key=$LASTFM_API_KEY&format=json&limit=10"
Weekly Charts
# Weekly artist chart
curl -s "http://ws.audioscrobbler.com/2.0/?method=user.getweeklyartistchart&user=$LASTFM_USER&api_key=$LASTFM_API_KEY&format=json"

# Weekly track chart
curl -s "http://ws.audioscrobbler.com/2.0/?method=user.getweeklytrackchart&user=$LASTFM_USER&api_key=$LASTFM_API_KEY&format=json"

# Weekly album chart
curl -s "http://ws.audioscrobbler.com/2.0/?method=user.getweeklyalbumchart&user=$LASTFM_USER&api_key=$LASTFM_API_KEY&format=json"

Artist/Track/Album Info

Artist Info
curl -s "http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=Tame+Impala&api_key=$LASTFM_API_KEY&format=json&username=$LASTFM_USER"
  • Adding username includes user's playcount for that artist
Similar Artists
curl -s "http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist=Tame+Impala&api_key=$LASTFM_API_KEY&format=json&limit=10"
Artist Top Tracks
curl -s "http://ws.audioscrobbler.com/2.0/?method=artist.gettoptracks&artist=Tame+Impala&api_key=$LASTFM_API_KEY&format=json&limit=10"
Track Info
curl -s "http://ws.audioscrobbler.com/2.0/?method=track.getinfo&artist=Tame+Impala&track=The+Less+I+Know+The+Better&api_key=$LASTFM_API_KEY&format=json&username=$LASTFM_USER"
Similar Tracks
curl -s "http://ws.audioscrobbler.com/2.0/?method=track.getsimilar&artist=Tame+Impala&track=Elephant&api_key=$LASTFM_API_KEY&format=json&limit=10"
Album Info
curl -s "http://ws.audioscrobbler.com/2.0/?method=album.getinfo&artist=Tame+Impala&album=Currents&api_key=$LASTFM_API_KEY&format=json&username=$LASTFM_USER"

Search

Search Artists
curl -s "http://ws.audioscrobbler.com/2.0/?method=artist.search&artist=tame&api_key=$LASTFM_API_KEY&format=json&limit=5"
Search Tracks
curl -s "http://ws.audioscrobbler.com/2.0/?method=track.search&track=elephant&api_key=$LASTFM_API_KEY&format=json&limit=5"
Search Albums
curl -s "http://ws.audioscrobbler.com/2.0/?method=album.search&album=currents&api_key=$LASTFM_API_KEY&format=json&limit=5"

Charts (Global)

# Top artists globally
curl -s "http://ws.audioscrobbler.com/2.0/?method=chart.gettopartists&api_key=$LASTFM_API_KEY&format=json&limit=10"

# Top tracks globally
curl -s "http://ws.audioscrobbler.com/2.0/?method=chart.gettoptracks&api_key=$LASTFM_API_KEY&format=json&limit=10"

Tags

# Top albums for a tag/genre
curl -s "http://ws.audioscrobbler.com/2.0/?method=tag.gettopalbums&tag=psychedelic&api_key=$LASTFM_API_KEY&format=json&limit=10"

# Top artists for a tag
curl -s "http://ws.audioscrobbler.com/2.0/?method=tag.gettopartists&tag=brazilian&api_key=$LASTFM_API_KEY&format=json&limit=10"

Useful jq Filters

For JSON processing, see the jq skill on ClawdHub.

# Recent tracks: artist - track
jq '.recenttracks.track[] | "\(.artist["#text"]) - \(.name)"'

# Top artists: name (playcount)
jq '.topartists.artist[] | "\(.name) (\(.playcount))"'

# Check if currently playing
jq '.recenttracks.track[0] | if .["@attr"].nowplaying == "true" then "Now playing: \(.artist["#text"]) - \(.name)" else "Last played: \(.artist["#text"]) - \(.name)" end'

Notes

  • No auth needed for read-only endpoints (just API key)
  • Rate limit: be reasonable, no hard limit documented
  • URL-encode artist/track/album names (spaces → + or %20)
  • Images come in sizes: small, medium, large, extralarge

正文来自原始仓库, 版权归作者所有,许可:MIT。 权利人认为有不妥,可申请下架。

原始仓库

作者的项目地址:https://github.com/zocomputer/skills

标签

content-mediadata-analyticsapiproductivity

同类 Skill