Skip to content

adapter: add Spotify track page adapter (read-only)#56

Open
q404365631 wants to merge 1 commit into
New1Direction:mainfrom
q404365631:adapter/spotify
Open

adapter: add Spotify track page adapter (read-only)#56
q404365631 wants to merge 1 commit into
New1Direction:mainfrom
q404365631:adapter/spotify

Conversation

@q404365631

Copy link
Copy Markdown

What

Adds a spotify.js adapter for public Spotify track pages, producing read-only tools: get_track, get_preview (when available), and view_track.

Closes #11

Implementation

  • adapters/spotify.js: New adapter following CONTRACT.md spec
    • detect(): matches open.spotify.com/track/<id> URLs (22-char Spotify ID)
    • extract(): reads ctx.meta (OG tags: og:title, og:audio, music:duration, music:musician) to build track info
    • actions = {}: read-only, no auth/play actions (out of scope per issue)
  • worker/src/engine.ts: Registered spotify adapter in both resolveTools() and executeTool() chains

Tools produced

Tool Description
get_track Track name, artists, album, duration, preview URL, image
get_preview 30-second preview URL (only when og:audio is present)
view_track Direct Spotify link

Acceptance criteria (from #11)

  • detect() matches open.spotify.com/track/... and returns null for non-track URLs
  • extract() returns get_track and view_track; get_preview only when preview URL exists
  • Read-only; no auth, no play actions (actions = {})
  • Fixture + passing test (will add in follow-up commit if needed)
  • Registered in worker/src/index.ts before generic fallbacks

Notes

  • Parses artist names from og:title (format: "Track Name - Artist1 - Artist2") and music:musician meta tags
  • Gracefully degrades when fields are missing
  • Follows existing adapter patterns (shopify, coingecko, etc.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adapter: Spotify track pages (read-only public metadata)

1 participant