Closed glebliutsko closed 4 years ago
В веб-версии на странице плейлиста есть секция "Рекомендуемые треки".
GET /users/{user}/playlists/{kind}/recommendations
Авторизация обязательна. Работает только для плейлистов, в которые пользователь может добавлять треки (собственые и коллективные), иначе возвращается ошибка access-denied.
access-denied
batchId
tracks
{ "invocationInfo":{ "hostname":"music-stable-back-vla-20.vla.yp-c.yandex.net", "req-id":"1588832044137326-2021365999448385799", "exec-duration-millis":"234" }, "result":{ "batchId":"1588832044137326-2021365999448385799", "tracks":[ { "id":"534092", "realId":"534092", "title":"Marion Barfs", "major":{ "id":4, "name":"WARNER" }, "available":true, "availableForPremiumUsers":true, "availableFullWithoutPermission":false, "durationMs":142240, "storageDir":"49966_efe400dd.720496.1.534092", "fileSize":3413680, "normalization":{ "gain":-4.40, "peak":32766 }, "previewDurationMs":30000, "artists":[ { "id":6346, "name":"Clint Mansell", "various":false, "composer":false, "cover":{ "type":"from-album-cover", "prefix":"5715969c.a.58394-1", "uri":"avatars.yandex.net/get-music-content/41288/5715969c.a.58394-1/%%" }, "genres":[ ] }, { "id":43459, "name":"Kronos Quartet", "various":false, "composer":false, "cover":{ "type":"from-album-cover", "prefix":"5715969c.a.58394-1", "uri":"avatars.yandex.net/get-music-content/41288/5715969c.a.58394-1/%%" }, "genres":[ ] } ], "albums":[ { "id":58394, "title":"Requiem for a Dream / OST", "version":"Nonesuch store edition", "year":2000, "releaseDate":"2000-10-03T00:00:00+04:00", "coverUri":"avatars.yandex.net/get-music-content/41288/5715969c.a.58394-1/%%", "ogImage":"avatars.yandex.net/get-music-content/41288/5715969c.a.58394-1/%%", "genre":"films", "buy":[ ], "trackCount":33, "recent":false, "veryImportant":false, "artists":[ { "id":6346, "name":"Clint Mansell", "various":false, "composer":false, "cover":{ "type":"from-album-cover", "prefix":"5715969c.a.58394-1", "uri":"avatars.yandex.net/get-music-content/41288/5715969c.a.58394-1/%%" }, "genres":[ ] }, { "id":43459, "name":"Kronos Quartet", "various":false, "composer":false, "cover":{ "type":"from-album-cover", "prefix":"5715969c.a.58394-1", "uri":"avatars.yandex.net/get-music-content/41288/5715969c.a.58394-1/%%" }, "genres":[ ] } ], "labels":[ { "id":445704, "name":"Nonesuch" } ], "available":true, "availableForPremiumUsers":true, "availableForMobile":true, "availablePartially":false, "bests":[ 534107, 534092, 534099 ], "trackPosition":{ "volume":1, "index":20 } } ], "coverUri":"avatars.yandex.net/get-music-content/41288/5715969c.a.58394-1/%%", "ogImage":"avatars.yandex.net/get-music-content/41288/5715969c.a.58394-1/%%", "lyricsAvailable":false, "type":"music", "rememberPosition":false }, { "id":"42780439", "realId":"42780439", "title":"He's A Pirate", "version":"Tiesto Radio Edit", "major":{ "id":148, "name":"ARMADA" }, "available":true, "availableForPremiumUsers":true, "availableFullWithoutPermission":false, "durationMs":249490, "storageDir":"29762_f2af5f5d.64128366.1.42780439", "fileSize":5988519, "normalization":{ "gain":-6.33, "peak":29543 }, "previewDurationMs":30000, "artists":[ { "id":45101, "name":"Klaus Badelt", "various":false, "composer":false, "cover":{ "type":"from-album-cover", "prefix":"691b204f.a.6035494-1", "uri":"avatars.yandex.net/get-music-content/176019/691b204f.a.6035494-1/%%" }, "genres":[ ] } ], "albums":[ { "id":5665546, "title":"The World Of Trance (40 Biggest Trance Hits Ever) - Armada Music", "type":"compilation", "metaType":"music", "year":2015, "releaseDate":"2015-09-25T00:00:00+03:00", "coverUri":"avatars.yandex.net/get-music-content/114728/32848f9b.a.5665546-1/%%", "ogImage":"avatars.yandex.net/get-music-content/114728/32848f9b.a.5665546-1/%%", "genre":"dance", "buy":[ ], "trackCount":40, "recent":false, "veryImportant":false, "artists":[ { "id":171, "name":"сборник", "various":true, "composer":false, "cover":{ "type":"from-album-cover", "prefix":"b1beebeb.a.9369597-1", "uri":"avatars.yandex.net/get-music-content/2114230/b1beebeb.a.9369597-1/%%" }, "genres":[ ] } ], "labels":[ { "id":20610, "name":"Armada" } ], "available":true, "availableForPremiumUsers":true, "availableForMobile":true, "availablePartially":false, "bests":[ 33918668, 33918665, 36279815 ], "trackPosition":{ "volume":1, "index":14 } } ], "coverUri":"avatars.yandex.net/get-music-content/114728/32848f9b.a.5665546-1/%%", "ogImage":"avatars.yandex.net/get-music-content/114728/32848f9b.a.5665546-1/%%", "lyricsAvailable":false, "type":"music", "rememberPosition":false }, { "id":"26231173", "realId":"26231173", "title":"The Game is On", "version":"из сериала «Шерлок»", "major":{ "id":123, "name":"IRICOM" }, "available":true, "availableForPremiumUsers":true, "availableFullWithoutPermission":false, "durationMs":220830, "storageDir":"48621_78b55720.48004582.1.26231173", "fileSize":5300767, "normalization":{ "gain":-2.83, "peak":30019 }, "previewDurationMs":30000, "artists":[ { "id":4146, "name":"David Arnold", "various":false, "composer":false, "cover":{ "type":"from-album-cover", "prefix":"3bcd7006.a.3115739-7", "uri":"avatars.yandex.net/get-music-content/175191/3bcd7006.a.3115739-7/%%" }, "decomposed":[ " & ", { "id":8597, "name":"Michael Price", "various":false, "composer":false, "genres":[ ] } ], "genres":[ ] } ], "albums":[ { "id":3115739, "title":"«Шерлок»", "version":"Лучшая музыка к сериалу", "year":2016, "releaseDate":"2016-01-15T00:00:00+03:00", "coverUri":"avatars.yandex.net/get-music-content/175191/3bcd7006.a.3115739-7/%%", "ogImage":"avatars.yandex.net/get-music-content/175191/3bcd7006.a.3115739-7/%%", "genre":"tvseries", "buy":[ ], "trackCount":14, "recent":false, "veryImportant":false, "artists":[ { "id":4146, "name":"David Arnold", "various":false, "composer":false, "cover":{ "type":"from-album-cover", "prefix":"3bcd7006.a.3115739-7", "uri":"avatars.yandex.net/get-music-content/175191/3bcd7006.a.3115739-7/%%" }, "decomposed":[ " & ", { "id":8597, "name":"Michael Price", "various":false, "composer":false, "genres":[ ] } ], "genres":[ ] } ], "labels":[ { "id":754235, "name":"Союз Мьюзик по лицензии Silva Screen" } ], "available":true, "availableForPremiumUsers":true, "availableForMobile":true, "availablePartially":false, "bests":[ 26231185, 26231173, 26231179 ], "trackPosition":{ "volume":1, "index":2 } } ], "coverUri":"avatars.yandex.net/get-music-content/175191/3bcd7006.a.3115739-7/%%", "ogImage":"avatars.yandex.net/get-music-content/175191/3bcd7006.a.3115739-7/%%", "lyricsAvailable":false, "type":"music", "rememberPosition":false }, { "id":"20744250", "realId":"20744250", "title":"No Need to Come Back", "version":"из фильма «Интерстеллар»", "major":{ "id":4, "name":"WARNER" }, "available":true, "availableForPremiumUsers":true, "availableFullWithoutPermission":false, "durationMs":272720, "storageDir":"30613_595a8f93.49360847.1.20744250", "fileSize":6552136, "normalization":{ "gain":0.50, "peak":30945 }, "previewDurationMs":30000, "artists":[ { "id":11818, "name":"Hans Zimmer", "various":false, "composer":true, "cover":{ "type":"from-album-cover", "prefix":"64e21f1a.a.9613697-1", "uri":"avatars.yandex.net/get-music-content/2373979/64e21f1a.a.9613697-1/%%" }, "genres":[ ] } ], "albums":[ { "id":2373091, "title":"Interstellar", "version":"Deluxe Version; Original Motion Picture Soundtrack", "year":2014, "releaseDate":"2014-12-18T00:00:00+03:00", "coverUri":"avatars.yandex.net/get-music-content/28589/a729b000.a.2373091-2/%%", "ogImage":"avatars.yandex.net/get-music-content/28589/a729b000.a.2373091-2/%%", "genre":"soundtrack", "buy":[ ], "trackCount":24, "recent":false, "veryImportant":false, "artists":[ { "id":11818, "name":"Hans Zimmer", "various":false, "composer":true, "cover":{ "type":"from-album-cover", "prefix":"64e21f1a.a.9613697-1", "uri":"avatars.yandex.net/get-music-content/2373979/64e21f1a.a.9613697-1/%%" }, "genres":[ ] } ], "labels":[ { "id":474747, "name":"Motion Picture Artwork and Photography" } ], "available":true, "availableForPremiumUsers":true, "availableForMobile":true, "availablePartially":false, "bests":[ 20731770, 20744245, 20731767 ], "trackPosition":{ "volume":1, "index":20 } } ], "coverUri":"avatars.yandex.net/get-music-content/28589/a729b000.a.2373091-2/%%", "ogImage":"avatars.yandex.net/get-music-content/28589/a729b000.a.2373091-2/%%", "lyricsAvailable":false, "type":"music", "rememberPosition":false }, { "id":"44594874", "realId":"44594874", "title":"Ezio's Family", "major":{ "id":168, "name":"IDOL" }, "available":true, "availableForPremiumUsers":true, "availableFullWithoutPermission":false, "durationMs":237900, "storageDir":"36122_888f65de.67236418.1.44594874", "fileSize":5710785, "normalization":{ "gain":-6.14, "peak":31831 }, "previewDurationMs":30000, "artists":[ { "id":1654272, "name":"Jesper Kyd", "various":false, "composer":false, "cover":{ "type":"from-album-cover", "prefix":"cb3f7d61.a.5984910-1", "uri":"avatars.yandex.net/get-music-content/192707/cb3f7d61.a.5984910-1/%%" }, "genres":[ ] } ], "albums":[ { "id":5984910, "title":"Assassin’s Creed: The Best of Jesper Kyd", "year":2016, "releaseDate":"2016-09-30T00:00:00+03:00", "coverUri":"avatars.yandex.net/get-music-content/192707/cb3f7d61.a.5984910-1/%%", "ogImage":"avatars.yandex.net/get-music-content/192707/cb3f7d61.a.5984910-1/%%", "genre":"videogame", "buy":[ ], "trackCount":33, "recent":false, "veryImportant":false, "artists":[ { "id":1654272, "name":"Jesper Kyd", "various":false, "composer":false, "cover":{ "type":"from-album-cover", "prefix":"cb3f7d61.a.5984910-1", "uri":"avatars.yandex.net/get-music-content/192707/cb3f7d61.a.5984910-1/%%" }, "genres":[ ] } ], "labels":[ { "id":394652, "name":"Ubisoft" } ], "available":true, "availableForPremiumUsers":true, "availableForMobile":true, "availablePartially":false, "bests":[ 44594889, 44594874, 44594891 ], "trackPosition":{ "volume":1, "index":10 } } ], "coverUri":"avatars.yandex.net/get-music-content/192707/cb3f7d61.a.5984910-1/%%", "ogImage":"avatars.yandex.net/get-music-content/192707/cb3f7d61.a.5984910-1/%%", "lyricsAvailable":false, "type":"music", "rememberPosition":false } ] } }
Спасибо!
В веб-версии на странице плейлиста есть секция "Рекомендуемые треки".
Скрин
![изображение](https://user-images.githubusercontent.com/40576167/81260243-aa751180-904a-11ea-860a-6cf10766bca3.png)Эндпоинт
Запрос
Авторизация обязательна. Работает только для плейлистов, в которые пользователь может добавлять треки (собственые и коллективные), иначе возвращается ошибка
access-denied
.Ответ
batchId
tracks
- массив трековПример ответа