Nodes/ComfyUI-Alchemine-Pack/Danbooru Post Tags Retriever
ComfyUI Node

Danbooru Post Tags Retriever

Pull the full, categorized tag set off any Danbooru post by ID

By alchemine·Created about a year ago·Updated 2 days ago· 2
Danbooru Post Tags Retriever
    • full_tags
    • general_tags
    • character_tags
    • copyright_tags
    • artist_tags
    • meta_tags
    • image_url
    post_id

    DanbooruPostTagsRetriever is the "gimme the recipe for this image" node: you give it a Danbooru post ID and it fetches that post's tags from the board, split into the same categories the board uses - general, character, copyright, artist, meta - plus the full combined tag string and the image URL. If you're building prompts for Danbooru-trained models like Illustrious or NoobAI, this is the node that turns "I like this reference" into a working prompt in one step.

    The tag taxonomy matters here because it's the same taxonomy the models learned on. The board's ~30 tags per image are split into general (clothing, pose, setting), character (named characters), copyright (the series), artist (style - and on Illustrious/NoobAI, artist tags function as strong style switches), and meta (technical stuff like highres). Getting them as separate outputs means you can keep or drop categories deliberately - strip the artist tags if you don't want the style, keep just the character tags if you want the design, and so on.

    How it works

    The node hits https://danbooru.donmai.us/posts/{post_id}.json, which returns the post record including all its tag strings. It then splits them into the five categories and converts each tag from Danbooru's underscore format (white_dress) back to the space-separated form models like (white dress). The full_tags output is the character + copyright + artist + general groups joined in that order - deliberately excluding meta tags, so the prompt you feed your sampler doesn't get technical noise like absurdres and highres unless you pull them in separately from meta_tags.

    Responses are cached, so asking for the same post twice in one process lifetime doesn't re-hit the API - a real courtesy given Danbooru's rate limits.

    Inputs and outputs

    One input: post_id - the numeric ID of the post (the number in the URL, e.g. 9557805).

    Seven outputs: full_tags, general_tags, character_tags, copyright_tags, artist_tags, meta_tags, and image_url (the direct file URL, "not_found" if the file is missing). The full_tags string is the one you'll usually wire into a text encoder; the categorized ones are for when you want to filter.

    Install

    Part of ComfyUI-Alchemine-Pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/alchemine/comfyui-alchemine-pack
    pip install -r requirements.txt
    

    Or via ComfyUI Manager (search "ComfyUI-Alchemine-Pack"). The Danbooru nodes use plain requests (already in ComfyUI's environment); the only pack dependency is python-dotenv. No model downloads.

    Common issues

    Invalid or deleted post IDs return an error rather than an empty string - check the ID in the browser first. And remember that Danbooru tags come back in the board's own vocabulary; they're only "correct" as prompts for models trained on that vocabulary, so don't feed them to a natural-language model like Flux and expect magic. Rate limits are real: the pack caches, but hammering the endpoint with hundreds of unique IDs in one session can still get you throttled.

    CategoryAlcheminePack/Danbooru

    Inputs (1)

    NameTypeDefaultDescription
    post_idSTRING

    Outputs (7)

    NameTypeDescription
    full_tagsSTRING
    general_tagsSTRING
    character_tagsSTRING
    copyright_tagsSTRING
    artist_tagsSTRING
    meta_tagsSTRING
    image_urlSTRING