spotify

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Spotify Skill

Spotify Skill

Overview

概述

Enables Claude to interact with Spotify for music playback control, playlist management, music discovery, and listening analytics through browser automation.
让Claude能够通过浏览器自动化与Spotify交互,实现音乐播放控制、播放列表管理、音乐发现以及收听数据分析功能。

Quick Install

快速安装

bash
curl -sSL https://canifi.com/skills/spotify/install.sh | bash
Or manually:
bash
cp -r skills/spotify ~/.canifi/skills/
bash
curl -sSL https://canifi.com/skills/spotify/install.sh | bash
或者手动安装:
bash
cp -r skills/spotify ~/.canifi/skills/

Setup

设置

Configure via canifi-env:
bash
undefined
通过canifi-env进行配置:
bash
undefined

First, ensure canifi-env is installed:

首先,确保已安装canifi-env:

canifi-env set SPOTIFY_EMAIL "your-email@example.com"
undefined
canifi-env set SPOTIFY_EMAIL "your-email@example.com"
undefined

Privacy & Authentication

隐私与认证

Your credentials, your choice. Canifi LifeOS respects your privacy.
你的凭证,由你掌控。 Canifi LifeOS尊重你的隐私。

Option 1: Manual Browser Login (Recommended)

选项1:手动浏览器登录(推荐)

If you prefer not to share credentials with Claude Code:
  1. Complete the Browser Automation Setup using CDP mode
  2. Login to the service manually in the Playwright-controlled Chrome window
  3. Claude will use your authenticated session without ever seeing your password
如果你不想与Claude Code共享凭证:
  1. 使用CDP模式完成浏览器自动化设置
  2. 在Playwright控制的Chrome窗口中手动登录该服务
  3. Claude将使用你的已认证会话,全程不会获取你的密码

Option 2: Environment Variables

选项2:环境变量

If you're comfortable sharing credentials, you can store them locally:
bash
canifi-env set SERVICE_EMAIL "your-email"
canifi-env set SERVICE_PASSWORD "your-password"
Note: Credentials stored in canifi-env are only accessible locally on your machine and are never transmitted.
如果你愿意共享凭证,可以将其存储在本地:
bash
canifi-env set SERVICE_EMAIL "your-email"
canifi-env set SERVICE_PASSWORD "your-password"
注意:存储在canifi-env中的凭证仅能在你的本地设备上访问,绝不会被传输。

Capabilities

功能特性

  • Control playback (play, pause, skip, shuffle, repeat)
  • Create, edit, and manage playlists
  • Search for songs, artists, albums, and podcasts
  • View and manage listening history
  • Discover new music through recommendations
  • 控制播放(播放、暂停、切歌、随机播放、重复播放)
  • 创建、编辑和管理播放列表
  • 搜索歌曲、艺术家、专辑和播客
  • 查看和管理收听历史
  • 通过推荐发现新音乐

Usage Examples

使用示例

Example 1: Create a Playlist

示例1:创建播放列表

User: "Create a workout playlist with high-energy songs"
Claude: I'll create a new playlist called "Workout Energy" and add some high-tempo tracks to get you moving.
用户:"创建一个包含高能量歌曲的健身播放列表"
Claude:我将创建一个名为“Workout Energy”的新播放列表,并添加一些快节奏曲目来让你动起来。

Example 2: Control Playback

示例2:控制播放

User: "Play some relaxing jazz music"
Claude: I'll search for relaxing jazz and start playing a curated selection for you.
用户:"播放一些舒缓的爵士乐"
Claude:我将搜索舒缓的爵士乐并开始为你播放精选曲目。

Example 3: Check Listening Stats

示例3:查看收听统计

User: "What have I been listening to this week?"
Claude: I'll check your recently played tracks and summarize your listening activity.
用户:"我这周都听了些什么?"
Claude:我将查看你最近播放的曲目并总结你的收听活动。

Authentication Flow

认证流程

  1. Navigate to open.spotify.com via Playwright MCP
  2. Click "Log in" button
  3. Enter email credentials
  4. Handle 2FA if enabled (via iMessage)
  5. Maintain session cookies for future requests
  1. 通过Playwright MCP导航至open.spotify.com
  2. 点击“登录”按钮
  3. 输入邮箱凭证
  4. 若启用了双因素认证,则通过iMessage处理
  5. 保留会话Cookie以便后续请求使用

Error Handling

错误处理

  • Login Failed: Retry authentication up to 3 times, then notify via iMessage
  • Session Expired: Re-authenticate automatically
  • Rate Limited: Implement exponential backoff (1s, 2s, 4s)
  • 2FA Required: Wait for code via iMessage, enter automatically
  • Playback Error: Check device availability, suggest alternatives
  • 登录失败:最多重试3次认证,然后通过iMessage通知
  • 会话过期:自动重新认证
  • 速率限制:实现指数退避(1秒、2秒、4秒)
  • 需要双因素认证:等待iMessage发送的验证码,自动输入
  • 播放错误:检查设备可用性,建议替代方案

Self-Improvement Instructions

自我改进说明

When encountering new UI patterns or API changes:
  1. Document the change with screenshots
  2. Update selectors in this skill file
  3. Suggest workflow improvements based on usage patterns
  4. Log successful and failed operations for optimization
当遇到新的UI模式或API变更时:
  1. 截图记录变更内容
  2. 更新本技能文件中的选择器
  3. 根据使用模式建议工作流改进
  4. 记录成功和失败的操作以优化性能

Notes

注意事项

  • Spotify Free accounts have limited skip functionality
  • Some features require Premium subscription
  • Playback control requires an active Spotify client on a device
  • Web player has limitations compared to desktop/mobile apps
  • Spotify免费账户的切歌功能受限
  • 部分功能需要Premium订阅
  • 播放控制需要设备上有活跃的Spotify客户端
  • 网页播放器相比桌面/移动应用存在功能限制