doubi9531 2014-12-01 21:56
浏览 44
已采纳

使用Deezer API和PHP将曲目添加到播放列表

I have looked through the documentation of the Deezer API and I am unable to fully comprehend how to add a track through their API with PHP, if you can at all. - This is lack of understanding rather than poor documentation.

I am looking for a way to add 100 tracks to a new playlist each week. I have read up on Deez's use of OAuth and the Track API object but I can not for the life me understand how to make the authentication.

In essence, what I am trying to achieve is a web based application where a user can add songs to a playlist. From what I believe, Deezer's OAuth asks a user to allow permissions, but I want my application to have full control of my playlist without having to ask people to login and grant them.

Could I please have more information on whether this is possible and without having to grant permission each time? It would not interact with any other user accounts, but my own.

  1. User searches for Track ID
  2. Form obtains Track ID via API call
  3. User submits and Track ID is added to playlist ID

UPDATE:

I have since figured out how to add the track using OAuth. However, for someone else to add a track after submitting using a form (step 3), they would need to login to and accept the OAuth Permissions. Is there a way I can just set it so my code always has permission to add tracks to the playlist?

  • 写回答

1条回答 默认 最新

  • dongshenjie3055 2014-12-03 08:14
    关注

    First, you have to get a token (just like here: http://developers.deezer.com/api/explorer) if you want to create a private playlist, or just create a public collaborative playlist (so people can add tracks to your playlist).

    The first thing you have to do is to create a playlist via a POST call to user/me|[your user ID]/playlist (http://developers.deezer.com/api/user/playlists) and the access token.

    Then you just have to execute a POST call to /playlyst[ID of your playlist]/tracks (http://developers.deezer.com/api/playlist/tracks) to add the defined tracks.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 phython读取excel表格报错 ^7个 SyntaxError: invalid syntax 语句报错
  • ¥20 @microsoft/fetch-event-source 流式响应问题
  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?