ComfyUI Node

Danbooru Get by URL

Grab any Danbooru post (image + tags) by URL, no API key needed

By L33chKing·Created about a year ago·Updated 11 months ago· 3
Danbooru Get by URL
    • IMAGE
    • TAG
    • POST_ID
    • IMG_WIDTH
    • IMG_HEIGHT
    url
    zoom512
    api_username
    api_key
    fetch_modeauto
    debugfalse

    This is the boring node in the pack, and that's exactly why you'll reach for it. Paste a Danbooru post URL into Danbooru Get by URL and it hands you the actual image, the post's full tag list, the post ID, and the dimensions - as plain outputs you can wire into the rest of your graph. No search, no FAISS index, no model. It's the "give me this specific post" node, the friendly neighbor of the pack's much fancier semantic-search sibling.

    The name is a small lie in the best way: it does not call any private API and needs no key. Danbooru's public JSON API is open for read-only post lookups, so you can pull from it with a blank username and password. The optional api_username / api_key fields just buy you higher rate limits - grab them from your Danbooru account settings if you're hammering the site.

    How it works

    Under the hood it's refreshingly simple: the node pulls the post ID out of the URL, fetches metadata through the Danbooru API, falls back to scraping the HTML page if the API call fails (that's the fetch_mode switch - auto, api, or html), downloads the actual file with retry logic, then returns it as a ComfyUI image tensor alongside the metadata.

    Two things worth knowing before you trust it blindly:

    • zoom is a cap, not a target. Set it to 512 and a 3000px post gets downscaled so its longest side is 512. But a 400px post stays 400px - the node never upscales. If you expect every output to be exactly 512, you'll be surprised. The output IMG_WIDTH / IMG_HEIGHT tell you what actually came back.
    • Failures return a gray placeholder image, not an error. Deleted post, dead link, wrong URL - you get a blank-ish image with the post ID baked in, and the graph keeps running. That's convenient, but it's also a trap: a placeholder can silently flow into a reference-image workflow and poison the result. Keep an eye on the console when debug is on.

    Inputs and outputs that matter

    For a beginner there's really only one required input: the url (e.g. https://danbooru.donmai.us/posts/1234567). Then optionally the zoom cap. Everything else - credentials, fetch_mode, debug - is fiddling you can ignore until you hit a problem.

    The outputs are where the value is:

    • IMAGE - wire this into an IPAdapter or ControlNet as a reference, or use it as img2img input.
    • TAG - the post's Danbooru tags as a comma-separated string. This is gold if you're prompting an anime model: Illustrious, NoobAI, and (partially) Pony were trained on the exact Danbooru tag vocabulary, so feeding a real post's tags into the prompt gets you dramatically closer to that look than free-form English.
    • POST_ID - for provenance or a quick "same post" fetch later.
    • IMG_WIDTH / IMG_HEIGHT - the dimensions after the zoom cap.

    Install

    This node ships in the Danbooru FAISS Search Nodes pack, so installing it installs all four nodes. Easiest path: ComfyUI Manager → search "Danbooru FAISS Search" → install. Or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/L33chKing/ComfyUI-danbooru-FAISS-search
    cd ComfyUI-danbooru-FAISS-search
    pip install -r requirements.txt
    

    Then restart ComfyUI. The requirements list is on the heavy side for a "simple" node - faiss-cpu, onnxruntime, and dghs-imgutils (the wd14 tagger) pull in real dependency trees - but that's the whole pack paying for the search nodes you may not use. The index files download automatically on first run, so expect a wait the first time you execute any node here.

    Gotchas

    Danbooru hosts everything - the board's content rating runs from general to explicit, and this node does not filter. If you're running this in a shared or work-adjacent environment, be aware that a wrong URL can land explicit content in your preview window. And remember: this is the read-only companion, not the search engine. If you don't have a specific post URL yet, you want the pack's other nodes instead.

    CategoryDanbooru

    Inputs (6)

    NameTypeDefaultDescription
    urlSTRINGDanbooru post URL (e.g. https://danbooru.donmai.us/posts/1234567)
    zoomINT51264–8192
    api_usernameoptSTRING
    api_keyoptSTRING
    fetch_modeoptCOMBOautoHow to fetch metadata: auto (API then HTML fallback), api only, or html only.
    debugoptBOOLEANfalse

    Outputs (5)

    NameTypeDescription
    IMAGEIMAGE
    TAGSTRING
    POST_IDSTRING
    IMG_WIDTHINT
    IMG_HEIGHTINT