删除Spotify的播放列表编程 [英] Delete Spotify playlist programatically

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

问题描述

是否可以删除使用JS API一个Spotify的播放列表?我创建数百个错误,但是API似乎不具有移除其中任何明显的方法...

Is it possible to delete a Spotify playlist using the JS API? I've created hundreds in error, but the API doesn't seem to have any obvious way of removing them...

谢谢,

奥德赫。

推荐答案

可以,但它很乏味。

请参阅: https://developer.spotify.com/文档/应用/ API / 1.0 /型号 - collection.html

myTracks.snapshot().done(function(snapshot) {
  myTracks.remove(snapshot.find(track));
});

与播放列表取代跟踪。您需要是这样的:

replace "track" with playlist. You need something like:

library.forCurrentUser().playlists.snapshot(0,1).done(function(s) {
  library.forCurrentUser().playlists.remove(s.find(s.get(0)));
}

这里的gotacha是,如果你试图在一个循环中运行这个,因为快照是陈旧的运行它的第二次它会失败...很讨厌。

The gotacha here is that if you try to run this in a loop it will fail since the snapshot is stale the 2nd time it runs... very annoying.

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

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