V
V
Vladislav Gertsik2017-02-26 14:42:01
Google Chrome
Vladislav Gertsik, 2017-02-26 14:42:01

Export a Yandex.Music playlist?

Hello!
I recently decided to switch to Spotify and I want to transfer my music from Yandex Music there. I figured out the import services: soundiiz.com, playlist-converter.net. I want to know how to export the "I like" playlist as a playlist file with the extension .pls, .m3u or at least as a text file, where the songs will be written line by line in the form "Artist" - "Composition name"

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
aleks007smol, 2019-09-15
@aleks007smol

Here is a small PHP script

<?php

// https://music.yandex.ru/users/{owner}/playlists/{kinds}
$uriRaw = 'https://music.yandex.ru/users/vadim.loxx/playlists/1073';
$uriRaw = explode('/', $uriRaw);

$owner = $uriRaw[4];
$kinds = $uriRaw[6];

$uri = 'https://music.yandex.ru/handlers/playlist.jsx?owner=' . $owner . '&kinds=' . $kinds;

$responseRaw = file_get_contents($uri);
$response = json_decode($responseRaw);

$playlistTitle = $response->playlist->title;
$tracks = $response->playlist->tracks;

file_exists($playlistTitle . '.txt') ? unlink($playlistTitle . '.txt') : null;

// Генерация с нумерацией или без нее
$flagNums = true;
$numSong = 1;

foreach ($tracks as $track) {

    $artistsNames = [];
    foreach ($track->artists as $artist) {
        $artistsNames[] = $artist->name;
    }

    $artistsNames = implode(', ', $artistsNames);

    $flagNums ? $fullTrack = $numSong++ . ') ' . $artistsNames . ' - ' . $track->title . PHP_EOL :
        $fullTrack = $artistsNames . ' - ' . $track->title . PHP_EOL;

    file_put_contents($playlistTitle . '.txt', $fullTrack, FILE_APPEND);
}

echo 'Done!';
echo '<br>';
echo '<a href="' . $playlistTitle . '.txt">Список песен</a>';

I
ivanovaalina, 2020-07-28
@ivanovaalina

The service https://musconv.com can help here

M
Maxim, 2017-02-26
@pudovMaxim

it was already

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question