Spotify 链接格式

每一行显示普通网页链接、iPhone URL 方案和 Android 格式。将大写占位符替换为真实值。

内容网页链接iPhone(URL 方案)安卓
曲目https://open.spotify.com/track/IDspotify:track:IDintent://open.spotify.com/track/ID#Intent;package=com.spotify.music;scheme=https;end
专辑https://open.spotify.com/album/IDspotify:album:IDintent://open.spotify.com/album/ID#Intent;package=com.spotify.music;scheme=https;end
播放列表https://open.spotify.com/playlist/IDspotify:playlist:IDintent://open.spotify.com/playlist/ID#Intent;package=com.spotify.music;scheme=https;end
艺术家https://open.spotify.com/artist/IDspotify:artist:IDintent://open.spotify.com/artist/ID#Intent;package=com.spotify.music;scheme=https;end
播客节目https://open.spotify.com/episode/IDspotify:episode:IDintent://open.spotify.com/episode/ID#Intent;package=com.spotify.music;scheme=https;end
Note

Spotify URI(spotify:type:id)是在此列表中 Spotify 自己公开使用的一种格式——你可以从桌面应用的“分享”菜单中复制它们。

Not an official API

大多数应用程序并未正式记录它们的 URL 方案。下面的格式是 DSLink 目前在生产中使用的,但应用程序更新可能会更改它们 — 在将方案硬编码到自己的应用或网站之前,请在真实设备上进行测试。

在网站上使用该方案

URL 方案可以直接放入链接。在 iPhone 上,Safari 会在切换应用前要求访问者确认:

<a href="spotify:track:ID">Open in Spotify</a>

在 Android 上,你可以将网页备用链接添加到 intent 本身。如果应用缺失,Chrome 会打开备用 URL,而不是失败:

intent://open.spotify.com/track/ID#Intent;package=com.spotify.music;scheme=https;S.browser_fallback_url=https%3A%2F%2Fopen.spotify.com%2Ftrack%2FID;end

有两个限制适用于所有情况。如果应用未安装,空方案没有任何有用的功能——iOS 会显示错误。而且像 Instagram、TikTok 或 X 这样的应用内置浏览器通常会阻止或忽略自定义方案,这恰恰是大多数链接被点击的地方。

DSLink 智能链接将所有这些封装在一个短网址中。在手机上,它会尝试为设备使用正确的应用格式,如果没有应用则回退到 Spotify 网页,并将桌面访客直接引导到网站。你可以在各处共享一个链接,并获得点击统计数据。

常见问题

什么是 Spotify URI?

Spotify URI 的格式为 spotify:type:id,例如 spotify:track:ID。它可以直接在 Spotify 应用中打开该项目。

我如何将 Spotify 链接转换为 URI?

从 open.spotify.com 路径中获取类型和 ID:/track/ID 变为 spotify:track:ID。忽略诸如 ?si= 的查询参数。

如果未安装 Spotify 应用,会发生什么?

裸 URL 方案会失败:iOS 会显示错误并且不会打开任何内容。始终将其与网页回退配对——在 Android 上使用 intent 中的 S.browser_fallback_url,或者使用 DSLink 智能链接,它会自动回退到网页。