skillfed

ytmusicapi

Unofficial API for YouTube Music

ytmusicapi v1.12.2 330.9K downloads/30d#7,526 on PyPI2,940
Permissive license MIT Active released

What it is and what it does

ytmusicapi is an unofficial Python library that lets you interact with YouTube Music programmatically by emulating web client requests using your account credentials. It wraps the YouTube Music API to provide a Python interface for common tasks like searching, browsing artist information, managing playlists, uploading songs, and accessing your library.

The library handles authentication through cookie or OAuth data and supports a wide range of operations: searching with filters, retrieving song metadata and lyrics, managing playlists and library content, accessing charts and mood playlists, and working with podcasts and uploads. It supports multiple languages and regions, making it useful for building automation tools, music discovery scripts, or integrations that need programmatic access to YouTube Music.

Use it for:

  • Automate playlist creation and management by searching for songs and adding them programmatically.
  • Build a music discovery tool that retrieves charts, moods, and artist information across regions.
  • Sync or backup your YouTube Music library contents (playlists, songs, uploads) to external storage.
  • Create a bot or script that modifies your play history or rates songs based on custom logic.
  • Integrate YouTube Music data into a personal music application or dashboard.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

ytmusicapi lets you programmatically interact with YouTube Music by sending authenticated requests to its API, enabling you to search, browse, manage playlists, and control your library.

Yes. ytmusicapi is actively maintained, has low install friction, carries no known vulnerabilities, uses a permissive MIT license, and solves a clear problem—programmatic access to YouTube Music. It's well-suited for automation and integration tasks. The main caveat is that it's unofficial and depends on YouTube Music's internal API, so changes on YouTube's side could break functionality without notice.

Install

ytmusicapi on PyPI

pip

pip install ytmusicapi

uv

uv add ytmusicapi

poetry

poetry add ytmusicapi

Installing ytmusicapi

Before you install

Low install friction with a single dependency (requests). Actively maintained with a recent release 6 days ago and 2940 repository stars, indicating steady community engagement.

License in practice

MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both personal and commercial projects.

Quickstart

from ytmusicapi import YTMusic

yt = YTMusic('oauth.json')
playlist_id = yt.create_playlist('test', 'test description')
results = yt.search('Oasis Wonderwall')
yt.add_playlist_items(playlist_id, [results[0]['videoId']])

Requires Python 3.10 or higher and valid YouTube Music authentication credentials (oauth.json file).

Verify before relying

  • Whether YouTube Music API changes could break this library without warning, given its unofficial nature.
  • Cookie-based authentication stability and whether account restrictions apply to programmatic access.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — requests
Maintenance actively maintained — 6 days since the last release
Last repo commit
First released
Downloads 330,939/month — #7,526 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ytmusicapi-1.12.2-py3-none-any.whl

Programming Language :: Python :: 3

Tags

youtube music api pythonyoutube music library automationplaylist management youtube musicyoutube music search programmaticyoutube music unofficial clientyoutube music authentication pythonyoutube music metadata retrieval
music-apiyoutube-integrationautomation

More WWW/HTTP packages