This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Spotify API
#1
Has anyone tried to make this work with LM/SL?

https://engineering.atspotify.com/2022/0...layer-api/
Reply
#2
Go to https://developer.spotify.com/console/ and get your token. Make sure that you have enabled all scopes that you want to use via API.

Set volume example. You also need device id which can be found here: https://developer.spotify.com/console/ge...e-devices/
Code:
http = require('socket.http')
ltn12 = require('ltn12')
json = require('json')

access_token = 'abcdef'
devid = 'abdec'
volume = 40
url = 'https://api.spotify.com/v1/me/player/volume?volume_percent=' .. volume .. '&device_id=' .. devid

res, code, headers = http.request({
  url = url,
  method = 'PUT',
  headers = {
    ['Authorization'] = 'Bearer ' .. access_token,
    ['Content-Length'] = 0
  }
})

log(res, code, headers)
Reply
#3
Wow, thank you very much!
Reply


Forum Jump: