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) CodeQL QA Tests Coverage Status Dependabot Documentation Status mypy pre-commit Poetry pydocstyle pytest Ruff Downloads Stargazers Prettier

@Tatsh Buy Me A Coffee Libera.Chat Mastodon Follow Patreon

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.1.tar.gz (26.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

youtube_unofficial-0.3.1-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: youtube_unofficial-0.3.1.tar.gz
  • Upload date:
  • Size: 26.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for youtube_unofficial-0.3.1.tar.gz
Algorithm Hash digest
SHA256 c42e083cd5a925f2a03bec8474eb99841be8f90b82b67a6f1b6d920809267abe
MD5 bb993008047dadf8a1d441e103f56360
BLAKE2b-256 838f45858612abb3299fd1bc3cc4bcb33df7a5dbd50cea9afaf568e835208789

See more details on using hashes here.

Provenance

The following attestation bundles were made for youtube_unofficial-0.3.1.tar.gz:

Publisher: publish.yml on Tatsh/youtube-unofficial

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for youtube_unofficial-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 650e3a086f2d4dcac3c8cae3e3721986394b0d8539efa98cd10c108b274fa555
MD5 ab0cc1b78c5586b6365a247d8cf5734e
BLAKE2b-256 c7595edd50ccdedae5f2dfdf0cdfac52ee9fb289f3a09e5cc782ce78c86cad8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for youtube_unofficial-0.3.1-py3-none-any.whl:

Publisher: publish.yml on Tatsh/youtube-unofficial

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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