← 全部工具

Tatsh/youtube-unofficial

热度 65 更新于 开发与构建

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

githubauto-collected

安装

暂未验证可直接使用的安装命令,请查看项目官方文档或 Release。

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.

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 youtubeunofficial import YouTubeClient, buildyoutubesession

async def main() - None: session = await buildyoutubesession('chrome', 'Default') async with session: yt = YouTubeClient(session)

Clear watch history

await yt.clearwatchhistory()