Nodes/ComfyUI-ADIC/图片翻译结果提取器
ComfyUI Node

图片翻译结果提取器

Dig the translated image URLs back out of the API's JSON

By jinchanz·Created about a year ago·Updated a day ago· 5
图片翻译结果提取器
    • extracted_data
    api_response
    extract_typeresult_urls
    index0

    ImageTranslateAPI dumps a big JSON blob on you. Somewhere in that blob are the translated image URLs you actually came for. ImageTranslateResultExtractor is the tool that digs them out without you hand-copying strings from the UI - feed it the API's response, pick what you want, and get a clean JSON string out.

    The mechanism is honest string surgery: it parses the API response JSON, then slices out the part you asked for based on the extract_type:

    • result_urls (default) - all translated image URLs.
    • result_jsons - the per-image translation result objects (useful if the service returns structured translations you want to inspect).
    • source_info - original URL plus language info for each image.
    • all - the complete data list, nothing filtered.

    The index field exists (0–100) but the source comments say it's a reserved, currently-unused parameter - so don't expect it to change anything yet. Output is a single extracted_data STRING containing whatever slice you chose, JSON-encoded.

    Where it sits in the workflow

    The intended chain, straight from the README:

    ImageTranslateParamsBuilder → ImageTranslateAPI → ImageTranslateResultExtractor
    

    From there the classic next step is wiring extracted_data (in result_urls mode) into the pack's own LoadImagesFromUrls, which fetches those translated images back into ComfyUI as IMAGE tensors so you can preview, save, or continue processing them. The pair forms the "translate images in a batch, get local images back" loop this pack is for.

    Practical notes

    It's tolerant: if the response is an error object (the API node returns {"error": ...} on failure), the extractor doesn't crash - it just finds nothing to extract and gives you an empty result, which is the kind of silent outcome that makes you check the API node's console log first when your workflow comes back empty. Also remember the output is JSON-as-string, not a list; a consumer like LoadImagesFromUrls (which auto-detects JSON arrays) handles it fine, but plain text tools will see a string.

    Installing

    cd ComfyUI/custom_nodes
    git clone https://github.com/jinchanz/ComfyUI-ADIC
    

    Restart ComfyUI, or install "ComfyUI-ADIC" via ComfyUI Manager. No extra dependencies, no models. Given its single job, this node only earns its place in a workflow that actually runs batch translations - but when you do, it's the difference between scrolling a wall of JSON and just reading the URLs.

    CategoryMalette

    Inputs (3)

    NameTypeDefaultDescription
    api_responseSTRING
    extract_typeoptCOMBOresult_urls4 options: all, result_urls, result_jsons, source_info
    indexoptINT00–100

    Outputs (1)

    NameTypeDescription
    extracted_dataSTRING