1.1.1 • Published 4 years ago

@spdl-core/typescript v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

@spdl-core/typescript

Spotify track downloader module. Written in pure javascript.

Requires node >=14

Credentials

The module need a Spotify clientId and clientSecret to work, the module provide you one but if too much people use the module with this credentials, you will be rate limited and the module won't work. To avoid this, you should set your own credentials. To do that, go to The Spotify developers dashboard and create an application. Copy your credentials and paste it with:

spdl.setCredentials("Your app's clientId", "Your app's clientSecret");
// or
spdl.setClientId("Your app's clientId");
spdl.setClientSecret("Your app's clientSecret");

Support

You can contact us for support on our chat server

Usage

const fs = require('fs');
import spdl from '@spdl-core/typescript';

spdl.getInfo('https://open.spotify.com/track/18yTgk0VgjB9XDj8h2q6Td').then(infos => {
  spdl(infos.url).then(stream => {
    fs.createWriteStream(`${infos.title}.mp3`);
  });
});

API

async spdl(url)

Downloads the track from the given url. Returns a readable stream

async spdl.getInfo(url)

Gives the information of a track

spdl.validateURL(url)

Returns true if url is a spotify track link

spdl.setCredentials("Your app's clientId", "Your app's clientSecret")

spdl.setClientId("Your app's clientId")

spdl.setClientSecret("Your app's clientSecret")

Sets the module credentials to yours

Limitations

Generated download links are valid for 6 hours, and may only be downloadable from the same IP address.

Install

npm install @spdl-core/typescript@latest

Or for Yarn users:

yarn add @spdl-core/typescript@latest

Make sure you're installing the latest version of spdl-core to keep up with the latest fixes.

Related Projects

  • spdl-core - A javascript version of this.
  • spdl - A cli wrapper of this.

Note

There is nothing illegal here, the module just searches for the song on Youtube and downloads it.