Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

spotifly

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spotifly

Spotify library in typescript without using the Spotify Web API.

Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

spotifly

Spotify with wings !

Spotify library in typescript without using the Spotify Web API.

  • No authentication required.
  • Super fast like the Web API.
  • Lightweight with zero dependencies.
  • Strongly typed API functions.
  • Automatic internal token refreshing.

...along with a Musixmatch API module. Works without any authentication too.

📦 Get Started

  • Requirement

    node.js (>=17.5.0) or bun runtime.

  • Installation

    npm i spotifly or bun i spotifly

  • Usage

    import { Spotifly } from "spotifly";
    
    const sp = new Spotifly();
    const track = await sp.getTrack("abcdefghijk");
    console.log(track);
    

📖 Documentation

Spotifly module

The main module containing all the Spotify API functions.

  • getHomepage(): Promise<SpotifyHome>

    Fetch the Spotify homepage data.

  • getTrack(id: string): Promise<SpotifyTrack>

    Fetch the details of the provided track id.

  • getRelatedTrackArtists(id: string): Promise<SpotifyRelatedTrackArtists>

    Fetch the related artists of the artist of the provided track id.

  • getArtist(id: string): Promise<SpotifyArtist>

    Fetch the details of the provided artist id.

  • getAlbum(id: string, limit?: number): Promise<SpotifyAlbum>

    Fetch the details of the provided album id, with optional limit for amount of tracks to fetch.

  • getPlaylist(id: string, limit?: number): Promise<SpotifyPlaylist>

    Fetch the details of the provided playlist id, with optional limit for amount of tracks to fetch.

  • getUser(id: string, config?: { playlistLimit?: number, artistLimit?: number, episodeLimit?: number }): Promise<SpotifyUser>

    Fetch the details of the provided user id, with optional limit for amount of tracks to fetch.

  • getSection(id: string): Promise<SpotifySection>

    Fetch the details of the provided section id.

  • getPodcast(id: string): Promise<SpotifyPodcast>

    Fetch the details of the provided show id.

  • getPodcastEpisodes(id: string, limit?: number): Promise<SpotifyPodcastEpisodes>

    Fetch the episodes of the provided show id, with optional limit for amount of episodes to fetch.

  • getEpisode(id: string): Promise<SpotifyEpisode>

    Fetch the details of the provided episode id.

  • searchAll(terms: string, limit?: number): Promise<SpotifySearchAll>

    Search the Spotify library with the terms provided, for all types of content, with optional limit for amount of search results to fetch.

  • searchTracks(terms: string, limit?: number): Promise<SpotifySearchTracks>

    Search the Spotify library with the terms provided, for tracks, with optional limit for amount of search results to fetch.

  • searchAlbums(terms: string, limit?: number): Promise<SpotifySearchAlbums>

    Search the Spotify library with the terms provided, for albums, with optional limit for amount of search results to fetch.

  • searchPlaylists(terms: string, limit?: number): Promise<SpotifySearchPlaylists>

    Search the Spotify library with the terms provided, for playlists, with optional limit for amount of search results to fetch.

  • searchArtists(terms: string, limit?: number): Promise<SpotifySearchArtists>

    Search the Spotify library with the terms provided, for artists, with optional limit for amount of search results to fetch.

  • searchUsers(terms: string, limit?: number): Promise<SpotifySearchUsers>

    Search the Spotify library with the terms provided, for users, with optional limit for amount of search results to fetch.

  • searchPodcasts(terms: string, limit?: number): Promise<SpotifySearchPodcasts>

    Search the Spotify library with the terms provided, for podcasts and shows, with optional limit for amount of search results to fetch.

  • getTrackLyrics(id: string): Promise<string[]>

    Fetch the lyrics of the provided track id through the Musixmatch module.

  • extractImageColors(...urls: string[]): Promise<SpotifyExtractedColors>

    Extract raw, dark and light colors from the provided urls of images using Spotify API.

Musixmatch module

The Musixmatch API module containing functions to search and fetch lyrics. No authentication needed.

  • search(terms: string): Promise<MusixmatchSearch[]>

    Search the Musixmatch library with the terms provided.

  • getLyricsFromUrl(url: string): string[]

    Fetch the lyrics from a Musixmatch lyrics url (i.e. musixmatch.com/lyrics/abc/xyz).

  • searchLyrics(terms: string): string[]

    Fetch the lyrics of the top result after searching for the terms. Combination of the above two functions but faster.

Parse module

The parsing module containing few utility functions.

  • urlToId(url: string): string

    Extract the id from an open.spotify.com url.

  • uriToId(uri: string): string

    Extract the id from a spotify uri (i.e. spotify:track:abcdefghijk).

📜 License

This repository uses MIT License. See LICENSE for full license text.

Keywords

api

FAQs

Package last updated on 09 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts