# @tireoz/spotify

> A DisTube custom plugin for supporting Spotify with SoundCloud.

Latest version **1.0.2** (published 2023-01-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tireoz/spotify
pnpm add @tireoz/spotify
yarn add @tireoz/spotify
bun add @tireoz/spotify
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2023-01-09 |
| First published | 2023-01-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 43.9 KB |
| Known vulnerabilities | 0 (+12 in 1 direct dependencies) |
| Install scripts | yes |
| GitHub stars | 1 |
| Author | MissaDevs |
| Maintainers | xzmisa |
| Keywords | distube, plugin, spotify, discord, music, soundcloud |

## Links

- npm: https://www.npmjs.com/package/@tireoz/spotify
- Repository: https://github.com/Tireoz/spotify
- Homepage: https://github.com/Tireoz/spotify#readme
- Issues: https://github.com/Tireoz/spotify/issues
- npm.io page: https://npm.io/package/@tireoz/spotify

## Dependencies (5)

- [undici](https://npm.io/package/undici.md) ^5.14.0
- [spotify-uri](https://npm.io/package/spotify-uri.md) ^3.0.3
- [spotify-url-info](https://npm.io/package/spotify-url-info.md) ^3.1.10
- [@distube/soundcloud](https://npm.io/package/@distube/soundcloud.md) ^1.3.0
- [spotify-web-api-node](https://npm.io/package/spotify-web-api-node.md) ^5.0.2

## Alternatives

- [pagerjs](https://npm.io/package/pagerjs.md) — 60 weekly downloads
- [whistle.savefor-mock](https://npm.io/package/whistle.savefor-mock.md) — 4 weekly downloads
- [@depup/casual](https://npm.io/package/@depup/casual.md) — 0 weekly downloads
- [@availity/mock-server](https://npm.io/package/@availity/mock-server.md) — 0 weekly downloads
- [@scotthuang/agent-knock-knock-pi](https://npm.io/package/@scotthuang/agent-knock-knock-pi.md) — 0 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2023-01-09
- 1.0.1 — 2023-01-08
- 1.0.0 — 2023-01-08

## README

<div align="center">
  <p>
    <a href="https://nodei.co/npm/@tireoz/spotify"><img src="https://nodei.co/npm/@tireoz/spotify.png?downloads=true&downloadRank=true&stars=true"></a>
  </p>
  <p>
    <a href="https://nodei.co/npm/distube"><img alt="npm peer dependency version" src="https://img.shields.io/npm/dependency-version/@tireoz/spotify/peer/distube?style=flat-square"></a>
    <a href="https://nodei.co/npm/distube"><img alt="npm" src="https://img.shields.io/npm/dt/@tireoz/spotify?logo=npm&style=flat-square"></a>
    <img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/tireoz/spotify?logo=github&logoColor=white&style=flat-square">
    <a href="https://discord.gg/feaDd9h"><img alt="Discord" src="https://img.shields.io/discord/732254550689316914?logo=discord&logoColor=white&style=flat-square"></a>
  </p>
</div>

# @tireoz/spotify

A DisTube custom plugin for supporting Spotify URL.

## Feature

This plugin grabs the songs on Spotify then searches on SoundCloud and plays with DisTube.

## Installation

```sh
npm install @tireoz/spotify@latest
```

## Usage

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

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

```ts
import { Client } from "discord.js";
import { DisTube } from "distube";
import { SpotifyPlugin } from "@tireoz/spotify";

const client = new Client();
const distube = new DisTube(client, {
  plugins: [new SpotifyPlugin()],
});
```

## Documentation

### SpotifyPlugin([SpotifyPluginOptions])

- `SpotifyPluginOptions.parallel`: Default is `true`. Whether or not searching the playlist in parallel.
- `SpotifyPluginOptions.emitEventsAfterFetching`: Default is `false`. Emits `addList` and `playSong` event before or after fetching all the songs.
  > If `false`, DisTube plays the first song -> emits `addList` and `playSong` events -> fetches all the rest\
  > If `true`, DisTube plays the first song -> fetches all the rest -> emits `addList` and `playSong` events
- `SpotifyPluginOptions.api`: (Optional) Spotify API options.
  - `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

```js
new SpotifyPlugin({
  parallel: true,
  emitEventsAfterFetching: false,
  api: {
    clientId: "SpotifyAppClientID",
    clientSecret: "SpotifyAppClientSecret",
    topTracksCountry: "VN",
  },
});
```

---
_Source: https://npm.io/package/@tireoz/spotify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
