youtube_helper.cli_argparse module

YouTube Helper — argparse-based command-line interface.

Thin wrapper around the pure functions in youtube_helper.main, youtube_helper.streaming and youtube_helper.branding that exposes the whole toolkit as subcommands under a single youtube-helper entry point. Written with argparse from the standard library so the CLI works out of the box on any Python install that has the package installed — no extra dependency required.

Subcommands

  • metadata — dump JSON metadata for one video URL

  • valid — exit 0 iff the URL is a valid video URL for yt-dlp

  • video — download the video track to disk

  • audio — download the audio track to disk

  • thumbnail — download the thumbnail image to disk

  • resolve — resolve a URL to a direct ffmpeg-ready media URL

  • list-streams — enumerate every video format yt-dlp finds

  • pick-stream — pick a single best video format matching constraints

  • channel-info — channel snapshot (subs, video count, total views)

  • channel-videos— list channel videos with normalised engagement metrics

  • engagement — one-video engagement snapshot (views/likes/comments)

  • engagement-batch — multi-URL engagement snapshot

  • subtitles — download (auto) subtitles for a video into a folder

  • comments — dump top comments of a video

  • ytdlp-version — print installed yt-dlp version

Usage Example

>>> #   youtube-helper metadata     --url https://www.youtube.com/watch?v=YE7VzlLtp-4
>>> #   youtube-helper audio        --url https://www.youtube.com/watch?v=YE7VzlLtp-4 --output out.mp3
>>> #   youtube-helper video        --url https://www.youtube.com/watch?v=YE7VzlLtp-4 --output out.mp4
>>> #   youtube-helper thumbnail    --url https://www.youtube.com/watch?v=YE7VzlLtp-4 --output out.png
>>> #   youtube-helper resolve      --url https://www.youtube.com/watch?v=YE7VzlLtp-4 --prefer audio
>>> #   youtube-helper list-streams --url https://www.youtube.com/watch?v=YE7VzlLtp-4
>>> #   youtube-helper pick-stream  --url https://www.youtube.com/watch?v=YE7VzlLtp-4 --prefer-codec h264
>>> #   youtube-helper channel-info --url https://www.youtube.com/@blender
>>> #   youtube-helper engagement   --url https://www.youtube.com/watch?v=YE7VzlLtp-4
>>> #   youtube-helper subtitles    --url https://www.youtube.com/watch?v=YE7VzlLtp-4 --output-dir subs/
>>> #   youtube-helper comments     --url https://www.youtube.com/watch?v=YE7VzlLtp-4 --max 50

Author

Warith Harchaoui, Ph.D. — https://linkedin.com/in/warith-harchaoui/

youtube_helper.cli_argparse.build_parser()[source]

Assemble the top-level youtube-helper argument parser.

Returns:

Fully wired parser with every subcommand attached.

Return type:

argparse.ArgumentParser

youtube_helper.cli_argparse.main(argv=None)[source]

Entry point invoked by youtube-helper (see [project.scripts]).

Parameters:

argv (sequence of str, optional) – Arguments to parse. Defaults to sys.argv[1:] when None.

Returns:

Process exit code (0 on success).

Return type:

int