youtube-unofficial
Access parts of your account unavailable through normal YouTube API access.
Installation
Poetry
poetry add youtube-unofficial
Pip
pip install youtube-unofficial
Usage
This uses a browser cookie storage to be able to access authorised endpoints. There is no feature to log in. You must be logged on in a supported browser. This supports any browser that yt-dlp supports.
Command line
Usage: youtube [OPTIONS] COMMAND [ARGS]...
Unofficial YouTube CLI.
Options:
-h, --help Show this message and exit.
Commands:
clear-watch-history Clear watch history.
clear-watch-later Clear watch later queue.
print-history Print your watch history.
print-playlist Print a playlist.
print-watch-later Print your Watch Later playlist.
remove-history-entries Remove videos from Watch History.
remove-video-id Remove videos from a playlist.
remove-watch-later-video-id Remove videos from your Watch Later queue.
toggle-watch-history Disable or enable watch history
Every command takes a --debug or -d argument to show very verbose logs.
Some commands accept a -j/--json argument to print machine-readable output as JSON lines.
In Python
import asyncio
from youtube_unofficial import YouTubeClient, build_youtube_session
async def main() -> None:
session = await build_youtube_session('chrome', 'Default')
async with session:
yt = YouTubeClient(session)
# Clear watch history
await yt.clear_watch_history()
# Remove a single video ID from Watch Later queue
await yt.remove_video_id_from_playlist('WL', video_id)
# Clear entire Watch Later queue
await yt.clear_watch_later()
asyncio.run(main())
Contributing
For a new feature to be accepted, it must be something that cannot be achieved with Google's official API. It also has to be on the youtube.com/youtu.be website or app and not a place like My Activity.
Code must run through yarn qa and have zero issues.
Release files for youtube-unofficial 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| youtube_unofficial-0.4.0.tar.gz | 29.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| youtube_unofficial-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.0 kB
Release files / youtube_unofficial-0.4.0.tar.gz
| Download URL | youtube_unofficial-0.4.0.tar.gz |
|---|---|
| Size | 29.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68fe8e7d25ea1e440d32d6879a2939cab8691b3bd781011c2d23367e214fcb17
|
|
BLAKE2b-256 checksum How to use checksums |
e3e9ffeb52f6461ecb5e520c30eafa88741c61c5725e1e9971ec3191d274745c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 27, 2026.
Transparency logRelease files / youtube_unofficial-0.4.0-py3-none-any.whl
| Download URL | youtube_unofficial-0.4.0-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
806a917ab6cb559defa36e01b81a2557bdaa1b3c9babadca8b139fd2ae2e192f
|
|
BLAKE2b-256 checksum How to use checksums |
5709444c20fc992f9e2337b80f4f23e82d4b4c4993c33247956fce76560ad71b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 27, 2026.
Transparency log