Skip to content
This repository has been archived by the owner on Jun 4, 2020. It is now read-only.

Files

Latest commit

 

History

History
569 lines (476 loc) · 17.5 KB

api.md

File metadata and controls

569 lines (476 loc) · 17.5 KB

Tidal

Class

Kind: global class

new Tidal([options])

Param Type Default Description
[options] object Tidal options (optional)
[options.countryCode] string "US" Tidal country code
[options.limit] number 1000 API results limit

tidal.login(username, password) ⇒ Promise

login to Tidal in order to use methods that require authentication

Kind: instance method of Tidal
Fulfil: Object - user data object (see example for object properties)
Reject: Error

Param Type Description
username string Tidal username or email
password string Tidal password

Example

tidal.login('username', 'password')
// returns a promise that resolves to
  {
    userId: 49927020,
    sessionId: '24d3d406-e6b9-457a-bf57-eac7b113a20c',
    countryCode: 'US'
  }

tidal.search(query, type, [limit]) ⇒ Promise

search for artists, albums, tracks, or playlists

Kind: instance method of Tidal
Fulfil: Array - an array of objects (object properties are dependent on search type)
Reject: Error

Param Type Default Description
query string search query
type string search type ('artists', 'albums', 'tracks', 'playlists')
[limit] number 25 search limit

Example

tidal.search('Four Year Strong', 'artists', 1)
// returns a promise that resolves to:
  [
        {
            "id": 3575680,
            "name": "Four Year Strong",
            "url": "http://www.tidal.com/artist/3575680",
            "picture": "04d63cd8-a1a5-42e0-b1ec-8e336b7d9200",
            "popularity": 28
        }
    ]

tidal.getTrack(id) ⇒ Promise

get a track by its id

Kind: instance method of Tidal
Fulfil: Object - a track object (see example for object properties)
Reject: Error

Param Type Description
id number track id

Example

tidal.getTrack(64975224)
// returns a promise that resolves to:
  {
    "id": 64975224,
    "title": "22 (OVER S∞∞N)",
    "duration": 168,
    "replayGain": -10.71,
    "peak": 0.692531,
    "allowStreaming": true,
    "streamReady": true,
    "streamStartDate": "2016-09-30T00:00:00.000+0000",
    "premiumStreamingOnly": false,
    "trackNumber": 1,
    "volumeNumber": 1,
    "version": null,
    "popularity": 47,
    "copyright": "2016 Jagjaguwar",
    "url": "http://www.tidal.com/track/64975224",
    "isrc": "US38Y1630001",
    "editable": true,
    "explicit": false,
    "audioQuality": "LOSSLESS",
    "artist": {
        "id": 3566315,
        "name": "Bon Iver",
        "type": "MAIN"
    },
    "artists": [
        {
            "id": 3566315,
            "name": "Bon Iver",
            "type": "MAIN"
        }
    ],
    "album": {
        "id": 64975223,
        "title": "22, A Million",
        "cover": "5ac41fbb-927b-427e-8224-87bf12d218a3"
    }
  }

tidal.getFavoriteTracks() ⇒ Promise

get your favorite (starred) tracks (requires login() to be called)

Kind: instance method of Tidal
Fulfil: Array - an array of track objects
Reject: Error
See

  • login - login method must be called first
  • getTrack - track object example

Example

tidal.getFavoriteTracks()

tidal.getAlbum(id) ⇒ Promise

get an album by its id

Kind: instance method of Tidal
Fulfil: Object - an album object (see example for object properties)
Reject: Error

Param Type Description
id number album id

Example

tidal.getAlbum(80216363)
// returns a promise that resolves to:
  {
    "id": 80216363,
    "title": "Pacific Daydream",
    "duration": 2069,
    "streamReady": true,
    "streamStartDate": "2017-10-27T00:00:00.000+0000",
    "allowStreaming": true,
    "premiumStreamingOnly": false,
    "numberOfTracks": 10,
    "numberOfVideos": 0,
    "numberOfVolumes": 1,
    "releaseDate": "2017-10-27",
    "copyright": "2017 Weezer under exclusive license to Crush Music / \
    Atlantic Recording Corporation for the United States and Crush Music / \
    WEA International Inc. for the world excluding the United States. \
    A Warner Music Company.",
    "type": "ALBUM",
    "version": null,
    "url": "http://www.tidal.com/album/80216363",
    "cover": "86538ca7-08fd-40ff-9a75-af88d74d1f48",
    "videoCover": null,
    "explicit": false,
    "upc": "075679889355",
    "popularity": 58,
    "audioQuality": "LOSSLESS",
    "artist": {
        "id": 30157,
        "name": "Weezer",
        "type": "MAIN"
    },
    "artists": [
        {
            "id": 30157,
            "name": "Weezer",
            "type": "MAIN"
        }
    ]
  }

tidal.getAlbumTracks(id) ⇒ Promise

get album tracks by album id

Kind: instance method of Tidal
Fulfil: Array - an array of track objects
Reject: Error
See: getTrack - track object example

Param Type Description
id number album id

Example

tidal.getAlbumTracks(80216363)

tidal.getTopAlbums() ⇒ Promise

get top 20 albums on Tidal

Kind: instance method of Tidal
Fulfil: Array - an array of album objects
Reject: Error
See: getAlbum - album object example
Example

tidal.getTopAlbums()

tidal.getNewAlbums() ⇒ Promise

get new albums on Tidal

Kind: instance method of Tidal
Fulfil: Array - an array of album objects
Reject: Error
See: getAlbum - album object example
Example

tidal.getNewAlbums()

tidal.getStaffPickAlbums() ⇒ Promise

get staff pick albums on Tidal

Kind: instance method of Tidal
Fulfil: Array - an array of album objects
Reject: Error
See: getAlbum - album object example
Example

tidal.getStaffPickAlbums()

tidal.getFavoriteAlbums() ⇒ Promise

get your favorite (starred) albums (requires login() to be called)

Kind: instance method of Tidal
Fulfil: Array - an array of album objects
Reject: Error
See

  • login - login method must be called first
  • getAlbum - album object example

Example

tidal.getFavoriteAlbums()

tidal.getArtist(id) ⇒ Promise

get an artist by its id

Kind: instance method of Tidal
Fulfil: Object - an artist object (see example for object properties)
Reject: Error

Param Type Description
id number artist id

Example

tidal.getArtist(3575680)
// returns a promise that resolves to:
  {
    "id": 3575680,
    "name": "Four Year Strong",
    "url": "http://www.tidal.com/artist/3575680",
    "picture": "04d63cd8-a1a5-42e0-b1ec-8e336b7d9200",
    "popularity": 28
  }

tidal.getArtistAlbums(id) ⇒ Promise

get artist albums by artist id

Kind: instance method of Tidal
Fulfil: Array - an array of album objects
Reject: Error
See: getAlbum - album object example

Param Type Description
id number artist id

Example

tidal.getArtistAlbums(3575680)

tidal.getArtistEPsAndSingles(id) ⇒ Promise

get artist EPs and singles by artist id

Kind: instance method of Tidal
Fulfil: Array - an array of album objects
Reject: Error
See: getAlbum - album object example

Param Type Description
id number artist id

Example

tidal.getArtistEPsAndSingles(3575680)

tidal.getArtistCompilations(id) ⇒ Promise

get compliations that artist has appeared on by artist id

Kind: instance method of Tidal
Fulfil: Array - an array of album objects
Reject: Error
See: getAlbum - album object example

Param Type Description
id number artist id

Example

tidal.getArtistCompilations(3575680)

tidal.getArtistTopTracks(id, [limit]) ⇒ Promise

get top tracks by artist

Kind: instance method of Tidal
Fulfil: Array - an array of track objects
Reject: Error
See: getTrack - track object example

Param Type Default Description
id number artist id
[limit] number 10 results limit

Example

tidal.getArtistTopTracks(3575680)

tidal.getSimilarArtists(id) ⇒ Promise

get similar artists

Kind: instance method of Tidal
Fulfil: Object - artist object
Reject: Error
See: getArtist - artist object example

Param Type Description
id number artist id

Example

tidal.getSimilarArtists(3575680)

tidal.getFavoriteArtists() ⇒ Promise

get your favorite (starred) artists (requires login() to be called)

Kind: instance method of Tidal
Fulfil: Array - an array of artist objects
Reject: Error
See

  • login - login method must be called first
  • getArtist - artist object example

Example

tidal.getFavoriteArtists()

tidal.getPlaylist(uuid) ⇒ Promise

get a playlist by its uuid

Kind: instance method of Tidal
Fulfil: Object - playlist object (see example for object properties)
Reject: Error

Param Type Description
uuid string playlist uuid

Example

tidal.getPlaylist('1c5d01ed-4f05-40c4-bd28-0f73099e9648')
// returns a promise that resolves to:
  {
    "uuid": "1c5d01ed-4f05-40c4-bd28-0f73099e9648",
    "title": "Get Down On It: Soul, Funk and Disco Supremo",
    "numberOfTracks": 100,
    "numberOfVideos": 0,
    "creator": {
        "id": 0
    },
    "description": "Get down and dirty with some of the finest soul, funk \
    and four-to-the floor disco out there. Bound to get the blood pumping, \
    this playlist boasts more hits than a boxing match, more hooks than a \
    tackle box and marks the perfect prescription both for champagne days \
    and boogie nights and alike. Whether you feel like being a sex machine \
    or simply wish to dance to the music, rock your body, dig it and don't \
    stop 'til you get enough! ",
    "duration": 25732,
    "lastUpdated": "2017-01-18T16:31:51.839+0000",
    "created": "2016-09-22T16:42:40.911+0000",
    "type": "EDITORIAL",
    "publicPlaylist": true,
    "url": "http://www.tidal.com/playlist/1c5d01ed-4f05-40c4-bd28-0f73099e9648",
    "image": "7a707631-02cf-47d8-a34c-e1395165f169",
    "popularity": 0
  }

tidal.getPlaylistTracks(uuid) ⇒ Promise

get playlist tracks by playlist uuid

Kind: instance method of Tidal
Fulfil: Array - an array of track objects
Reject: Error
See: getTrack - track object example

Param Type Description
uuid string playlist uuid

Example

tidal.getPlaylistTracks('1c5d01ed-4f05-40c4-bd28-0f73099e9648')

tidal.getFavoritePlaylists() ⇒ Promise

get your favorite (starred) playlists (requires login() to be called)

Kind: instance method of Tidal
Fulfil: Array - an array of playlist objects
Reject: Error
See

  • login - login method must be called first
  • getPlaylist - playlist object example

Example

tidal.getFavoritePlaylists()

tidal.getPlaylists() ⇒ Promise

get your created playlists (requires login() to be called)

Kind: instance method of Tidal
Fulfil: Array - an array of playlist objects
Reject: Error
See

  • login - login method must be called first
  • getPlaylist - playlist object example

Example

tidal.getPlaylists()

tidal.artistPicToUrl(uuid) ⇒ Object

get valid urls to artist pictures

Kind: instance method of Tidal

Param Type Description
uuid string artist picture uuid (can be found as picture property in artist object)

Example

tidal.artistPicToUrl('04d63cd8-a1a5-42e0-b1ec-8e336b7d9200')
// returns
  {
    sm: 'https://resources.tidal.com/images/04d63cd8/a1a5/42e0/b1ec/8e336b7d9200/160x107.jpg',
    md: 'https://resources.tidal.com/images/04d63cd8/a1a5/42e0/b1ec/8e336b7d9200/320x214.jpg',
    lg: 'https://resources.tidal.com/images/04d63cd8/a1a5/42e0/b1ec/8e336b7d9200/640x428.jpg'
  }

tidal.albumArtToUrl(uuid) ⇒ Object

get valid urls to album art

Kind: instance method of Tidal

Param Type Description
uuid string album art uuid (can be found as cover property in album object)

Example

tidal.albumArtToUrl('9a56f482-e9cf-46c3-bb21-82710e7854d4')
// returns
  {
    sm: 'https://resources.tidal.com/images/9a56f482-e9cf-46c3-bb21-82710e7854d4/160x160.jpg',
    md: 'https://resources.tidal.com/images/9a56f482-e9cf-46c3-bb21-82710e7854d4/320x320.jpg',
    lg: 'https://resources.tidal.com/images/9a56f482-e9cf-46c3-bb21-82710e7854d4/640x640.jpg',
    xl: 'https://resources.tidal.com/images/9a56f482-e9cf-46c3-bb21-82710e7854d4/1280x1280.jpg'
  }