yt-dlp Python-Downloader

Unified yt-dlp downloader - generates cross-platform Python scripts for video, audio, subtitles

Fra og med 29.03.2026. Se den nyeste version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Skaber
piknockyou
Bedømmelser
0 0 0
Version
9.53
Oprettet
11.01.2026
Opdateret
29.03.2026
Size
170 kB
Licens
AGPL-3.0
Gælder for

☕ If you find this tool helpful & would like to support its maintenance, please consider leaving a tip on:

https://ko-fi.com/piknockyou

Thank you! :-)


🖼 For a quick impression of this script, refer to the screenshots at the bottom.


yt-dlp Python-Downloader | Cross-Platform Video/Audio/Subtitle Downloader

Generates ready-to-run Python scripts for downloading media from YouTube, Reddit, Instagram, TikTok, and many more sites using yt-dlp. One-click download button, configurable video/audio/subtitle options, and sophisticated merge/separate output modes—all in a cross-platform script that works on Windows, Mac, and Linux.

⚠️ Recommended Environment

This script is developed and tested primarily on Windows using the following environment:

  • YouTube and Reddit (primary test platforms)
  • yt-dlp (latest version; in PATH)
  • Python 3.13 (in PATH)
  • MKVToolNix (mkvmerge) for merging (HIGHLY RECOMMENDED; in PATH)
  • FFmpeg (in PATH)

While the generated Python scripts are designed to be cross-platform and include FFmpeg fallbacks, complex merge scenarios have been thoroughly tested only with mkvmerge on Windows. If you encounter issues on other platforms or without mkvmerge, please feel free to report them, but be aware this is a personal tool shared for others to use "as is."


Why You Need This

Downloading media with yt-dlp requires memorizing complex command-line syntax:

  • Format selection: -f bestvideo[height<=1080]+bestaudio is not intuitive
  • Codec preferences: Sorting by AV1, VP9, or H.264 requires -S flags
  • Subtitle handling: --write-subs --sub-langs en --convert-subs srt is verbose
  • Merging options: Getting separate files AND a merged file requires multiple commands
  • Platform differences: Batch files only work on Windows

This script generates a complete, ready-to-run Python script with all your options pre-configured. Just click, download, and run.


Key Features

Cross-Platform

  • Python scripts work on Windows, Mac, and Linux
  • Uses only Python standard library (no pip packages required)
  • Python 3.6+ (pre-installed on Mac/Linux)

Cookie Export (Experimental)

  • One-click cookie export via the context menu — exports browser cookies in Netscape format for yt-dlp --cookies
  • Auto Export Cookies option: automatically exports a cookie file alongside every generated .py script
  • Uses the userscript manager's GM_cookie API — no separate extension needed

⚠️ Note: This is a newly integrated feature. The GM_cookie API may not have access to all cookie types (such as HttpOnly or certain Secure-flagged cookies) depending on your browser and userscript manager. Whether the exported cookies are sufficient for login-required content (age-restricted, private, members-only) has not been thoroughly tested. For reliable authenticated downloads, a dedicated cookie extension like "Get cookies.txt LOCALLY" remains the proven approach — place the exported file alongside the .py script named %domain%_cookies.txt.

Flexible Output Modes

Mode Description
Merge Combine video + audio + subtitles into one MKV file
Separate Keep each component as its own file
Merge + Sep Get both: merged file AND separate copies
None Skip this component entirely

Mix and match modes per component—e.g., merge video+audio but keep subtitles separate.

Video Options

  • Quality: Best, 4K, 1440p, 1080p, 720p, 480p, 360p, 240p, 144p
  • Codec (YouTube): Auto, AV1, VP9, H.264

Audio Options

  • Quality: Best, Medium, Smallest
  • Format: Auto, MP3, AAC, Opus (available on all sites)

Subtitle Options

  • Interactive language selection when script runs
  • Format conversion: Original, SRT, VTT, ASS
  • Auto-generated subtitles included

Smart Merging

  • Uses mkvmerge for advanced merging (preserves all tracks)
  • Falls back to FFmpeg if mkvmerge unavailable
  • Prefer MP4 option for maximum playback compatibility
  • Single yt-dlp call for metadata efficiency

Secret Extras Menu

Right-click the ☕ Support button to access hidden power-user options:

  • Include Video ID: Toggle video ID in output filenames (on by default)
  • Prefer MP4: Use MP4 container instead of MKV (requires FFmpeg, best with H.264+AAC)
  • Delete Py After Run: Automatically remove the generated .py script after successful execution
  • Delete Cookie After Run: Automatically remove the exported cookie file after the script finishes
  • Auto Export Cookies: Automatically export a cookie file every time you generate a download script

Two-Tier File Identification

When downloading video + audio as separate streams, the script uses a robust two-tier system to correctly identify which file is which:

  1. Tier 1 — ffprobe (fast, local): Inspects the file's actual streams
  2. Tier 2 — yt-dlp format-ID probe (network, authoritative): Matches filenames against yt-dlp's resolved format IDs

This prevents misclassification of audio-only .webm/.mp4 files as video.

Upfront Tool Checks

Generated scripts verify that all required tools (ffmpeg, ffprobe, mkvmerge) are available before starting any downloads, based on what the selected options actually need. Clear error messages tell you exactly what to install.

Additional Features

  • Thumbnail download: Save the best available thumbnail
  • Comments download: Export YouTube comments to JSON
  • List Formats: View all available formats in terminal
  • Cookie file support: Access age-restricted or private content (see cookie sections above and below)
  • Force overwrite: Configurable file replacement behavior
  • Site-specific handling: Optimized for combined-stream sites (HLS), Cloudflare-protected sites, Vimeo embeds
  • Playlist detection: Automatic simplified flow for playlists and albums

Supported Sites

Works on any site supported by yt-dlp, including:

  • YouTube (including Music)
  • Reddit
  • Instagram
  • TikTok
  • Twitter/X
  • Twitch
  • Vimeo (including embeds)
  • Facebook
  • Dailymotion
  • SoundCloud
  • Arte.tv
  • Tagesschau.de
  • Livestorm
  • ...and 1000+ more

Usage

Quick Download

Action Result
Click Download Python script with current settings
Right-click Open settings menu
Double-click Hide button for 5 seconds

Settings Menu

  • Hover over Video/Audio/Subtitle rows to access quality/codec/format submenus
  • Click Merge, Sep, or None buttons to toggle output modes
  • Click "💬 Comments Only" for YouTube comment export
  • Click "🖼️ Thumbnail" to download the video thumbnail
  • Click "🍪 Export Cookies" to export browser cookies for yt-dlp
  • Click "📋 List Formats" to see all available formats
  • Click "⬇ Download" button to generate the script
  • Right-click "☕ Support" to access Secret Extras

Running the Script

Windows:

python dl_video_name.py

Mac/Linux:

python3 dl_video_name.py

The script changes to its own directory automatically—run it from anywhere.


How It Works

  1. Configure: Right-click the floating button to set video quality, codec preference, subtitle format, and output modes.
  2. Generate: Click the button to download a .py script pre-configured with your URL and settings.
  3. Run: Execute the Python script. It will:
    • Check for yt-dlp, mkvmerge, ffmpeg, and ffprobe (based on what's actually needed)
    • List available subtitles and prompt for language
    • Download all components in a single yt-dlp call
    • Identify files using two-tier detection (ffprobe → yt-dlp probe)
    • Merge/copy files according to your mode selections
    • Clean up temporary files (and optionally the script + cookie file)

Cookie Authentication

For public content, no cookies are needed. For login-required content (age-restricted, private, members-only), you have two options:

Option 1: Built-in Export (Experimental)

Use the "🍪 Export Cookies" button or enable "Auto Export Cookies" in Secret Extras. This is quick and requires no extra tools, but the GM_cookie API may not be able to access all cookie types depending on your browser and userscript manager. Whether the exported cookies are sufficient for authenticated content has not been thoroughly tested yet — your mileage may vary.

Option 2: Dedicated Extension (Proven)

Use a browser extension like "Get cookies.txt LOCALLY" which has deeper browser-level access and is known to produce complete cookie exports. Place the exported file in the same directory as the .py script, named %domain%_cookies.txt (e.g., www.youtube.com_cookies.txt). The generated scripts automatically detect and use it.

Userscript Manager Compatibility for Built-in Export

Manager Status
Tampermonkey ✅ Exports cookies (real-world sufficiency for authenticated content still being evaluated)
Violentmonkey ⚠️ GM_cookie recently merged but not yet in the published extension — will show "API not available" until a new version is released

Installation

Requirements

Steps

  1. Install a userscript manager.
  2. Install this script.
  3. Visit any supported video site.
  4. The download button appears in the bottom-right corner.

Technical Details

  • SPA Support: Monitors URL changes for single-page apps (Reddit, YouTube)
  • Shadow DOM: Button and menu isolated from page styles
  • Cookie Files: Export via menu or place hostname_cookies.txt next to the script for authentication
  • Temp File Handling: Uses random prefixes to avoid collisions; cleans up after completion
  • File Identification: Two-tier system — ffprobe for local inspection, yt-dlp format-ID probe as fallback
  • Combined Stream Detection: Automatically splits muxed streams on sites like TikTok and Twitter

Generated Script Structure

PHASE 1: Download all components (single metadata fetch)
PHASE 2: Identify downloaded files (two-tier: ffprobe → yt-dlp probe)
PHASE 3: Merge selected components (mkvmerge or FFmpeg)
PHASE 4: Create separate copies (if requested)
PHASE 5: Cleanup temporary files (+ optional script/cookie removal)

FAQ

Q: Why Python instead of batch files?
A: Batch files only work on Windows. Python scripts run on Windows, Mac, and Linux with identical behavior.

Q: Do I need to install any Python packages?
A: No. The script uses only Python's standard library (subprocess, shutil, pathlib, glob).

Q: What if mkvmerge isn't installed?
A: The script falls back to FFmpeg via yt-dlp's native merging. Some advanced combinations (merge video+subs without audio) require mkvmerge.

Q: Why does the script ask for subtitle language every time?
A: Different videos have different available subtitles. The script shows you what's available and lets you choose interactively.

Q: Can I download private/age-restricted videos?
A: Yes, with cookies. The built-in "🍪 Export Cookies" feature is available but still experimental — it may or may not provide sufficient cookies depending on your browser and the site's requirements. For reliable results, a dedicated cookie extension like "Get cookies.txt LOCALLY" is the proven approach. See the Cookie Authentication section above.

Q: Will the generated scripts run after I close the browser?
A: Yes. The .py scripts are fully standalone and run independently of the browser.

Q: Can the script and cookie files auto-delete after running?
A: Yes. Enable "Delete Py After Run" and/or "Delete Cookie After Run" in the Secret Extras menu (right-click "☕ Support"). Files are only deleted after successful execution.

Q: The download button isn't appearing on a site.
A: The script only activates on sites listed in the @match directives. You can add additional sites by editing the userscript header.

Q: What is the Secret Extras menu?
A: Right-click the "☕ Support" button in the context menu to reveal power-user toggles like Prefer MP4, auto-cleanup, and cookie auto-export.

Q: The cookie export shows "API not available."
A: This means your userscript manager doesn't support the GM_cookie API yet. Tampermonkey supports it; Violentmonkey has it merged but not yet in the published extension. Use a dedicated cookie extension as a workaround.


Permissions Explained

Permission Why It's Needed
GM_setValue / GM_getValue Save your quality/codec/format preferences
GM_cookie Export browser cookies for yt-dlp authentication (experimental — see Cookie Authentication section)