Custom ComfyUI nodes for downloading, converting, and previewing audio/video from YouTube and other supported sites using yt-dlp.
Easily fetch high-quality media, auto-convert to your preferred formats, and preview files directly inside ComfyUI.
π Major Update: This version introduces the new YTDLPreview node with enhanced media preview capabilities and significantly improved functionality.
- YTDLPreview Node β New unified preview node that handles both audio and video files
- Replaces Audio-Only Preview β YTDL Preview becomes the primary preview node (YTDLPreviewAudio is now legacy)
- Smart Media Detection β Automatically detects whether files are audio or video and displays appropriate metadata
- Streamlined Outputs β Clean AUDIO output + current_file_path STRING for connecting to other nodes
- Visual File Navigation β Easy browsing between multiple downloaded files with clear media type indicators
- Comprehensive Cookie Guide β Complete setup instructions for all major browsers in README
- Chromium Browser Support β Detailed steps for Chrome, Edge, Brave cookie extraction using browser extensions
- Firefox Auto-Extraction β Seamless automatic cookie extraction for Firefox users
- 1080p+ Video Access β Proper cookie setup enables high-quality video downloads (720p, 1080p, 4K)
- Quality Restriction Warnings β Clear explanation of YouTube's 480p limit for non-authenticated users
- Fully Functional Time Cropping β Extract specific video/audio segments with native yt-dlp integration
- Precise Format Control β Choose exact video format + resolution combinations (720p + mp4, 1080p + webm)
- Enhanced Progress Tracking β Real-time download progress with detailed console output
- Better Error Handling β Improved retry mechanisms and format fallback systems
- FFmpeg Integration β Seamless audio/video processing with proper parameter handling
- Fixed Index Switching β file_index parameter now properly triggers node re-execution when changed
- Simplified Node Outputs β Removed confusing video COMBO output (current_file_path STRING is sufficient)
- Enhanced Input Validation β Better time format support with colon separators (0:30 format)
- Comprehensive Documentation β All parameters, cookie setup, and troubleshooting moved to README
- Legacy Node Deprecation β Clear guidance to migrate from YTDLPreviewAudio to YTDLPreview
- Backward Compatible β All existing workflows continue to work
- Legacy Support β Original YTDLPreviewAudio marked as legacy but fully functional
- Stability Fixes β Resolved ComfyUI crashes and integration issues
- π₯ Download Media β Supports YouTube and 1,000+ other platforms via yt-dlp.
- π΅ Audio Conversion β Convert audio to
mp3,wav,flac,m4a, orogg. - π¬ Enhanced Video Quality Selection β Choose specific video formats (mp4, webm, mkv) with resolution control (720p, 1080p, etc.).
- βοΈ Time Cropping β Crop videos/audio to specific time ranges with FFmpeg integration.
- π Custom Output Paths β Choose your own storage folder within ComfyUI.
- πͺ Cookie & Browser Support β Use stored browser cookies to bypass restrictions.
- π Playlist Support β Optionally download entire playlists or just individual videos.
- π Optimized Download Speeds β Auto-handles retries, anti-bot headers, and connection stability.
- π Built-in Audio Preview β Listen to downloaded audio directly within ComfyUI.
- π οΈ Automatic Dependency Management β Validates dependencies on first run.
cd ComfyUI/custom_nodes
git clone https://github.com/Saganaki22/ComfyUI-ytdl_nodes.gitThe nodes will auto-validate requirements on the first launch, but you can also manually install them:
pip install -r requirements.txt- ComfyUI (latest)
- yt-dlp
- ffmpeg (required for audio conversion and time cropping)
- Python 3.9+ recommended
torch+torchaudio(usually included with ComfyUI)opencv-python(for video thumbnail extraction)Pillow(for image processing fallbacks)
- Windows:
winget install ffmpeg
- MacOS:
brew install ffmpeg
- Linux:
sudo apt install ffmpeg
Once installed, restart ComfyUI.
You'll find the new nodes under audio/ytdl in the node search bar:
Input one or more video URLs (YouTube, SoundCloud, etc.).
- Supports multiple links (one per line).
- Returns a list of valid URLs for downstream nodes.
Download videos or extract audio with comprehensive options:
- Choose audio-only or full video with enhanced quality control.
- Pick output format (
mp3,wav, etc.) and video formats (mp4, webm, mkv). - Time cropping β Extract specific segments (e.g., 30s-2:30).
- Supports custom filenames and storage paths.
- Cookie + browser-based authentication supported.
- Playlist downloading enabled.
- See detailed parameter guide below for cookie setup and quality restrictions.
Enhanced preview node with streamlined outputs (replaces the old audio-only preview):
- Audio + Media Support β Preview both video and audio files with metadata display
- Fixed Index Switching β file_index properly triggers updates
- Smart Detection β Auto-detects media type and provides appropriate preview data
- Clean Outputs β Returns AUDIO data and current_file_path STRING for connecting to other nodes
- Enhanced UI β Clear tooltips and improved format input indicators
- Visual File List β Navigate between files with media type indicators
- Use this node instead of the legacy audio preview
Original audio-only preview node (kept for backward compatibility):
β οΈ DEPRECATED β Use the new YTDL Preview node instead for better functionality- Built-in audio player display.
- Shows file name, size, duration, channels, and format.
- Supports navigating between multiple downloaded files.
- Will be removed in future versions
links: Connect from YTDL Links Input nodeoutput_folder: Where files are saved (relative to ComfyUI root)media_type: Choose "audio_only" or "video" downloadsquality: Resolution/bitrate (higher = better quality, larger files)
audio_format: Output format for audio-only downloads (mp3, wav, m4a, flac, ogg)video_format: Output format for video downloads (mp4, webm, mkv, best)
enable_time_crop: Extract only part of the video/audiocrop_start: Start time (e.g., "0:30" or "30")crop_end: End time (e.g., "5:00" or "300")- Requires FFmpeg to be installed
use_cookies: Enable for higher quality downloads (RECOMMENDED)browser_for_cookies: Choose your browser for cookie extractioncookie_file: Path to custom cookies.txt file
download_playlist: Download entire playlist vs single videocontinue_on_error: Keep going if some videos failcustom_filename: Template for output filenames
β οΈ YouTube limits video quality to 480p or lower for non-authenticated requestsFor 720p, 1080p, or higher quality, you MUST use cookies!
πͺ Chromium-based browsers require manual cookie export to download 1080p+ videos
Step-by-Step Instructions:
- Install Cookie Extractor Extension
Install "Get cookies.txt LOCALLY" extension
Or search "cookies.txt" in your browser's extension store
![]()
Login to YouTube
- Open YouTube in the same browser where you installed the extension
- Log in to your YouTube account (this is crucial for quality access)
Extract Cookies
- Enjoy High Quality Downloads
- You can now download videos up to 1080p, 1440p, and 4K quality
- Without cookies, YouTube limits downloads to 480p maximum
π Disable VPN for best results
VPNs can cause download failures or quality restrictions
π¦ Firefox cookie extraction works automatically
Set
browser_for_cookies = "firefox"anduse_cookies = True
- Always enable cookies for quality downloads
- Use Firefox if possible (better cookie support)
- Disable VPN during downloads
- Install FFmpeg for time cropping features
- Choose appropriate quality based on your needs
If you experience issues when downloading from YouTube:
YouTube aggressively blocks suspicious traffic. Disable any VPNs before retrying.
Some restricted videos require authentication. Sign in to YouTube using the same browser you'll use for cookie extraction.
In the YTDL Downloader node, set browser_for_cookies β firefox (recommended).
- Firefox stores cookies in a readable format for yt-dlp.
- Chrome uses a secure database, which may fail to extract cookies.
If browser extraction fails for chromium / Chrome, you can manually export cookies:
- Use a browser extension like Get cookies.txt.
- Paste the path to your
cookies.txtfile into thecookie_fileinput field in the YTDL Downloader node.
Even if you don't set up cookies, the downloader includes graceful fallbacks.
The nodes have several built-in fail-safes to ensure downloads and previews succeed whenever possible:
| Feature | Primary Method | Fallback(s) |
|---|---|---|
| Authentication | Browser cookie extraction | Custom cookie file β No cookies with retries |
| Anti-bot Protection | Normal yt-dlp request | Adds extra headers, retries, and randomized delays |
| Playlist Handling | Full playlist download | Falls back to first video if playlist mode is disabled |
| File Detection | Uses expected filename | Scans output folder & picks latest downloaded file |
| Audio Conversion | torchaudio loads audio |
Falls back to ffmpeg to convert to .wav automatically |
These mechanisms ensure your downloads keep working even if YouTube changes its API or blocks certain requests.
ComfyUI-ytdl_nodes/
βββ __init__.py
βββ ytdl_nodes.py
βββ requirements.txt
βββ workflows
β βββ YTDL_Audio.json
β βββ YTDL_Video.json
βββ README.md
This project uses:
- yt-dlp β for downloading and extracting media.
- ffmpeg β for audio/video conversion.
- ComfyUI β for node-based AI workflows.
This project is released under the MIT License.
Feel free to use, modify, and distribute.
- If yt-dlp fails to bypass restrictions, try browser cookie extraction (recommended).
- Always prefer Firefox for better compatibility.
- If dependency validation fails, manually run:
pip install yt-dlp ffmpeg-python
With these nodes, you can seamlessly integrate media downloading and audio previewing into your ComfyUI pipelines.