Nodes/ComfyUI-yt_dl/YouTubeDownloader
ComfyUI Node

YouTubeDownloader

Pull a YouTube clip straight into ComfyUI's output folder

By if-ai·Created about a year ago·Updated 17 days ago· 2
YouTubeDownloader
    • file_path
    url
    modevideo
    qualityhighest
    subtitle_langsoriginal,en

    Every image-to-video workflow starts with the same boring step: you need a real clip on disk before you can feed it to Wan 2.1/2.2 or LTX and turn it into something new. And the boring part of that used to be leaving ComfyUI entirely - opening a downloader, saving a file, then hunting down the path and praying the naming didn't mangle it. The YouTubeDownloader node from if-ai/ComfyUI-yt_dl kills that round-trip: you paste a URL, it downloads straight into ComfyUI's output/yt_dl/ folder, and it hands you back the file path as a string you can wire straight into the next node. No API key, no cloud service, no leaving the graph.

    It's from ImpactFrames, the same author behind the IF_* node family and a long-running ComfyUI YouTube channel - a small, focused utility from someone who actually builds and uses this stuff.

    What it actually does

    Mechanically it's a well-finished wrapper around yt-dlp, the same tool that powers most of the internet's video downloading. You give it a URL and it does the extract-and-download dance: for video it asks for bestvideo[ext=mp4]+bestaudio[ext=m4a] and merges the result to a single MP4, grabs a thumbnail, and - if you leave subtitles on - pulls down .srt tracks in the video's original language plus English as a bonus. Everything lands in output/yt_dl/%(title)s.%(ext)s under your ComfyUI install.

    Where the author's fingerprints show is the anti-blocking machinery. YouTube has been fighting yt-dlp for years, and the node ships defenses for the two failure modes you'll actually hit:

    • HTTP 403s - if the first request gets blocked, it retries with android/web player clients as a fallback.
    • The SABR 360p cap - YouTube sometimes puts a session in an experiment that silently limits output to 360p. The node detects the warning, deletes the partial file, and retries with a fresh session (bounded, so it can't loop forever).

    It also sleeps between requests to dodge rate limiting, retries each fragment, and logs through its own logger so a closed stdout pipe can't crash a download mid-run.

    The inputs that matter

    The node is deliberately small. Three required inputs:

    • url - the video URL. YouTube and youtu.be links are the main event, but the code special-cases Twitter/X too.
    • mode - video, audio, or subtitles. Subtitles mode downloads just the .srt tracks without the video; audio gives you an m4a.
    • quality - highest, 144p, 360p, or 720p. Only meaningful in video mode; highest is the sensible default.

    There's also an optional subtitle_langs widget (default original,en) the README documents - a comma-separated list like pt,en. The one to avoid: all. The author warns it triggers YouTube rate-limiting and slows everything down.

    The output

    One output, file_path (a STRING): the absolute path to whatever was saved. That's the whole point of the node - it plugs into anything that consumes a path string, like a video loader in your img2vid pipeline, or PreviewAny if you just want to confirm the grab worked.

    Installing it

    No model downloads, no GPU, no heavy deps - just yt-dlp. Easiest route is ComfyUI Manager: search "ComfyUI-yt_dl" and install. Or do it by hand:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/if-ai/ComfyUI-yt_dl.git
    cd ComfyUI-yt_dl
    pip install -r requirements.txt
    

    Then restart ComfyUI and look for "YouTube Download" in the node browser (or use the "YouTube DL" button it adds to the top menu, which prompts for a URL and drops a configured node onto your canvas). The only real dependency is yt-dlp>=2024.11.4; the cookie-extraction helper uses browser-cookie3, but only as an optional extra.

    Where people get burned

    YouTube is a moving target, so the number one fix for a failing download is the same as it ever was: update yt-dlp. pip install --upgrade yt-dlp in your ComfyUI environment. If that doesn't clear a 403, drop in browser cookies - run the bundled python get_cookies.py, or export a cookies.txt from youtube.com via a browser extension and save it to output/yt_dl/cookies.txt. The node picks it up automatically. And remember this pack is fresh (a single maintenance commit in its history), so if something's broken, the upstream yt-dlp changelog - not the node - is where the real answer usually lives.

    CategoryYouTube

    Inputs (4)

    NameTypeDefaultDescription
    urlSTRING
    modeCOMBOvideo3 options: video, audio, subtitles
    qualityCOMBOhighest4 options: highest, 144p, 360p, 720p
    subtitle_langsoptSTRINGoriginal,en

    Outputs (1)

    NameTypeDescription
    file_pathSTRING