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 uv pytest Ruff Downloads Stargazers pre-commit Prettier Follow @Tatsh Mastodon Follow

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

Commands

youtube

Unofficial YouTube CLI.

Usage

youtube [OPTIONS] COMMAND [ARGS]...

clear-watch-history

Clear watch history.

Usage

youtube clear-watch-history [OPTIONS]

Options

-d, --debug

Enable debug output.

-b, --browser <browser>

Browser to read cookies from.

-p, --profile <profile>

Browser profile.

clear-watch-later

Clear watch later queue.

Usage

youtube clear-watch-later [OPTIONS]

Options

-d, --debug

Enable debug output.

-b, --browser <browser>

Browser to read cookies from.

-p, --profile <profile>

Browser profile.

print-history

Print your watch history.

By default, this will print the video IDs of your watch history.

If -j/–json is specified, this will print a JSON object for each video in your watch history. The JSON object will have the following interface:

{
    channel_thumbnails: {
        height: int
        width: int
        url: string
    }[]
    description: string
    length: string
    length_accessible: string
    long_byline_text: string
    moving_thumbnails: {
        height: int
        width: int
        url: string
    }[]
    owner_text: string
    short_byline_text: string
    short_view_count_text: string
    title: string
    video_id: string
    video_thumbnails: {
        height: int
        width: int
        url: string
    }[]
 }

Usage

youtube print-history [OPTIONS]

Options

-d, --debug

Enable debug output.

-b, --browser <browser>

Browser to read cookies from.

-p, --profile <profile>

Browser profile.

-j, --json

Output in JSON format.

print-playlist

Print a playlist.

By default, this will print the video IDs of the given playlist ID.

If -j/–json is specified, this will print a JSON object for each video in your Watch Later playlist. The JSON object will have the following interface:

{
    owner: string
    title: string
    video_id: string
    watch_url: string
}

Usage

youtube print-playlist [OPTIONS] PLAYLIST_ID

Options

-d, --debug

Enable debug output.

-b, --browser <browser>

Browser to read cookies from.

-p, --profile <profile>

Browser profile.

-j, --json

Output in JSON format.

Arguments

PLAYLIST_ID

Required argument

print-watch-later

Print your Watch Later playlist.

By default, this will print the video IDs of your Watch Later playlist.

If -j/–json is specified, this will print a JSON object for each video in your Watch Later playlist. The JSON object will have the following interface:

{
    owner: string
    title: string
    video_id: string
    watch_url: string
}

Usage

youtube print-watch-later [OPTIONS]

Options

-d, --debug

Enable debug output.

-b, --browser <browser>

Browser to read cookies from.

-p, --profile <profile>

Browser profile.

-j, --json

Output in JSON format.

remove-history-entries

Remove videos from Watch History.

Usage

youtube remove-history-entries [OPTIONS] [VIDEO_IDS]...

Options

-d, --debug

Enable debug output.

-b, --browser <browser>

Browser to read cookies from.

-p, --profile <profile>

Browser profile.

Arguments

VIDEO_IDS

Optional argument(s)

remove-video-id

Remove videos from a playlist.

Usage

youtube remove-video-id [OPTIONS] PLAYLIST_ID [VIDEO_IDS]...

Options

-d, --debug

Enable debug output.

-b, --browser <browser>

Browser to read cookies from.

-p, --profile <profile>

Browser profile.

Arguments

PLAYLIST_ID

Required argument

VIDEO_IDS

Optional argument(s)

remove-watch-later-video-id

Remove videos from your Watch Later queue.

Usage

youtube remove-watch-later-video-id [OPTIONS] [VIDEO_IDS]...

Options

-d, --debug

Enable debug output.

-b, --browser <browser>

Browser to read cookies from.

-p, --profile <profile>

Browser profile.

Arguments

VIDEO_IDS

Optional argument(s)

toggle-watch-history

Disable or enable watch history.

Usage

youtube toggle-watch-history [OPTIONS]

Options

-d, --debug

Enable debug output.

-b, --browser <browser>

Browser to read cookies from.

-p, --profile <profile>

Browser profile.

Indices and tables