Skip to main content

Access parts of your account unavailable through normal YouTube API access.

Project description

youtube-unofficial

Python versions PyPI - Version GitHub tag (with filter) License GitHub commits since latest release (by SemVer including pre-releases) QA Tests Coverage Status Documentation Status mypy pre-commit pydocstyle pytest Ruff Downloads Stargazers

@Tatsh Mastodon Follow

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

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

youtube_unofficial-0.3.0.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

youtube_unofficial-0.3.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file youtube_unofficial-0.3.0.tar.gz.

File metadata

  • Download URL: youtube_unofficial-0.3.0.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.10 Linux/6.14.3-gentoo-limelight

File hashes

Hashes for youtube_unofficial-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d1a99f38250f750c70138a8a1dc153dbc01a4e46b351d739d6ef4b06d0450c34
MD5 3a7062bb09e3e4ea21b1d8327413f4a8
BLAKE2b-256 a10decb7c4d94016207af95cde1f6a9d82f0b672684666a86466be54e66f8b34

See more details on using hashes here.

File details

Details for the file youtube_unofficial-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: youtube_unofficial-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.10 Linux/6.14.3-gentoo-limelight

File hashes

Hashes for youtube_unofficial-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ee7e23e0a5760225cd057d1a43eb2869534fe16265a8ee3123f4613c80bfdac
MD5 2ee0060d4c0934700d22341721a35646
BLAKE2b-256 ed32a0d1d9c5404d577f03a00660d8922895b88dddff8e26945e381120fd41da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page