Manage YouTube Music library, playlists, and discovery via ytmusicapi.
This skill uses the ytmusicapi Python library to interact with YouTube Music.
ytmusicapi package: pip install ytmusicapioauth.json or browser.json) in the skill folder.Install the library:
pip install ytmusicapi
Generate Authentication (The "cURL Handshake"):
F12browse in the network list.browse request -> Copy -> Copy as cURL (bash).headers.txt in the skill folder.browser.json:
from ytmusicapi.auth.browser import setup_browser
with open('headers.txt', 'r') as f:
setup_browser('browser.json', f.read())
browser.json is located in the skill folder.Verify:
python -c "from ytmusicapi import YTMusic; yt = YTMusic('browser.json'); print(yt.get_library_songs(limit=1))"
yt.get_library_songs(), yt.get_library_albums()yt.rate_song(videoId, 'LIKE'), yt.edit_song_library_status(feedbackToken)yt.create_playlist(title, description)yt.add_playlist_items(playlistId, [videoIds])yt.remove_playlist_items(playlistId, [videoIds])yt.get_lyrics(browseId)yt.get_watch_playlist(videoId) -> related