Tom Hargreaves

Notes on automation, scraping, and the parts of it that break in production.

Word sums and digit grids: handling a captcha number image without extra OCR

A number image can be a word problem

A picture with numbers in it is not always a string to copy. One endpoint covers 7 + 5 = ?, 12 - 4, 6 x 3, English-word sums such as three + four, Chinese numeral questions, and variants that ask for the sum of the digits already shown. The question is rendered with noise, rotation or crossing lines, so the picture is the input, not the answer.

The distinction matters at the integration boundary. three + four has to become 7 before it can be typed into a form, and that conversion belongs on the recognition side. Send the picture unchanged, take the returned string, and do not run your own normalisation or arithmetic on top of it.

What the request actually contains

Use POST /v1/recognition/textcaptcha. image_data is an array of images: raw base64 or a data URI both work. The key is written verbatim after Basic in the header — Authorization: Basic nsk_YOUR_KEY. Encoding that key again as base64 makes it unrecognisable. A ?key=nsk_YOUR_KEY query parameter is accepted too, which is what the browser extension uses.

curl -X POST https://fuckcaptcha.top/v1/recognition/textcaptcha \
  -H "Authorization: Basic nsk_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image_data":["<base64>"]}'

The response to that submit is a job id, {"data":"nsj_..."}. Nothing has been recognised yet.

The returned value is already the answer

Polling GET /v1/recognition/textcaptcha?id=nsj_... with the same key returns {"data":["H7K5"],"metadata":{}} for a distorted string. For an arithmetic image the string is the number, for example 7. metadata is an empty object today and is reserved for future use, so pass it through rather than assuming a shape. The array wrapper is easy to miss: scripts that expect a scalar end up trying to do arithmetic on ['7'].

Type the returned string into the target form yourself. Recognition only uses the image; no cookies or account from your browser session are sent, so the answer has to be placed back into the session you already control.

Polling is not retrying

While a job runs the response is {"error":14,"message":"Incomplete job"}. Ask again after 500ms. Recognition jobs expire after 3 minutes; an expired job is void and must be resubmitted, with the credit already spent.

That is why a 14 should never trigger a fresh submit. Every accepted job is charged, and accepted jobs are not refunded if they fail or time out. A rejected submit — bad parameters, no credit left, no upstream capacity — costs nothing. The two cases look similar from a script unless you separate them: an error at submit time is free, an error after you hold a job id is not.

Failure modes worth coding for

GET /v1/status/ is the useful preflight: it returns credit, quota, duration (seconds to the next reset), lastreset and concurrency. balance is always 0 and exists only for client compatibility.

One credit changes the maths

Each recognition request costs one credit and polling is free; the topic page says signing up includes 200 free solves. The quota resets daily at 00:00 and does not roll over, so a queue that finishes just before the reset has no reason to hurry.

If you would rather not integrate at all, the browser extension recognises these images and fills them in from the same allowance. It is installed manually: unzip the package into a folder you will not move, open chrome://extensions, turn on Developer mode, choose Load unpacked, then paste the key from the dashboard into the popup. Chrome Web Store and Firefox Add-ons listings are still in review, and the extension is for Chromium-based desktop browsers only, not mobile.

The request fields and response shapes above are documented with copyable examples in the captcha number image reference, which is the shortest way to check the payload before wiring it into a form.