3. NewAPI Download Next Video
NewAPI Download Next Video does the boring part
- video
- report
The payoff node. NewApiDownloadNextVideo takes no inputs at all - you drop it in, run it, and it downloads the next finished video to ComfyUI's output folder. After a submit and a query or two, this is the node that turns your relay credits back into a file on disk.
How it works
The "next" in the name is doing real work. Every task the submit node created is stored with a submission order in newapi_video_tasks.json, so this node walks the list, finds the earliest-submitted task that has a video URL and a terminal status (succeeded - or failed but still carrying a partial render URL) and hasn't been downloaded yet, then streams it to disk as newapi_{model}_{task_id}.mp4 in your ComfyUI output directory. It marks the task downloaded so the next run picks the next one. Run it repeatedly and it drains your finished queue oldest-first. That's the whole design: it's a queue, and this is the pop operation.
Outputs
- video - a
VIDEO-typed output, but a thin wrapper around the downloaded file, not a tensor of frames. It implementsget_dimensions()andsave_to(), which is what ComfyUI's video nodes expect. Point it at a preview or save node that handles the video type and you're done. - report - a STRING:
下载成功:filenameon success,下载失败:...when the download threw, and暂时没有可下载的视频("no video to download yet") when nothing is ready.
The timing gotcha
This node only downloads tasks that are terminal and have a video URL - and that state doesn't exist until the query node (with an API key) has polled the relay and written the result back. Run download right after submit and you'll get "no video to download", not because it's broken, but because the job is still cooking. The flow that actually works: submit → wait → query → download. Query again if you want; it's idempotent.
Install
Via ComfyUI Manager, search maomao, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/xiaohuangzhengbang/maomao
Restart ComfyUI. No requirements.txt, no model downloads - the pack only uses requests, numpy, and Pillow, all already in ComfyUI's environment. This is the third of three nodes (submit, query, download) that share the task file and the relay connection.
Where people get burned
- The
videooutput is file-backed, not raw frame tensors, so a node expecting a rawVIDEOtensor may refuse the connection. Keep it aimed at the standard video preview/save nodes. - A failed download doesn't crash the workflow - it records
download_erroron the task and returns the failure string. That's good, but it means a flaky network can leave jobs in limbo; re-running download retries the same task, so don't be shy about it. - Like its siblings, this node runs on every queue pass (the NaN
IS_CHANGEDtrick). That's harmless here - worst case it reports "no video to download" and moves on.
Inputs (0)
No inputs
Outputs (2)
| Name | Type | Description |
|---|---|---|
| video | VIDEO | — |
| report | STRING | — |