[go: nahoru, domu]

spotify-finder-nextgen
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Spotify Finder Nextgen

A Node.js module for interacting with Spotify's API, providing functions to search for queries and fetch details about artists, songs, and playlists.

Installation

To install the module, run:

npm install spotify-finder-nextgen

Usage

Importing the Module

In a CommonJS environment:

const { search, artist, song, playlist } = require('spotify-finder-nextgen');

In an ES module environment:

import { search, artist, song, playlist } from 'spotify-finder-nextgen';

Functions

search(query: string): Promise<any>

Search for a query in Spotify. Returns search results.

Parameters:

  • query (string): The search query. Links are not allowed.

Example:

(async () => {
  try {
    const results = await search('Duvet');
    console.log(results);
  } catch (error) {
    console.error(error);
  }
})();

Result JSON:

{
  "songs": [
    {
      "title": "Faded (Raw)",
      "subtitle": "Song • Illest Morena",
      "imageUrl": "https://i.scdn.co/image/ab67616d00001e023fe0c03eeae2ff5e1dc1f26f",
      "url": "https://open.spotify.com/track/title-5AxEGHRwgBqFDZ20ilkCw6"
    }
    // More results...
  ],
  "artists": [
    {
      "title": "Illest Morena",
      "subtitle": "Artist",
      "imageUrl": "https://i.scdn.co/image/ab6761610000e5eb3b543ea28fd14957c84d03cb",
      "url": "https://open.spotify.com/artist/title-2zRoFfKfqM5jaUysSG9EUI"
    }
    // More results...
  ],
  "playlists": [
    {
      "title": "geng geng playlist",
      "subtitle": "Playlist",
      "imageUrl": "https://image-cdn-ak.spotifycdn.com/image/ab67706c0000da8423376c1b45353026e9155c9b",
      "url": "https://open.spotify.com/playlist/title-68m9Cno8OO81Y5OnlrtpEh"
    }
    // More results...
  ]
}

artist(link: string): Promise<any>

Fetch details about a specific artist.

Parameters:

  • link (string): The Spotify artist link.

Example:

(async () => {
  try {
    const artistDetails = await artist('https://open.spotify.com/artist/5jTtGLk1mGFMY5lQOvJYUj');
    console.log(artistDetails);
  } catch (error) {
    console.error(error);
  }
})();

Result JSON:

{
  "artistName": "bôa",
  "artistProfile": "https://i.scdn.co/image/ab67616100005174d699423e4d35ff7a7fb66b7d",
  "about": {
    "monthlyListeners": "8,008,828 monthly listeners",
    "description": "bôa is a British alt-rock band originally formed in London in 1992. ...",
    "socialMedia": [
      {
        "platform": "Facebook",
        "link": "https://facebook.com/...."
      },
      {
        "platform": "Instagram",
        "link": "https://instagram.com/...."
      }
    ]
  },
  "popularSongs": [
    {
      "title": "Duvet",
      "plays": "476,425,699",
      "image": "https://i.scdn.co/image/ab67616d000048519e030b804258dc2017ad859f"
    }
    // More results...
  ],
  "albums": [
    {
      "title": "Twilight",
      "year": "Album • 2010",
      "image": "https://i.scdn.co/image/ab67616d00001e029e030b804258dc2017ad859f",
      "link": "https://open.spotify.com/album/7sGYAV0xv7ZfAMzIpMl8m1"
    }
    // More results...
  ],
  "singlesAndEPs": [
    {
      "title": "Twilight",
      "year": "Album • 2010",
      "image": "https://i.scdn.co/image/ab67616d00001e029e030b804258dc2017ad859f",
      "link": "https://open.spotify.com/album/7sGYAV0xv7ZfAMzIpMl8m1"
    }
    // More results...
  ],
  "featuring": [
    {
      "title": "Twilight",
      "year": "Album • 2010",
      "image": "https://i.scdn.co/image/ab67616d00001e029e030b804258dc2017ad859f",
      "link": "https://open.spotify.com/album/7sGYAV0xv7ZfAMzIpMl8m1"
    }
    // More results...
  ],
  "onTour": [],
  "artistPlaylists": [
    {
      "title": "Twilight",
      "image": "https://i.scdn.co/image/ab67616d00001e029e030b804258dc2017ad859f",
      "link": "https://open.spotify.com/album/7sGYAV0xv7ZfAMzIpMl8m1"
    }
    // More results...
  ]
}

song(link: string): Promise<any>

Fetch details about a specific song.

Parameters:

  • link (string): The Spotify track link.

Example:

(async () => {
  try {
    const songDetails = await song('https://open.spotify.com/track/0wEeW8Bwr0fHXuS2zLiDXk');
    console.log(songDetails);
  } catch (error) {
    console.error(error);
  }
})();

Result JSON:

{
  "title": "Duvet - Sped Up Version",
  "artist": "bôa",
  "image": "https://i.scdn.co/image/ab67616d00001e02786d2ae38a7a469bf4218d4a",
  "duration": "3:02",
  "lyrics": "And you don't seem to understand ...",
  "audio": "http://puppeteer-scrape-production.up.railway.app/spotify/downloads/Duvet---Sped-Up-Version.mp3"
}

playlist(link: string): Promise<any>

Fetch details about a specific playlist.

Parameters:

  • link (string): The Spotify playlist link.

Example:

(async () => {
  try {
    const playlistDetails = await playlist('https://open.spotify.com/playlist/37i9dQZEVXbNBz9cRCSFkY');
    console.log(playlistDetails);
  } catch (error) {
    console.error(error);
  }
})();

Result JSON:

{
  "title": "Top 50 - Philippines",
  "image": "https://charts-images.scdn.co/assets/locale_en/regional/daily/region_ph_default.jpg",
  "description": "Your daily update of the most played tracks right now - Philippines.",
  "saves": "1,361,515 saves",
  "tracks": [
    {
      "title": "sining (feat. Jay R)",
      "artist": "Dionela, Jay R",
      "image": "https://i.scdn.co/image/ab67616d0000485119f16592da6f918a04ef6b7c"
    }
    // More tracks...
  ]
}

License

MIT License. See LICENSE for details.

Readme

Keywords

none

Package Sidebar

Install

npm i spotify-finder-nextgen

Weekly Downloads

14

Version

1.1.0

License

MIT

Unpacked Size

24.3 kB

Total Files

13

Last publish

Collaborators

  • project-nextgen