ytmusicapiJS is a JS/TS implementation of the Python 3 library ytmusicapi
It emulates YouTube Music web client requests using the user's cookie data for authentication.
This library is intended to carry the same functionality as the library it is inspired by. As such, unless the need becomes great enough for a specific feature in this library, I recommend all API specific changes be directed to ytmusicapi
instead.
This library is a work in progress.
More comprehensive list and explanation here in the original repo or check out the docs for the original repo
✅ - Implemented
🐣 - Partially implemented
❌ - Not implemented
Feature | Implementation Status | ytmusicapi version parity |
---|---|---|
Browsing | ||
search (w/ filters) | ✅ | 0.20.0 |
get artist info | ✅ | 0.20.0 |
get user info | ✅ | 0.20.0 |
get albums | ✅ | 0.20.0 |
get song metadata | ✅ | 0.20.0 |
get watch playlists | ✅ | 0.20.0 |
get song lyrics | ✅ | 0.20.0 |
Exploring | ||
get moods/genres playlists | ✅ | 0.20.0 |
get latest charts | ✅ | 0.20.0 |
Library Management | ||
get library contents | ✅ | 0.20.0 |
add/remove library content | ✅ | 0.20.0 |
Playlists | ||
create/delete playlists | ✅ | 0.20.0 |
modify playlists | ✅ | 0.20.0 |
get playlist contents | ✅ | 0.20.0 |
Uploads | ||
upload/remove songs | ✅ | 0.20.0 |
list uploaded songs | ✅ | 0.20.0 |
Other | ||
locale | ❌ | 0.20.0 |
npm | yarn |
---|---|
npm install @codyduong/ytmusicapi |
yarn add @codyduong/ytmusicapi |
Quick Usage Snippet
import YTMusic from '@codyduong/ytmusicapi';
const ytm = new YTMusic()
const results = await yt.search('Rickroll')
results
[
{
category: 'Top result',
resultType: 'video',
title: 'Never Gonna Give You Up',
views: null,
videoId: 'dQw4w9WgXcQ',
duration: null,
year: null,
artists: [ [Object], [Object] ],
thumbnails: [ [Object] ]
},
{
category: 'Songs',
resultType: 'song',
title: 'Never Gonna Give You Up',
album: null,
feedbackTokens: { add: null, remove: null },
videoId: 'lYBUbBu4W08',
duration: null,
year: null,
artists: [ [Object], [Object] ],
isExplicit: false,
thumbnails: [ [Object], [Object] ]
},
{
category: 'Songs',
resultType: 'song',
title: 'Rickroll',
album: null,
feedbackTokens: { add: null, remove: null },
videoId: 'oBKeQItWbnA',
duration: null,
year: null,
artists: [ [Object], [Object], [Object] ],
isExplicit: false,
thumbnails: [ [Object], [Object] ]
},
...
]
See the Documentation for the Python 3 API for reference.
I am currently not accepting PRs, but will take issues into consideration if they are between a discrepancy between this library and the Python3 library. PR's are likely to open once I have finished implemented all the 0.20.0 versions
The library is intended to keep features within the same scope of the original Python 3 library. This may/may not change at my discretion.
The source code is structured almost identically to the Python 3 Library. I've also mocked some other dependencies, this is to maintain readability and ease of changes between the two APIs.
A majority of this codebase is possible thanks to the work done by sigma67