Greasy Fork

Greasy Fork is available in English.

yt-dlp Python-Downloader

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

当前为 2026-01-11 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

作者
piknockyou
评分
0 0 0
版本
9.2
创建于
2026-01-11
更新于
2026-01-11
大小
99.0 KB
许可证
AGPL-3.0
适用于

See Gif/Screenshot 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)

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, 1080p, 720p, 480p, 360p
  • Codec (YouTube): Auto, AV1, VP9, H.264

Audio Options

  • Quality: Best or Smallest

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
  • Single yt-dlp call for metadata efficiency

Additional Features

  • Comments download: Export YouTube comments to JSON
  • Cookie file support: Access age-restricted or private content
  • Force overwrite: Configurable file replacement behavior
  • Site-specific handling: Optimized for combined-stream sites (HLS)

Supported Sites

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

  • YouTube
  • Reddit
  • Instagram
  • TikTok
  • Twitter/X
  • Twitch
  • Vimeo
  • 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 "Download" button to generate the script

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, and ffprobe
    • List available subtitles and prompt for language
    • Download all components in a single yt-dlp call
    • Merge/copy files according to your mode selections
    • Clean up temporary files

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: 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: Uses ffprobe for ambiguous formats (.webm), falls back to extension-based detection

Generated Script Structure

PHASE 1: Download all components (single metadata fetch)
PHASE 2: Identify downloaded files (video/audio/subtitle)
PHASE 3: Merge selected components (mkvmerge or FFmpeg)
PHASE 4: Create separate copies (if requested)
PHASE 5: Cleanup temporary files

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. Export your browser cookies to a file named hostname_cookies.txt (e.g., www.youtube.com_cookies.txt) in the same directory as the script.

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.


Permissions Explained

Permission Why It's Needed
GM_setValue / GM_getValue Save your quality/codec/format preferences
GM_setClipboard Reserved for future copy-to-clipboard features