From a65c9d047fb07e5c56606a60ac16b65dca2045d1 Mon Sep 17 00:00:00 2001 From: dlawler489 <104159223@student.swin.edu.au> Date: Wed, 16 Sep 2026 12:53:36 +1000 Subject: [PATCH] Don't retry MakerWorld's anti-bot refusal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Measured against the live site: FlareSolverr reports no challenge on that endpoint and an unauthenticated call gets a normal reply in 3s, so this is MakerWorld limiting an account to a couple of downloads in a row, not a Cloudflare page. Two models retried three times each still came back empty — the retry only made every failure a minute slower. Keeps the classification, so a refusal is named for what it is and the model is flagged as still without files. Co-Authored-By: Claude Opus 5 --- README.md | 2 +- lib/importers/makerworld.js | 26 +++++++++----------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index d57f50c..1163898 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ A self-hosted web app for organizing your 3D-printing files (STL, 3MF, OBJ, FBX, - **Notes** — free-form notes per model, saved as you type. - **Search, filters & sorting** — search across names, descriptions, notes, tags, file names and designers; filter by format, source and license; include *or exclude* tags (match any/all); sort and group by source or format. Press / to search. - **Duplicate finder** — every file gets a SHA-256 content hash plus (for STL/OBJ/3MF) a geometry fingerprint, computed in the background. Models sharing files are grouped as *exact copies* or *same shape* (renamed, re-exported, converted — or mirrored, so check those), with a recommended copy to keep. Keeping one merges the others' tags, collections and notes into it and moves them to the trash; groups can be dismissed as "not duplicates". -- **Watch a MakerWorld collection** — paste a collection link (private ones work, using your MakerWorld token) and Printhive checks it on a schedule you choose, importing models added to it into a collection of the same name here, optionally AI-tagging the new ones. Each check reads the whole collection (paging through MakerWorld's own load-more call, up to ~640 models) and imports up to 15 of the new ones, spaced out, returning shortly after if more are waiting; models you remove on MakerWorld stay in your library. Each watch shows when it last ran, what it imported, and why a check failed — with a one-click token update when MakerWorld refuses your token. A model whose files MakerWorld's anti-bot check blocked is listed as still without files, with a "Get files" button to fetch them later. +- **Watch a MakerWorld collection** — paste a collection link (private ones work, using your MakerWorld token) and Printhive checks it on a schedule you choose, importing models added to it into a collection of the same name here, optionally AI-tagging the new ones. Each check reads the whole collection (paging through MakerWorld's own load-more call, up to ~640 models) and imports up to 15 of the new ones, spaced out, returning shortly after if more are waiting; models you remove on MakerWorld stay in your library. Each watch shows when it last ran, what it imported, and why a check failed — with a one-click token update when MakerWorld refuses your token. MakerWorld only lets an account download a couple of files in a row before its anti-bot limit refuses the rest, so most models in a big batch arrive as metadata: those are listed as still without files, with a "Get files" button to fetch them a few at a time. - **AI tags & descriptions** — bring your own key for DeepSeek (the default), OpenRouter, OpenAI or any OpenAI-compatible server (Ollama, LM Studio). Tag the whole library, only models not yet tagged, or a single model from its page. Each model's name, file names and (optionally) thumbnail are sent; tags are only ever added and descriptions only filled where empty unless you ask. Optionally it also gives models with unclear names (file-name leftovers, typos, site boilerplate) a clearer one; the old name is kept and can be restored with Undo on the model page. It can also suggest collections (reusing yours where they fit): suggestions wait on the AI page, grouped by name, until you create/add or dismiss them. Each run can do any mix of tags & descriptions, names and collections, and a reply that isn't the JSON asked for is retried once. Runs show live progress, tokens and cost, can be stopped and resumed, stop at an optional spending limit, and pause (rather than keep spending) if the server restarts. "Save & test connection" in Settings checks the key, model and whether it accepts images. - **Search by meaning** — switch the search box to *Meaning* to find models by what they are ("wall hook" finds a "coat hanger bracket"). Uses a small embedding model (bge-small-en-v1.5, ~34 MB) that runs on the server, so it's free and private; the index updates in the background as models change. - **Automatic tags** — strict whole-word rules over names, file names and archive contents (part types, mechanisms, materials, techniques) plus your own "word → tag" rules. Switch it off (optionally removing its tags) or re-apply it any time. Tags you add yourself are never changed; AI and rule tags are marked on the model page. diff --git a/lib/importers/makerworld.js b/lib/importers/makerworld.js index 3d65ca7..0622e6f 100644 --- a/lib/importers/makerworld.js +++ b/lib/importers/makerworld.js @@ -5,8 +5,6 @@ const flaresolverr = require('../flaresolverr'); -const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); - // A model page embeds its printable "instances" in __NEXT_DATA__. Each instance // id is what the download API takes. function parseInstances(html) { @@ -29,9 +27,10 @@ function parseInstances(html) { return result; } -// Cloudflare sometimes answers a download call with its anti-bot check instead of -// the JSON — especially during a run of downloads. It comes back as a normal -// answer, so nothing below retries it on its own. +// MakerWorld answers with an anti-bot message once an account has asked for a +// couple of files in a row. It isn't Cloudflare — FlareSolverr reports no +// challenge, and an unauthenticated call still gets a normal reply — so retrying +// doesn't clear it; only asking for fewer files does. const CHALLENGE_RE = /not a robot|just a moment|captcha|attention required|cf[- ]challenge/i; function isChallenge(answer) { if (!answer || answer.url) return false; @@ -39,18 +38,11 @@ function isChallenge(answer) { } // Resolve an instance to { name, url } (a signed, short-lived CDN download URL). -// A challenge usually clears if we let FlareSolverr's browser try again after a -// pause, so give it a couple of goes before reporting a problem. -async function resolveDownload(flaresolverrUrl, instanceId, token, { retries = 2, waitMs = 8000 } = {}) { +async function resolveDownload(flaresolverrUrl, instanceId, token) { const api = `https://makerworld.com/api/v1/design-service/instance/${instanceId}/f3mf?type=download&fileType=&devModelName=N1`; - const opts = { cookies: [{ name: 'token', value: token, domain: '.makerworld.com' }] }; - let answer; - for (let attempt = 0; attempt <= retries; attempt++) { - if (attempt > 0) await sleep(waitMs * attempt); - answer = await flaresolverr.solveJson(flaresolverrUrl, api, opts); - if (!isChallenge(answer)) return answer; - } - return answer; + return flaresolverr.solveJson(flaresolverrUrl, api, { + cookies: [{ name: 'token', value: token, domain: '.makerworld.com' }], + }); } // Why a download-link answer came back without a link: { message, tokenRejected }, @@ -63,7 +55,7 @@ function downloadProblem(answer) { } if (isChallenge(answer)) { return { - message: 'MakerWorld’s anti-bot check blocked the download. Trying again in a few minutes usually works.', + message: 'MakerWorld’s anti-bot limit blocked the download — it only allows a couple in a row.', tokenRejected: false, challenged: true, };