Coder Social home page Coder Social logo

tidalapi's Introduction

TidalAPI

Build Status npm version npm downloads NPM David

About

node.js TIDAL API. Use the TIDAL Web API simply using this module ;)

Created by Lucas Vasconcelos

NOTE: Currently not supporting facebook login.

How to use

Run the following:

npm install tidalapi

Obtain the Tidal token needed to use this API

As well as a TIDAL username and password, the Tidal API needs an API token which is unique to your apps. You can get this token by network-sniffing some application that uses TIDAL Playback feature, like Tidal for Windows, Tidal for Android, or CapTune from Sennheiser.

Obtaining a token from TIDAL for Windows

  • Install Fiddler and start it.
  • In Fiddler, click Tools > Options > Decrypt HTTPS Traffic
  • Install TIDAL for Windows and start it
  • In Fiddler, look for requests to api.tidal.com. Click a request, then on the right, click Inspectors > Headers. Underneath Miscellaneous you'll see X-Tidal-Token. This is a TIDAL Token you can use.

Usage

Simple usage searching and querying a track list

var TidalAPI = require('tidalapi');

var api = new TidalAPI({
  username: 'your-username-here',
  password: 'your-password-here',
  token: 'your-token-here',
  // Could also be 'LOSSLESS' but this only supported on premium subscriptions
  quality: 'HIGH'
});

Search

api.search({type: 'artists', query: 'Dream Theater', limit: 1}, function(data){
  console.log(data.artists);
})

api.search({type: 'albums', query: 'Dream Theater', limit: 1}, function(data){
  console.log(data.albums);
})

api.search({type: 'tracks', query: 'Dream Theater', limit: 1}, function(data){
  console.log(data.tracks);
})

api.search({type: 'tracks,albums,artists', query: 'Dream Theater', limit: 1}, function(data){
  console.log(data.tracks);
  console.log(data.albums);
  console.log(data.artists);
})

Track info

api.getTrackInfo({id: 22560696 }, function(data){
  console.log(data)
})

Streams

api.getStreamURL({id: 22560696}, function(data){
  console.log(data)
})

api.getVideoStreamURL({id: 25470315}, function(data){
  console.log(data)
})

Album Art

console.log(api.getArtURL('24f52ab0-e7d6-414d-a650-20a4c686aa57', 1280)) //coverid

Videos

api.getArtistVideos({id: 14670, limit: 2}, function(data){
  console.log(data)
})

FLAC tags

api.genMetaflacTags({id: 22560696, coverPath: './albumart.jpg', songPath: './song.flac'}, function(data){
  console.log(data)
  /* --remove-all-tags --set-tag="ARTIST=Dream Theater" --set-tag="TITLE=Along For The Ride" --set-tag="ALBUM=Dream Theater" --set-tag="TRACKNUMBER=8" --set-tag="COPYRIGHT=2013 Roadrunner Records, Inc." -set-tag="DATE=2013" --import-picture-from="./albumart.jpg" "./song.flac" --add-replay-gain */
})

Troubleshooting

500 error with 'Ooops, an unexpected error occurred'

Your TIDAL token is likely incorrect.

tidalapi's People

Contributors

0xvasconcelos avatar dgadelha avatar gyurobenjamin avatar okonek avatar pschroen avatar vicenteguerra avatar yusufusta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tidalapi's Issues

getArtistVideos

Get artist videos by using artist id

api.getArtistVideos({id: 14670}, function(data){
  console.log(data)
})

401 'Client not found'

Hello,
I am trying to get album info from tidal but I get the error Error: {"status":401,"subStatus":8003,"userMessage":"Client not found"}

Does anyone know how to fix it?

License for this repo?

I'm looking at the open source smart home assistant coincidentally called Home Assistant

I'd love to fork this for a potential integration into that platform.

'Ooops, an unexpected error occurred'

\node_modules\tidalapi\lib\client.js:106
        throw new Error(data)
        ^
Error: {"status":500,"subStatus":999,"userMessage":"Ooops, an unexpected error occurred. We'll try to fix this asap!"}

What causes this issue, and is there anything I can do about it? Thanks.

Master quality

Is there a way to get Master quality yet?

I wrote an app about a year and a half ago to download and tag music from Tidal and I'm surprised its still running...but it doesn't get MQA. Not necessary but it would be cool for future proofing. So far the only way I can find to stream MQA is through the desktop app which encrypts files. Android and iOS tokens with the same get request only return the normal FLAC quality.

I'm under the impression that some of the devices that support Tidal support MQA and it might be possible to get a token from one of them. Is there any way to do that besides buying the device? Or if anyone has such a device could they get the token?

deasync issue

/data//tidal/node_modules/bindings/bindings.js:91
throw err
^
Error: Could not locate the bindings file. Tried:
→ /data//tidal/node_modules/deasync/build/deasync.node
→ /data//tidal/node_modules/deasync/build/Debug/deasync.node
→ /data//tidal/node_modules/deasync/build/Release/deasync.node
→ /data//tidal/node_modules/deasync/out/Debug/deasync.node
→ /data//tidal/node_modules/deasync/Debug/deasync.node
→ /data//tidal/node_modules/deasync/out/Release/deasync.node
→ /data//tidal/node_modules/deasync/Release/deasync.node
→ /data//tidal/node_modules/deasync/build/default/deasync.node
→ /data//tidal/node_modules/deasync/compiled/6.11.0/linux/arm/deasync.node
at bindings (/data//tidal/node_modules/bindings/bindings.js:88:9)
at /data//tidal/node_modules/deasync/index.js:34:32
at Object. (/data//tidal/node_modules/deasync/index.js:76:2)

genMetaflacTags

Genarate metaflac tags using track id

api.genMetaflacTags({id: 56537571}, function(data){
  console.log(data);
});

getMyID

Get your user id

api.getMyID()

//output: {Number}

Playback example

Feature request for either built-in playback support, or a Wiki with examples.

Here's one that handles both lossless and high quality with fluent-ffmpeg and speaker:

api.getStreamURL({id:22560696}, function (data) {
  var url = quality === 'lossless' ? data.url : 'rtmp://'+data.url;
  ffmpeg(url).format('wav').pipe(new Speaker(), {end:true}).on('finish', function () {
    console.log('track finished');
  });
});

Sometimes there is dirty noise when playing

I am using fluent-ffmpeg and waw.Reader and Speaker to play and sometimes it has got strange noise instead of music. I dno't know where is the problem. Could you hel me?
Thanks!

getVideoStreamURL

Get video stream url using video id

api.getVideoStreamURL({id: 25334729}, function(data){
 console.log(data.url)
})

getUser

Get user informations

api.getUser({id: USER_ID}, function(data){
  console.log(data)
})

getTopTracks

Get artist top tracks by using artist id

api.getTopTracks({id: 14670}, function(data){
  console.log(data.items)
})

Error 404

Hello, is this api has been fixed ? I got an 404 error all the time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.