sonrac/yandex-music-api

此包的最新版本(1.0)没有可用的许可证信息。

Yandex 音乐 Api 封装器

1.0 2017-06-03 19:30 UTC

This package is auto-updated.

Last update: 2024-09-15 11:01:09 UTC


README

安装

composer require sonrac/yandex-music-api 

或将它添加到您的 composer.json 文件的 require 部分中

{
  "sonrac/yandex-music-api": "1.0"
}

用法

  • 创建实例
use sonrac\YandexMusic\Yandex;

$api = new Yandex('username', 'password');
  • 使用代理创建实例。代理从 gimmeProxy 获取
use sonrac\YandexMusic\Yandex;

$api = new Yandex('username', 'password', true);

API 方法

  • 获取账户状态
$accountStatus = $api->getAccountStatus();
  • 获取动态
$feed = $api->getFeed();
  • 获取流派
$genres = $api->getGenres();
  • 搜索
$searchResult = $api->search('text', 0);
  • 获取用户播放列表
// For current user
$playLists = $api->getUserPlayLists();

// For some user with uid 1000
$playLists = $api->getUserPlayLists(1000);

* Get play list

```php
$playlist = $api->getPlayList(100);
  • 获取播放列表
$playlists = $api->getPlayLists([1003, 1010]);
  • 获取播放列表
$playlists = $api->getPlayLists([1003, 1010]);
  • 删除播放列表
$resultRemove = $api->removePlaylist(1003);
  • 重命名播放列表
$resultRename = $api->renamePlaylist(1003, 'new playlist');
  • 将曲目添加到播放列表
$resultRename = $api->addTrackToPlaylist(1003, [1,2,3,4]);
  • 从播放列表中删除曲目
$resultRename = $api->removeTracksFromPlaylist(1003, [1,2,3,4]);