https://github.com/tatsh/youtube-unofficial
Access parts of your account unavailable through normal YouTube API access.
https://github.com/tatsh/youtube-unofficial
command-line youtube
Last synced: 20 days ago
JSON representation
Access parts of your account unavailable through normal YouTube API access.
- Host: GitHub
- URL: https://github.com/tatsh/youtube-unofficial
- Owner: Tatsh
- License: mit
- Created: 2016-06-24T03:30:40.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2025-06-09T22:27:54.000Z (24 days ago)
- Last Synced: 2025-06-09T22:37:06.228Z (24 days ago)
- Topics: command-line, youtube
- Language: Python
- Homepage: https://tatsh.github.io/youtube-unofficial/
- Size: 1.81 MB
- Stars: 47
- Watchers: 7
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
- Citation: CITATION.cff
- Codeowners: CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# youtube-unofficial
[](https://www.python.org/)
[](https://pypi.org/project/youtube-unofficial/)
[](https://github.com/Tatsh/youtube-unofficial/tags)
[](https://github.com/Tatsh/youtube-unofficial/blob/master/LICENSE.txt)
[](https://github.com/Tatsh/youtube-unofficial/compare/v0.3.0...master)
[](https://github.com/Tatsh/youtube-unofficial/actions/workflows/qa.yml)
[](https://github.com/Tatsh/youtube-unofficial/actions/workflows/tests.yml)
[](https://coveralls.io/github/Tatsh/youtube-unofficial?branch=master)
[](https://youtube-unofficial.readthedocs.org/?badge=latest)
[](http://mypy-lang.org/)
[](https://github.com/pre-commit/pre-commit)
[](http://www.pydocstyle.org/en/stable/)
[](https://docs.pytest.org/en/stable/)
[](https://github.com/astral-sh/ruff)
[](https://pepy.tech/project/youtube-unofficial)
[](https://github.com/Tatsh/youtube-unofficial/stargazers)[](https://bsky.app/profile/Tatsh.bsky.social)
[](https://hostux.social/@Tatsh)Access parts of your account unavailable through normal YouTube API access.
## Installation
### Poetry
```shell
poetry add youtube-unofficial
```### Pip
```shell
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
```plain
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
```python
from youtube_unofficial import YouTubeClient# Arguments are the browser name and profile.
yt = YouTubeClient('chrome', 'Default')# Clear watch history
yt.clear_watch_history()# Remove a single video ID from Watch Later queue
yt.remove_video_id_from_playlist('WL', video_id)# Clear entire Watch Later queue
yt.clear_watch_later()
```## 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.