Skip to content

jjdenhertog/tidal-music-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tidal Music Search

The tidal-music-search library provides an efficient way to search for tracks on Tidal. Building on music-search, this library connects to Tidal's API to find tracks.

Table of Contents

Installation

Install the tidal-music-search library with npm:

npm install @jjdenhertog/tidal-music-search

Connecting with Tidal

The library requires Tidal API credentials, which you can pass on while initializing the library.

const tidalMusicSearch = new TidalMusicSearch({
  clientId: 'your_client_id',
  clientSecret: 'your_client_secret'
});

Getting Tidal API Client ID and Secret

To obtain your Tidal API client ID and client secret, you need to register for access to the Tidal API. Visit the Tidal Developer Portal to apply for API access and retrieve your credentials.

Usage

import TidalMusicSearch, { TidalMusicSearchTrack } from '@jjdenhertog/tidal-music-search';

const tidalMusicSearch = new TidalMusicSearch({
  clientId: process.env.TIDAL_API_CLIENT_ID,
  clientSecret: process.env.TIDAL_API_CLIENT_SECRET
});

const searchItems: TidalMusicSearchTrack[] = [
{ id: '125', title: 'Billie Jean', album: 'Thriller', artists: ['Michael Jackson']},
  // Add more tracks as needed
];

async function searchTracks() {
  try {
    const searchResult = await tidalMusicSearch.search(searchItems);
    console.log(searchResult);
  } catch (error) {
    console.error('Error searching tracks:', error);
  }
}

searchTracks();

In this example, the search method is used to find tracks on Tidal that match the specified criteria.

What is with the ID while searching?

You might notice that the search query must contain an ID

const searchItems: TidalMusicSearchTrack[] = [
  { id: '125', title: 'Billie Jean', album: 'Thriller', artists: ['Michael Jackson']},
  // Add more tracks as needed
];

Most of the times when you're searching for a track you are doing it to match one library with the other. For example matching Spotify with Plex. The result after searching will contain the original search query including the id and the results. The results are all the tracks matching with the search query. With this approach you can trace back the results more easily.

If you do not need the id for this purpose, you can simply leave it empty:

{ id: '', title: 'Billie Jean', album: 'Thriller', artists: ['Michael Jackson']}

Support This Open-Source Project ❤️

If you appreciate my work, consider starring this repository or making a donation to support ongoing development. Your support means the world to me—thank you!

Buy Me a Coffee

Are you a developer and have some free time on your hand? It would be great if you can help me maintain and improve this library.

About

Find tracks in Tidal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published