user_3101 / TensorArt Downloader Neo

Published:

Version: 0.3.7+94427ed

Summary: Download images/videos flagged as inappropriate on Tensor.Art.

License: AGPL-3.0-or-later; https://www.gnu.org/licenses/agpl-3.0.txt

Antifeature: unspecified

TensorArt Downloader

TensorArt Downloader adds a download button to generations on Tensor.Art when the interface flags the content as restricted/blocked and disables the native download.

Based on the original userscript by Angry Toenail (v0.2), with robustness improvements: CORS bypass, multiple URL sources, actual file download, and automatic diagnostics when the site changes and the script breaks.


Features

  • Injects Download button into blocked items in the tasks/generations list
  • Resolves media through multiple sources: task JSON, DOM, API response index, and download endpoint
  • Saves the actual file (blob), instead of just opening it in a new tab
  • Authentication via logged-in session (cookie / Bearer)
  • Nearly silent when working; generates a report only if it fails due to a possible site update
  • Debug API in the console: __TADL.help()

Requirements

  • Browser with Tampermonkey, Violentmonkey or similar
  • Logged-in account on https://tensor.art/
  • Script permissions: GM_xmlhttpRequest and access to api.tensor.art (accept when prompted by the manager)

Installation

  1. Install a userscript manager (Tampermonkey / Violentmonkey).
  2. Click Install this script on this Greasy Fork page.
  3. Confirm the installation and domain permissions, if requested.
  4. Open tensor.art and log in.
  5. Reload the page with Ctrl+F5.

Important: disable other old copies of the same script. Two active versions on the same site may conflict.


How to use

  1. Go to the generations / task history area where there is media with blocked download in the UI.
  2. Wait for the card to load. The blocked button should turn into Download.
  3. Click Download.
    • Done — file saved
    • Fail — failed (see diagnostics below)

In the browser console (F12 → Console), upon loading the page you should see something like:

[TA-DL] v0.3.7 ready | token=yes | GM_xhr=yes | ...
  • token=yes — session cookie found (logged in)
  • GM_xhr=yes — userscript network permission OK

How it works (technical summary)

  1. Intercepts API responses containing /query (tasks list).

  2. Locates items with the blocking class (.group.cursor-not-allowed) in the DOM.

  3. Associates each card with the API item (e.g., imageId).

  4. Gathers URL candidates using this general logic:

  5. URLs already seen in API responses (in-memory index)

  6. Fields from the task item JSON

  7. <img> / <video> tags in the card

  8. Page network resources containing the ID

  9. Endpoint POST /works/v1/generation/image/download (fallback)

  10. Downloads the best candidate via GM_xmlhttpRequest (avoids CORS blocking from the page's fetch).


Automatic diagnostics (breakage due to site updates)

When Tensor.Art changes its layout or API and the script fails in a "structural" way, it can automatically generate a report:

  • Orange toast on the page
  • Console group: [TA-DL] UPDATE DIAGNOSTIC
  • Automatic download of ta-dl-diag-<timestamp>.json
  • History in localStorage (latest reports)

On successful downloads, the script remains nearly silent. Identical reports are limited (debounce ~90s) to avoid spamming.

The report JSON includes error codes, what probably changed, what to edit in the script, DOM selector probes, a sample of the item JSON, and API attempts.

Most common codes

Code Meaning / where to look
PAYLOAD_NO_TASKS /query response without data.tasks[]
DOM_TASK_NOT_FOUND Task card not found (CSS/layout changed)
ITEM_MISSING_ID Item without imageId (or equivalent fields)
ITEM_NO_URLS Item JSON without media URL
DOWNLOAD_API_FAIL Download / auth / body endpoint failed
NO_CANDIDATES No usable URL found
ALL_CANDIDATES_FAILED URLs existed, but all failed or were placeholders
TOKEN_MISSING Not logged in / session cookie missing
GM_XHR_MISSING @grant GM_xmlhttpRequest not applied

Console commands

With the Tensor.Art page open:

__TADL.help()           // quick guide
__TADL.diag.last()      // last crash report
__TADL.diag.history()   // saved history
__TADL.diag.export()    // download the last .json again
__TADL.diag.clear()     // clear history
__TADL.dump()           // internal indexes + last diag
__TADL.contract         // selectors/paths expected by the script
__TADL.version          // script version

Troubleshooting

  • Button does not appear

  • Confirm that you are logged in and that the task list has reloaded

  • Check if the console shows token=yes and GM_xhr=yes

  • Disable other copies of the script

  • The site layout may have changed → wait for a report or use __TADL.dump()

  • Fail when clicking

  • If you downloaded ta-dl-diag-*.json, open it and read codes and whatToFix

  • Sometimes the API returns only a "forbidden" image/moderation placeholder; the script tries other sources in the JSON/DOM

  • token=NO — log in again and reload the page

  • GM_xhr=NO — reinstall the script and accept the manager's permissions


Privacy and security

  • The script runs only on tensor.art (as per @match).
  • Uses the session token already present in the browser to call Tensor.Art's own API.
  • Does not send your data to third-party servers.
  • Diagnostic reports remain on your PC (local download + site's localStorage).
  • Like any userscript, review the code before installing.

Limitations

  • Depends on Tensor.Art's current layout and APIs; changes to the site may break selectors or endpoints.
  • If the backend stops exposing media in the JSON and only serves placeholders in the download API, it might be impossible to retrieve the file from the browser alone.
  • The HMAC signature of the download API uses the scheme compatible with the original script (0.2). If the API starts validating signs strictly, this part will need an update.
  • Use at your own risk and in accordance with Tensor.Art's terms and local legislation.

Changelog (summary)

  • 0.3.7 — Embedded guide in code + __TADL.help()
  • 0.3.6 — Automatic diagnostics on failures caused by site updates
  • 0.3.5 — Fixed zero candidates + stable download headers (version that successfully resumed downloading)
  • 0.3.2–0.3.4 — CORS via GM_xhr, multi-source URL, media index
  • 0.2 — Original script (Angry Toenail)

Credits

  • Idea and original base: Angry Toenail (TensorArt Downloader 0.2 userscript)
  • Refinements: multi-source URL, GM_xmlhttpRequest, blob download, crash diagnostics

Feedback

If the script stops working after a Tensor.Art update:

  1. Reproduce the error once
  2. Attach the ta-dl-diag-*.json file (if generated) in the feedback/issue
  3. Or paste the output of __TADL.diag.last() and __TADL.help()

This points out exactly which part changed (DOM, payload, or API) and speeds up the fix.


Rating: 0