Nodes/ComfyUI-JM-KLing-API/KLingAI Video Downloader
ComfyUI Node

KLingAI Video Downloader

Save Kling's finished video URL to your output folder

By juemingai·Created about a year ago·Updated 11 months ago· 3
KLingAI Video Downloader
    • video_path
    • video_url
    video_url
    filename_prefixKLingAI
    custom_output_dir

    Every video node in this pack eventually hands you a URL from Query Status. KLingAI Video Downloader is the terminal node that grabs that URL and drops an MP4 into ComfyUI's output directory with a clean sequence filename. It's the final step of the standard pipeline - Task → Query Status → here - and honestly the most unglamorous node in the pack. It just does the thing.

    The mechanism is a straightforward streaming download: requests.get(url, stream=True) written to disk in chunks, no waiting, no task tracking. MP4 is the one format it knows (KLingAI_0001.mp4, auto-incrementing), and it writes a small JSON into the output folder's .previews directory so the result shows up in ComfyUI's history instead of vanishing into the void.

    Inputs

    • video_url (required) - the url output from Query Status (or any MP4 URL you want saved).
    • filename_prefix (required) - default KLingAI, the base of the output filename.
    • custom_output_dir (optional) - a custom save location. Note the difference from its image sibling: this one uses the value as-is (a relative path resolves relative to your working directory), so it's more permissive - and easier to point somewhere unexpected by accident.

    Outputs

    • video_path (STRING) - the full path where the file landed, ready to hand to other tools or script.
    • video_url (STRING) - the source URL, echoed back.

    That's it. Two strings, no video tensor (ComfyUI's core nodes don't have a standard video tensor type the way they do images, so the pack settles for a path you can feed to a Load Video or Video Combine node elsewhere).

    Where people get burned

    • Kling URLs expire. These result links are often time-limited, and a 403/410 on a "worked before" URL is the classic symptom. Re-run Query Status with the same task_id to mint a fresh URL, then download promptly.
    • Blank URL. Empty input returns the error message as video_path rather than raising - check the console for the real cause.
    • Wrong extension assumptions. If Kling hands back something that isn't MP4, the _0001.mp4 naming still applies and you can end up with a mislabeled file. The README's own scope says MP4; most Kling results are.
    • Custom dir surprises. Because custom_output_dir is used as-is, a typo can create a folder in an odd place. The image downloader constrains you to the output tree; this one trusts you. Verify where the file landed the first time.
    • Expecting more than a file. It returns a path, not something you can preview directly. That's by design for this pack - pair it with a video loader node if you need frames back in the graph.
    CategoryJM-KLingAI-API

    Inputs (3)

    NameTypeDefaultDescription
    video_urlSTRING
    filename_prefixSTRINGKLingAI
    custom_output_diroptSTRING

    Outputs (2)

    NameTypeDescription
    video_pathSTRING
    video_urlSTRING