{"id":14238102,"url":"https://github.com/tr1ckydev/spotifly","last_synced_at":"2025-06-13T08:07:42.967Z","repository":{"id":163188633,"uuid":"635818192","full_name":"tr1ckydev/spotifly","owner":"tr1ckydev","description":"Spotify library in typescript without using the Spotify Web API.","archived":false,"fork":false,"pushed_at":"2023-07-06T12:27:34.000Z","size":59,"stargazers_count":127,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-10T07:44:47.747Z","etag":null,"topics":["npm","spotify","spotify-api","spotify-web-api"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/spotifly","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tr1ckydev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-03T14:14:24.000Z","updated_at":"2025-05-30T03:34:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"157420bb-c624-495a-82a7-a6480af3f43d","html_url":"https://github.com/tr1ckydev/spotifly","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/tr1ckydev/spotifly","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tr1ckydev%2Fspotifly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tr1ckydev%2Fspotifly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tr1ckydev%2Fspotifly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tr1ckydev%2Fspotifly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tr1ckydev","download_url":"https://codeload.github.com/tr1ckydev/spotifly/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tr1ckydev%2Fspotifly/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259606974,"owners_count":22883559,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["npm","spotify","spotify-api","spotify-web-api"],"created_at":"2024-08-21T02:00:50.055Z","updated_at":"2025-06-13T08:07:42.947Z","avatar_url":"https://github.com/tr1ckydev.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# ![](https://open.spotifycdn.com/cdn/images/favicon32.b64ecc03.png) `spotifly`\n\n## Spotify with wings !\n\nSpotify library in typescript without using the [Spotify Web API](https://developer.spotify.com/documentation/web-api).\n\n- No authentication required.\n- Super fast like the Web API.\n- Lightweight with zero dependencies.\n- Strongly typed API functions.\n- Personalized fetching and automation using cookies.\n- Automatic internal token refreshing.\n\n...along with a [Musixmatch API module](#musixmatch-module). Works without any authentication too.\n\n\n\n## 📦 Get Started\n\n- ### Requirement\n\n  `node.js (\u003e=17.5.0)`, `bun` or `deno` runtime.\n\n- ### Installation\n\n  `npm i spotifly` or `bun i spotifly`\n\n- ### Usage\n\n  ```typescript\n  import { Spotifly } from \"spotifly\";\n  \n  const sp = new Spotifly();\n  const track = await sp.getTrack(\"abcdefghijk\");\n  console.log(track);\n  ```\n\n\n\n## 📖 Documentation\n\nFunctions marked with an asterisk (*) require your spotify cookies to work. [How to get your Spotify cookies ?](#-how-to-get-your-spotify-cookies-)\n\n- [`Spotifly` module](#spotifly-module)\n  - [`getHomepage`](#gethomepage-promisespotifyhome)\n  - [`getTrack`](#gettrackid-string-promisespotifytrack)\n  - [`getTrackCredits`](#gettrackcreditsid-string-promisespotifytrackcredits)\n  - [`getRelatedTrackArtists`](#getrelatedtrackartistsid-string-promisespotifyrelatedtrackartists)\n  - [`getArtist`](#getartistid-string-promisespotifyartist)\n  - [`getAlbum`](#getalbumid-string-limit-number-promisespotifyalbum)\n  - [`getPlaylist`](#getplaylistid-string-limit-number-promisespotifyplaylist)\n  - [`getPlaylistMetadata`](#getplaylistmetadataid-string-limit-number-promisespotifyplaylistmetadata)\n  - [`getPlaylistContents`](#getplaylistcontentsid-string-limit-number-promisespotifyplaylistcontents)\n  - [`getUser`](#getuserid-string-config---playlistlimit-number-artistlimit-number-episodelimit-number--promisespotifyuser)\n  - [`getSection`](#getsectionid-string-promisespotifysection)\n  - [`getPodcast`](#getpodcastid-string-promisespotifypodcast)\n  - [`getPodcastEpisodes`](#getpodcastepisodesid-string-limit-number-promisespotifypodcastepisodes)\n  - [`getEpisode`](#getepisodeid-string-promisespotifyepisode)\n  - [`searchAll`](#searchallterms-string-limit-number-promisespotifysearchall)\n  - [`searchTracks`](#searchtracksterms-string-limit-number-promisespotifysearchtracks)\n  - [`searchAlbums`](#searchalbumsterms-string-limit-number-promisespotifysearchalbums)\n  - [`searchPlaylists`](#searchplayliststerms-string-limit-number-promisespotifysearchplaylists)\n  - [`searchArtists`](#searchartiststerms-string-limit-number-promisespotifysearchartists)\n  - [`searchUsers`](#searchusersterms-string-limit-number-promisespotifysearchusers)\n  - [`searchPodcasts`](#searchpodcaststerms-string-limit-number-promisespotifysearchpodcasts)\n  - [`getTrackLyrics`](#gettracklyricsid-string-promisestring)\n  - [`extractImageColors`](#extractimagecolorsurls-string-promisespotifyextractedcolors)\n  - *[`getMyProfile`](#getmyprofile-promisespotifymyprofile)\n  - *[`getMyLibrary`](#getmylibraryconfig-promisespotifymylibrary)\n  - *[`getMyProductState`](#getmyproductstate-promisespotifyproductstate)\n  - *[`getMyLikedSongs`](#getmylikedsongs-promisespotifylikedsongs)\n  - *[`addToLikedSongs`](#addtolikedsongstrackuris-string-promisespotifylikedsongsadd)\n  - *[`removeFromLikedSongs`](#removefromlikedsongstrackuris-string-promisespotifylikedsongsremove)\n  - *[`getTrackColorLyrics`](#gettrackcolorlyricsid-string-imgurl-string-promisespotifycolorlyrics)\n- *[`SpotiflyPlaylist` module](#spotiflyplaylist-module)\n  - [`id`](#id-string)\n  - [`create`](#createname-string)\n  - [`rename`](#renamenewname-string)\n  - [`changeDescription`](#changedescriptionnewdescription-string)\n  - [`fetchMetadata`](#fetchmetadatalimit-number)\n  - [`fetchContents`](#fetchcontentslimit-number)\n  - [`add`](#addtrackuris-string)\n  - [`remove`](#removetrackuris-string)\n  - [`cloneFrom`](#clonefromid-string-config--name-string-description-string-limit-number-)\n  - [`delete`](#delete)\n- [`Musixmatch` module](#musixmatch-module)\n  - [`search`](#searchterms-string-musixmatchsearch)\n  - [`getLyricsFromUrl`](#getlyricsfromurlurl-string-string)\n  - [`searchLyrics`](#searchlyricsterms-string-string)\n- [`Parse` module](#parse-module)\n  - [`urlToId`](#urltoidurl-string-string)\n  - [`uriToId`](#uritoiduri-string-string)\n  - [`urlToUri`](#urltouriurl-string-string)\n  - [`uriToUrl`](#uritourluri-string-string)\n- [How to get your Spotify cookies ?](#-how-to-get-your-spotify-cookies-)\n\n\n\n## `Spotifly` module\n\n### `new Spotifly(cookie?: string)`\n\nThe main module containing all the Spotify API functions.\n\n- ### `getHomepage()`: [*`Promise\u003cSpotifyHome\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/home.ts)\n\n  Fetch the Spotify homepage data.\n\n- ### `getTrack(id: string)`: [*`Promise\u003cSpotifyTrack\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/track.ts)\n\n  Fetch the details of the provided track id.\n\n- ### `getTrackCredits(id: string)`: [*`Promise\u003cSpotifyTrackCredits\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/trackCredits.ts)\n\n  Fetch the credits of the provided track id.\n\n- ### `getRelatedTrackArtists(id: string)`: [*`Promise\u003cSpotifyRelatedTrackArtists\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/relatedTrackArtists.ts)\n\n  Fetch the related artists of the artist of the provided track id.\n\n- ### `getArtist(id: string)`: [*`Promise\u003cSpotifyArtist\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/artist.ts)\n\n  Fetch the details of the provided artist id.\n\n- ### `getAlbum(id: string, limit?: number)`: [*`Promise\u003cSpotifyAlbum\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/album.ts)\n\n  Fetch the details of the provided album id, with optional limit for amount of tracks to fetch.\n\n- ### `getPlaylist(id: string, limit?: number)`: [*`Promise\u003cSpotifyPlaylist\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/playlist.ts)\n\n  Fetch all the details of the provided playlist id, with optional limit for amount of tracks to fetch.\n\n- ### `getPlaylistMetadata(id: string, limit?: number)`: [*`Promise\u003cSpotifyPlaylistMetadata\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/playlistMetadata.ts)\n\n  Fetch the metadata only of the provided playlist id, with optional limit for amount of tracks to fetch.\n\n- ### `getPlaylistContents(id: string, limit?: number)`: [*`Promise\u003cSpotifyPlaylistContents\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/playlistContents.ts)\n\n  Fetch the contents of the provided playlist id, with optional limit for amount of tracks to fetch.\n\n- ### `getUser(id: string, config?: { playlistLimit?: number, artistLimit?: number, episodeLimit?: number })`: [*`Promise\u003cSpotifyUser\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/user.ts)\n\n  Fetch the details of the provided user id, with optional limit for amount of tracks to fetch.\n\n- ### `getSection(id: string)`: [*`Promise\u003cSpotifySection\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/section.ts)\n\n  Fetch the details of the provided section id.\n\n- ### `getPodcast(id: string)`: [*`Promise\u003cSpotifyPodcast\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/podcast.ts)\n\n  Fetch the details of the provided show id.\n\n- ### `getPodcastEpisodes(id: string, limit?: number)`: [*`Promise\u003cSpotifyPodcastEpisodes\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/podcastEpisodes.ts)\n\n  Fetch the episodes of the provided show id, with optional limit for amount of episodes to fetch.\n\n- ### `getEpisode(id: string)`: [*`Promise\u003cSpotifyEpisode\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/episode.ts)\n\n  Fetch the details of the provided episode id.\n\n- ### `searchAll(terms: string, limit?: number)`: [*`Promise\u003cSpotifySearchAll\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/searchAll.ts)\n\n  Search the Spotify library with the terms provided, for all types of content, with optional limit for amount of search results to fetch.\n\n- ### `searchTracks(terms: string, limit?: number)`: [*`Promise\u003cSpotifySearchTracks\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/searchTracks.ts)\n\n  Search the Spotify library with the terms provided, for tracks, with optional limit for amount of search results to fetch.\n\n- ### `searchAlbums(terms: string, limit?: number)`: [*`Promise\u003cSpotifySearchAlbums\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/searchAlbums.ts)\n\n  Search the Spotify library with the terms provided, for albums, with optional limit for amount of search results to fetch.\n\n- ### `searchPlaylists(terms: string, limit?: number)`: [*`Promise\u003cSpotifySearchPlaylists\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/searchPlaylists.ts)\n\n  Search the Spotify library with the terms provided, for playlists, with optional limit for amount of search results to fetch.\n\n- ### `searchArtists(terms: string, limit?: number)`: [*`Promise\u003cSpotifySearchArtists\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/searchArtists.ts)\n\n  Search the Spotify library with the terms provided, for artists, with optional limit for amount of search results to fetch.\n\n- ### `searchUsers(terms: string, limit?: number)`: [*`Promise\u003cSpotifySearchUsers\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/searchUsers.ts)\n\n  Search the Spotify library with the terms provided, for users, with optional limit for amount of search results to fetch.\n\n- ### `searchPodcasts(terms: string, limit?: number)`: [*`Promise\u003cSpotifySearchPodcasts\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/searchPodcasts.ts)\n\n  Search the Spotify library with the terms provided, for podcasts and shows, with optional limit for amount of search results to fetch.\n\n- ### `getTrackLyrics(id: string)`: *`Promise\u003cstring[]\u003e`*\n\n  Fetch the lyrics of the provided track id through the [`Musixmatch`](#musixmatch-module) module.\n\n  If you want to fetch lyrics directly from Spotify, see [`getTrackColorLyrics`](#gettrackcolorlyricsid-string-imgurl-string-promisespotifycolorlyrics).\n\n- ### `extractImageColors(...urls: string[])`: [*`Promise\u003cSpotifyExtractedColors\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/extractedColors.ts)\n\n  Extract raw, dark and light colors from the provided urls of images using Spotify API.\n\n\u003e The following functions require cookies to work. [How to get your Spotify cookies ?](#-how-to-get-your-spotify-cookies-)\n\n- ### `getMyProfile()`: [*`Promise\u003cSpotifyMyProfile\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/myProfile.ts)\n\n  Fetch the details of your Spotify profile.\n\n- ### `getMyLibrary(config?)`: [*`Promise\u003cSpotifyMyLibrary\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/myLibrary.ts)\n\n  Fetch your Spotify library.\n\n  - config.filter?: `[] | [\"Playlists\"] | [\"Playlists\", \"By you\"] | [\"Artists\"]`\n  - config.order?: `\"Recents\" | \"Recently Added\" | \"Alphabetical\" | \"Creator\" | \"Custom Order\"`\n  - config.textFilter?: `string`\n  - config.limit?: `number`\n\n- ### `getMyProductState()`: [*`Promise\u003cSpotifyProductState\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/productState.ts)\n\n  Fetch the details of your Spotify product state like premium plan, etc.\n\n- ### `getMyLikedSongs()`: [*`Promise\u003cSpotifyLikedSongs\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/likedSongs.ts)\n\n  Fetch the songs you have liked from your Spotify library.\n\n- ### `addToLikedSongs(...trackUris: string[])`: [*`Promise\u003cSpotifyLikedSongsAdd\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/likedSongs.ts)\n\n  Add the tracks to your liked songs library.\n\n- ### `removeFromLikedSongs(...trackUris: string[])`: [*`Promise\u003cSpotifyLikedSongsRemove\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/likedSongs.ts)\n\n  Remove the tracks from your liked songs library.\n\n- ### `getTrackColorLyrics(id: string, imgUrl?: string)`: [*`Promise\u003cSpotifyColorLyrics\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/likedSongs.ts)\n\n  Fetch the track lyrics directly from Spotify's internal Musixmatch API with an optional image url to fetch the colors of that image.\n\n\n\n## `SpotiflyPlaylist` module\n\n### `new SpotiflyPlaylist(cookie: string)`\n\nThe module containing all the functions to interact with playlists in your Spotify library using the cookies provided. [How to get your Spotify cookies ?](#-how-to-get-your-spotify-cookies-)\n\n- ### `id`: `string`\n\n  Property to get or set the playlist id with whom the following functions will be interacting.\n\n- ### `create(name: string)`\n\n  Create a new empty playlist with the provided name in your Spotify library and sets the `id` with the newly created one.\n\n- ### `rename(newName: string)`\n\n  Change the name of the playlist with the new name provided.\n\n- ### `changeDescription(newDescription: string)`\n\n  Change the description of the playlist with the new description provided.\n\n- ### `fetchMetadata(limit?: number)`\n\n  Fetch the metadata of the playlist.\n\n- ### `fetchContents(limit?: number)`\n\n  Fetch the contents of the playlist.\n\n- ### `add(...trackUris: string[])`\n\n  Add tracks to the playlist from the provided track uris.\n\n- ### `remove(...trackUris: string[])`\n\n  Remove tracks from the playlist from the provided track uris.\n\n- ### `cloneFrom(id: string, config?: { name?: string, description?: string, limit?: number; })`\n\n  Create a new playlist in your Spotify library by cloning from another playlist with optional config to change the data of the created playlist and sets the `id` with the newly created one.\n\n- ### `delete()`\n\n  Delete the playlist from your Spotify library.\n\n\n\n## `Musixmatch` module\n\nThe Musixmatch API module containing functions to search and fetch lyrics. No authentication needed.\n\n- ### `search(terms: string)`: [*`Promise\u003cMusixmatchSearch[]\u003e`*](https://github.com/tr1ckydev/spotifly/blob/main/src/types/musixmatchSearch.ts)\n\n  Search the Musixmatch library with the terms provided.\n\n- ### `getLyricsFromUrl(url: string)`: *`string[]`*\n\n  Fetch the lyrics from a Musixmatch lyrics url (i.e. `musixmatch.com/lyrics/abc/xyz`).\n\n- ### `searchLyrics(terms: string)`: *`string[]`*\n\n  Fetch the lyrics of the top result after searching for the terms. Combination of the above two functions but faster.\n\n\n\n## `Parse` module\n\nThe parsing module containing few utility functions.\n\n- ### `urlToId(url: string)`: *`string`*\n\n  Extract the id from an `open.spotify.com` url.\n\n- ### `uriToId(uri: string)`: *`string`*\n\n  Extract the id from a Spotify uri (i.e. `spotify:track:abcdefghijk`).\n  \n- ### `urlToUri(url: string)`: `string`\n\n  Convert an `open.spotify.com` url to a Spotify uri (i.e. `spotify:track:abcdefghijk`).\n\n- ### `uriToUrl(uri: string)`: `string`\n\n  Convert a Spotify uri (i.e. `spotify:track:abcdefghijk`) to an `open.spotify.com` url.\n\n\n\n## 🍪 How to get your Spotify cookies ?\n\n- Login to your Spotify account in your browser.\n- Open *Developer Tools* of your browser and switch to *Network* tab.\n- Go to https://open.spotify.com/.\n- Find the request with the name `open.spotify.com` and open it.\n- From the *Headers* tab, scroll to *Request Headers* section.\n- Copy the contents of the `Cookie` header value.\n\nThe copied value is your Spotify cookies.\n\n\n\n## 📜 License\n\nThis repository uses MIT License. See [LICENSE](https://github.com/tr1ckydev/spotifly/blob/main/LICENSE) for full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftr1ckydev%2Fspotifly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftr1ckydev%2Fspotifly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftr1ckydev%2Fspotifly/lists"}