@distube/spotify

中文文档
2.0.2发布于 2024/06/14MITTypeScriptCommonJS构建来源已验证近 30 天下载 3814

A DisTube extractor plugin for supporting Spotify.

原始使用文档
文档目录3 节
  1. Usage
  2. Documentation
  3. SpotifyPlugin([SpotifyPluginOptions])

npm peer dependency version npm GitHub Repo stars Discord

Buy Me a Coffee at ko-fi.com

@distube/spotify

A DisTube info extractor plugin for supporting Spotify.

What is an info extractor plugin?

Usage

const Discord = require("discord.js");
const client = new Discord.Client();

const { DisTube } = require("distube");
const { SpotifyPlugin } = require("@distube/spotify");
const distube = new DisTube(client, {
  plugins: [new SpotifyPlugin()],
});

Documentation

SpotifyPlugin([SpotifyPluginOptions])

  • SpotifyPluginOptions.api: (Optional) Spotify API credentials.
    • SpotifyPluginOptions.api.clientId: Client ID of your Spotify application (Optional - Used when the plugin cannot get the credentials automatically)
    • SpotifyPluginOptions.api.clientSecret: Client Secret of your Spotify application (Optional - Used when the plugin cannot get the credentials automatically)
    • SpotifyPluginOptions.api.topTracksCountry: Country code of the top artist tracks (ISO 3166-1 alpha-2 country code). Default is US.

Example

new SpotifyPlugin({
  api: {
    clientId: "SpotifyAppClientID",
    clientSecret: "SpotifyAppClientSecret",
    topTracksCountry: "VN",
  },
});

版本与发布记录

@distube/spotify 共发布 34 个版本,首次发布于 2021/04/29;过去 12 个月发布了 0 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.0.2latest2024/06/142 年前
2.0.12024/06/072 年前
2.0.02024/06/052 年前
1.6.12024/04/202 年前
1.6.02024/03/202 年前
1.5.22023/12/282 年前

关于 @distube/spotify 的常见问题

@distube/spotify 是什么?

A DisTube extractor plugin for supporting Spotify.

如何安装 @distube/spotify?

在项目目录运行 npm install @distube/spotify,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:distube(5)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@distube/spotify 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@distube/spotify 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@distube/spotify 可以商用吗?

@distube/spotify 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@distube/spotify 的下载量有多少?

根据 npm 官方下载统计,@distube/spotify 在 2026/10/13 – 2026/11/11 这 30 天内被下载 3,814 次,日均约 127 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@distube/spotify 还在维护吗?

最新版本 2.0.2 发布于 2024/06/14(2 年前);至今共发布 34 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/04/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。