Spotify App API - 播放列表订阅 [英] Spotify App API - Playlist Subscribe

查看:30
本文介绍了Spotify App API - 播放列表订阅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看APP API,您似乎可以确定用户是否订阅了播放列表.但是,我的应用要求用户能够订阅或取消订阅播放列表.

Looking at the APP API, it seems like you can determine whether or not a user is subscribed to a playlist or not. However, my app requires the user to be able to subscribe or un-subscribe from a playlist.

这完全可以使用 Javascript App API 吗?

Is this possible using the Javascript App API at all?

推荐答案

对于当前登录的用户,您可以通过设置播放列表的 subscribed 属性来订阅和取消订阅播放列表.

For the currently logged in user you can subscribe and unsubscribe from a playlist by setting the playlist's subscribed property.

var m = sp.require('sp://import/scripts/api/models')
var playlist = m.Playlist.fromURI('spotify:user:<otherUser>:playlist:<playlist>')

playlist.subscribed

> false

playlist.subscribed = true
playlist.subscribed

> true

playlist.subscribed = false
playlist.subscribed

> false

这篇关于Spotify App API - 播放列表订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆