stounhandj/yandex-music-api

v0.5.2.1 2022-06-27 13:35 UTC

This package is auto-updated.

Last update: 2024-05-25 19:52:37 UTC


README

Total Downloads Latest Stable Version License

Not an official package for working with the Yandex API.

Installation

$ composer require stounhandj/yandex-music-api

Or

{
    "require": {
        "stounhandj/yandex-music-api": "^0.5.2"
    }
}

Example get likes tracks

use StounhandJ\YandexMusicApi\Client;

$token = "AQAAAAANDd5rMAG1XnIKIEVVMGV4ibf8kw3FeA1";
$client = new Client($token);

foreach ($client->getLikesTracks() as $track){
    echo $track->title;
}

Example of downloading the first track from the album you like

use StounhandJ\YandexMusicApi\Client;

$token = "AQAAAAANDd5rMAG1XnIKIEVVMGV4ibf8kw3FeA1";
$client = new Client($token);

$likesAlbum = $client->getLikesAlbums()[0];
$firstTrack = $likesAlbum->getTracks()[0];
$result = $firstTrack->downloadTrack("test.mp3");