Skip to main content

YouTube Helper — yt-dlp wrapper for downloading videos / audio / thumbnails, resolving direct media URLs, browsing video stream catalogs, and pulling no-API engagement metadata (channel / video / comments / subtitles) on YouTube, Vimeo, DailyMotion, Twitch VOD, SoundCloud, and any yt-dlp-supported source.

Project description

YouTube Helper

🇫🇷 · 🇬🇧

CI License: BSD-3-Clause Python Local-first

YouTube Helper belongs to a collection of libraries called AI Helpers developed for building Artificial Intelligence.

The Promise

Local-first by design. youtube-helper runs entirely on your machine — it fetches only the media you ask for; your data is never uploaded to a third-party service, no telemetry, no account, no cloud lock-in. You own the whole pipeline. Part of the AI Helpers suite: sovereignty over your data through local-first Open Source.

(youtube-helper does reach the internet — it downloads media from the source site you point it at. The promise is about no exfiltration and no telemetry: nothing about you or your requests is ever sent anywhere except the site hosting the media you asked for.)

🌍 AI Helpers

logo

YouTube Helper is a Python library that provides utility functions for downloading videos, audio, and thumbnails from platforms like YouTube, Vimeo, and DailyMotion using yt-dlp. It also supports post-processing tasks such as converting or merging media files with ffmpeg.

Documentation

💻 Documentation

📋 Examples

Installation

PrerequisitesPython 3.10–3.13, git, yt-dlp, and ffmpeg, cross-platform:

  • 🍎 macOS (Homebrew): brew install python git yt-dlp ffmpeg
  • 🐧 Ubuntu/Debian: sudo apt update && sudo apt install -y python3 python3-pip git yt-dlp ffmpeg
  • 🪟 Windows (PowerShell): winget install Python.Python.3.12 Git.Git yt-dlp.yt-dlp Gyan.FFmpeg

We recommend using Python environments. Check this link if you're unfamiliar with setting one up: 🥸 Tech tips.

From PyPI (recommended)

pip install youtube-helper

# Optional surfaces
pip install "youtube-helper[cli]"       # click-based CLI twin
pip install "youtube-helper[api]"       # FastAPI HTTP surface
pip install "youtube-helper[api,mcp]"   # MCP tools over FastAPI

From source (no PyPI)

pip install "git+https://github.com/warith-harchaoui/youtube-helper.git@v1.4.0"

# Optional surfaces
pip install "youtube-helper[cli] @ git+https://github.com/warith-harchaoui/youtube-helper.git@v1.4.0"
pip install "youtube-helper[api] @ git+https://github.com/warith-harchaoui/youtube-helper.git@v1.4.0"
pip install "youtube-helper[api,mcp] @ git+https://github.com/warith-harchaoui/youtube-helper.git@v1.4.0"

Usage

For the full catalog of recipes (downloads, stream catalog / picker, direct-URL resolver, composing with video-helper, branding metadata, subtitles & comments), see 📋 EXAMPLES.md.

Quick start — download a video, extract metadata, and download the audio:

import youtube_helper as yth
import video_helper as vh
import audio_helper as ah
import os_helper as osh
import os

osh.verbosity(0)

# Example YouTube URL
youtube_url = "https://www.youtube.com/watch?v=YE7VzlLtp-4"

folder = "yt_tests"
os.makedirs(folder, exist_ok=True)

# Download a video
video = "big-buck-bunny.mp4"
video = os.path.join(folder, video)
yth.download_video(youtube_url, video)

# Extract metadata from the video URL
metadata = yth.video_url_meta_data(youtube_url)
print(metadata["title"])
# Big Buck Bunny

print(metadata["duration"])
# 597

print(metadata["description"])
# Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.
# 
# Licensed under the Creative Commons Attribution license
# 
# http://www.bigbuckbunny.org/

print(metadata["channel"])
# Blender

details = vh.video_dimensions(video)
print(details)
# {'width': 1280, 'height': 720, 'duration': 596.458, 'frame_rate': 24.0, 'has_sound': True}

# Download the audio from the video
audio = "big-buck-bunny.mp3"
audio = os.path.join(folder, audio)
yth.download_audio(youtube_url, audio)

audio, sample_rate = ah.load_audio(audio)
print(sample_rate)
# 44100

Legal and Ethical Use

YouTube Helper is a thin wrapper around yt-dlp and ffmpeg. You are responsible for how you use it. Only download or process media that you own, that is in the public domain or under a permissive license (e.g. Creative Commons), or for which you have explicit permission from the rights holder. Respect each platform's Terms of Service and any applicable copyright, privacy, and data-protection laws in your jurisdiction. The authors provide this library for legitimate uses such as personal archiving, accessibility, research, and content you have rights to — not for circumventing access controls or redistributing copyrighted material.

Features

Downloads (to disk)youtube_helper.main

  • download_video(url, output_path) / download_audio(url, output_path) / download_thumbnail(url, output_path).
  • video_url_meta_data(url) / is_valid_video_url(url) for cheap metadata probes.
  • default_ytdlp_options(verbose, ...) for customisable yt-dlp options.

Stream catalog & direct-URL resolutionyoutube_helper.streaming

  • resolve_direct_url(url, prefer="audio"|"video") → quick "give me one direct ffmpeg-ready URL".
  • list_video_streams(url) → enumerate every video format yt-dlp finds (codec, resolution, fps, bitrate, …).
  • pick_video_stream(url, prefer_codec=, prefer_format=, max_fps=, language=, cookies_from_browser=) → constrained picker, returns one VideoStreamInfo ready to feed video_helper.extract_frames.
  • extract_frames_stream(url, ..., **extract_frames_kwargs) → one-call composition of pick_video_stream + video_helper.extract_frames, auto-wires headers, forwards any extract_frames kwarg (destination, device, batch_size, output_width, frame_step, …). The shortest path from a YouTube / Vimeo / Twitch URL to ML-ready frames.
  • Audio stream catalog / picker intentionally lives in podcast-helper (single owner for audio PCM streaming).

No-API engagement metadatayoutube_helper.branding

  • channel_info(url) / channel_videos(url, max_videos, include_shorts, include_lives) — channel snapshot + paginated video list with normalised engagement metrics, cross-platform schema.
  • video_engagement(url) / engagement_batch([urls]) — per-video views / likes / comments / channel follower count, tolerant batched variant.
  • video_subtitles(url, output_dir, langs=("fr","en")) — auto-subtitle download.
  • video_comments(url, max_count, cookies_from_browser="firefox"|"chrome"|...) — comments sample.
  • is_short(meta) / ensure_recent_ytdlp(min_version) — helpers.
  • Built on yt-dlp's public metadata only — no Google Data API, no Vimeo API, no OAuth, no quota.

Multi-surface exposure

youtube-helper is not just a library — the same functions are exposed as two CLIs, a FastAPI HTTP surface, an MCP tool set, and a browser GUI:

# Python library (default)
import youtube_helper as yth

# argparse-based CLI (installed automatically)
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 resolve      --url https://www.youtube.com/watch?v=YE7VzlLtp-4 --prefer audio
youtube-helper channel-info --url https://www.youtube.com/@blender

# click-based CLI twin (needs the [cli] extra)
pip install 'youtube-helper[cli] @ git+https://github.com/warith-harchaoui/youtube-helper.git@v1.4.0'
youtube-helper-click metadata --url https://www.youtube.com/watch?v=YE7VzlLtp-4

# FastAPI HTTP surface (needs the [api] extra)
pip install 'youtube-helper[api] @ git+https://github.com/warith-harchaoui/youtube-helper.git@v1.4.0'
uvicorn youtube_helper.api:app --port 8000
# → OpenAPI docs at http://localhost:8000/docs

# MCP tools over FastAPI (needs the [api,mcp] extras)
pip install 'youtube-helper[api,mcp] @ git+https://github.com/warith-harchaoui/youtube-helper.git@v1.4.0'
youtube-helper-mcp                # serves FastAPI + MCP on port 8000

# Browser GUI (needs the [api] extra) — paste a URL, pick audio or video
uvicorn youtube_helper.api:app --port 8000
# → open http://localhost:8000/gui  (or just http://localhost:8000/)

Download bench GUI (GET /gui): a single self-contained page (Tailwind via CDN + vanilla JS, no build step). Paste a YouTube (or any yt-dlp-supported) URL, choose audio (with a sample rate) or video, hit Download, and the result plays inline with a download link. It POSTs to the same /audio / /video endpoints — zero extra server logic. Local-first: the page only talks to your local API.

Agent skill (Claude Code / Claude Desktop / OpenCode): install skills/youtube-helper/ so an agent can download and inspect media on your behalf. See TRIGGERS.md for the exhaustive catalogue of what fires it.

Docker image:

docker build -t youtube-helper .
docker run --rm -p 8000:8000 youtube-helper

A richer GUI plan (video library board, channel comparator, batch downloader) lives in GUI.md.

The competitive landscape (yt-dlp, pytubefix, YouTube Data API, streamlink, ArchiveBox, …) is analysed in LANDSCAPE.md.

Author

Acknowledgements

Special thanks to Mohamed Chelali and Bachir Zerroug for fruitful discussions.

License

This project is licensed under the BSD-3-Clause License — see the LICENSE file for details.

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_helper-1.4.0.tar.gz (54.0 kB view details)

Uploaded Source

Built Distribution

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

youtube_helper-1.4.0-py3-none-any.whl (45.6 kB view details)

Uploaded Python 3

File details

Details for the file youtube_helper-1.4.0.tar.gz.

File metadata

  • Download URL: youtube_helper-1.4.0.tar.gz
  • Upload date:
  • Size: 54.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for youtube_helper-1.4.0.tar.gz
Algorithm Hash digest
SHA256 6aa52d8600078263010d70787959ede4de6d9a75056fe01e8e251929a8ab31eb
MD5 04b6028269cbe451f2744c18d18de0e7
BLAKE2b-256 74ea242b639afdf283268fb15833fc691831ae7010e63209d9e55c1d9c0ca3a6

See more details on using hashes here.

File details

Details for the file youtube_helper-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: youtube_helper-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 45.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for youtube_helper-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a22471d0e02d7d818887b43a4e08c0ac51b679b3105b07a79d4f3e2e7362c16
MD5 0d574475c86be6bab9ff83b4b6f0c514
BLAKE2b-256 79061260b1ab91ec6ad520717803f908f4d07b6422a2d2bebb2d16add8d34ce8

See more details on using hashes here.

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