capskip 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,167 @@
1
+ # Getting Started
2
+
3
+ This guide walks you through installing CapSkip, installing the Node.js SDK, and running your first captcha solve.
4
+
5
+ ---
6
+
7
+ ## Prerequisites
8
+
9
+ | Requirement | Details |
10
+ |---|---|
11
+ | **CapSkip app** | Windows desktop app from [capskip.com](https://capskip.com) |
12
+ | **Node.js** | 18 or newer |
13
+ | **Network** | SDK talks to CapSkip on `localhost` — no internet required for the API itself |
14
+
15
+ ---
16
+
17
+ ## Step 1 — Install and configure CapSkip
18
+
19
+ 1. Download CapSkip from [capskip.com](https://capskip.com).
20
+ 2. Install and launch the application.
21
+ 3. Open **Settings** and confirm:
22
+ - **Port** — default is `8080` (remember this value)
23
+ - **API key validation** — if enabled, copy your API key; if disabled, any string (e.g. `capskip`) is accepted
24
+
25
+ CapSkip exposes a standard captcha-solver API:
26
+
27
+ ```
28
+ POST http://127.0.0.1:<port>/in.php → submit captcha, returns OK|<id>
29
+ GET http://127.0.0.1:<port>/res.php → poll result, returns OK|<answer>
30
+ ```
31
+
32
+ ### Verify CapSkip is running
33
+
34
+ **Windows (PowerShell):**
35
+
36
+ ```powershell
37
+ Invoke-WebRequest "http://127.0.0.1:8080/res.php?key=capskip&action=get&id=0" -UseBasicParsing
38
+ ```
39
+
40
+ You should get a response (even an error like `ERROR_WRONG_CAPTCHA_ID` confirms the server is up).
41
+
42
+ **Linux / macOS:**
43
+
44
+ ```bash
45
+ curl "http://127.0.0.1:8080/res.php?key=capskip&action=get&id=0"
46
+ ```
47
+
48
+ ---
49
+
50
+ ## Step 2 — Install the Node.js SDK
51
+
52
+ ### From npm (recommended)
53
+
54
+ ```bash
55
+ npm install capskip
56
+ ```
57
+
58
+ ### From source (development)
59
+
60
+ ```bash
61
+ git clone https://github.com/capskip/capskip-node.git
62
+ cd capskip-node
63
+ npm install
64
+ ```
65
+
66
+ ### Verify installation
67
+
68
+ ```bash
69
+ node -e "console.log(require('capskip').version)"
70
+ ```
71
+
72
+ Expected output: `1.0.2` (or your installed version).
73
+
74
+ ### Verify CapSkip connectivity
75
+
76
+ ```bash
77
+ node examples/verify_connection.js
78
+ ```
79
+
80
+ If CapSkip is running, you should see `Status: OK — CapSkip is reachable`.
81
+
82
+ ---
83
+
84
+ ## Step 3 — Your first script
85
+
86
+ Create `solve_recaptcha.js`:
87
+
88
+ ```js
89
+ const { CapSkip, NetworkException, TimeoutException } = require('capskip');
90
+
91
+ const solver = new CapSkip({
92
+ apiKey: process.env.CAPSKIP_API_KEY || 'capskip',
93
+ host: process.env.CAPSKIP_HOST || '127.0.0.1',
94
+ port: parseInt(process.env.CAPSKIP_PORT || '8080', 10),
95
+ });
96
+
97
+ const SITEKEY = '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-'; // replace with your target page sitekey
98
+ const PAGE_URL = 'https://example.com/login'; // replace with your target page URL
99
+
100
+ (async () => {
101
+ try {
102
+ const result = await solver.recaptcha(SITEKEY, PAGE_URL);
103
+ console.log('Captcha ID:', result.captchaId);
104
+ console.log('Token: ', result.code.slice(0, 80), '...');
105
+ } catch (err) {
106
+ if (err instanceof NetworkException) {
107
+ console.log('Cannot reach CapSkip — is the app running?', err.message);
108
+ } else if (err instanceof TimeoutException) {
109
+ console.log('Timed out:', err.message);
110
+ } else {
111
+ throw err;
112
+ }
113
+ }
114
+ })();
115
+ ```
116
+
117
+ Run it:
118
+
119
+ ```bash
120
+ node solve_recaptcha.js
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Step 4 — Run the bundled examples
126
+
127
+ Clone the repository (if you haven't already) and run an example:
128
+
129
+ ```bash
130
+ cd capskip-node
131
+ node examples/recaptcha.js
132
+ ```
133
+
134
+ | Example | What it demonstrates |
135
+ |---|---|
136
+ | `image_captcha.js` | Image captcha from file, URL, or base64 |
137
+ | `recaptcha.js` | reCAPTCHA v2, v3, invisible, enterprise, proxy |
138
+ | `turnstile.js` | Cloudflare Turnstile widget and challenge page |
139
+ | `async_example.js` | Parallel solving |
140
+ | `verify_connection.js` | Check CapSkip is running |
141
+
142
+ ---
143
+
144
+ ## Environment variables
145
+
146
+ | Variable | Default | Description |
147
+ |---|---|---|
148
+ | `CAPSKIP_API_KEY` | `capskip` | API key sent with every request |
149
+ | `CAPSKIP_HOST` | `127.0.0.1` | CapSkip host |
150
+ | `CAPSKIP_PORT` | `8080` | CapSkip port |
151
+
152
+ Example `.env` file (load with [dotenv](https://www.npmjs.com/package/dotenv) if you use it):
153
+
154
+ ```env
155
+ CAPSKIP_API_KEY=capskip
156
+ CAPSKIP_HOST=127.0.0.1
157
+ CAPSKIP_PORT=8080
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Next steps
163
+
164
+ - [Tutorial](TUTORIAL.md) — complete walkthrough of every captcha type
165
+ - [API Reference](API_REFERENCE.md) — all methods and parameters
166
+ - [Troubleshooting](TROUBLESHOOTING.md) — fix common errors
167
+ - [CapSkip API docs](https://capskip.com/api-docs/) — raw HTTP API reference
@@ -0,0 +1,206 @@
1
+ # Troubleshooting
2
+
3
+ Common issues when using the CapSkip Node.js SDK and how to fix them.
4
+
5
+ ---
6
+
7
+ ## Connection refused / CapSkip not reachable
8
+
9
+ **Symptom**
10
+
11
+ ```
12
+ NetworkException: connect ECONNREFUSED 127.0.0.1:8080
13
+ ```
14
+
15
+ **Cause:** CapSkip desktop app is not running, or the port is wrong.
16
+
17
+ **Fix**
18
+
19
+ 1. Launch the CapSkip application.
20
+ 2. Confirm the API server is enabled in Settings.
21
+ 3. Match the port in your SDK config:
22
+
23
+ ```js
24
+ const solver = new CapSkip({ host: '127.0.0.1', port: 8080 }); // use your actual port
25
+ ```
26
+
27
+ 4. Test with curl:
28
+
29
+ ```bash
30
+ curl "http://127.0.0.1:8080/res.php?key=capskip&action=get&id=0"
31
+ ```
32
+
33
+ ---
34
+
35
+ ## TimeoutException — captcha not solved in time
36
+
37
+ **Symptom**
38
+
39
+ ```
40
+ TimeoutException: timeout 300 exceeded
41
+ ```
42
+
43
+ **Cause:** CapSkip needs more time, or the captcha failed silently.
44
+
45
+ **Fix**
46
+
47
+ 1. Increase the timeout:
48
+
49
+ ```js
50
+ const solver = new CapSkip({ recaptchaTimeout: 600, defaultTimeout: 180 });
51
+ ```
52
+
53
+ 2. Increase poll interval slightly (CapSkip docs recommend ~5 s for reCAPTCHA):
54
+
55
+ ```js
56
+ const solver = new CapSkip({ pollingInterval: 5 });
57
+ ```
58
+
59
+ 3. Check CapSkip app logs for solve errors on that captcha type.
60
+
61
+ ---
62
+
63
+ ## ApiException — ERROR_WRONG_USER_KEY
64
+
65
+ **Symptom**
66
+
67
+ ```
68
+ ApiException: ERROR_WRONG_USER_KEY
69
+ ```
70
+
71
+ **Cause:** API key validation is enabled in CapSkip but the key is wrong.
72
+
73
+ **Fix**
74
+
75
+ 1. Copy the exact API key from CapSkip Settings.
76
+ 2. Pass it to the SDK:
77
+
78
+ ```js
79
+ const solver = new CapSkip({ apiKey: 'your-actual-key' });
80
+ ```
81
+
82
+ Or disable API key validation in CapSkip Settings (development only).
83
+
84
+ ---
85
+
86
+ ## ApiException — ERROR_BAD_PARAMETERS
87
+
88
+ **Symptom**
89
+
90
+ ```
91
+ ApiException: ERROR_BAD_PARAMETERS
92
+ ```
93
+
94
+ **Cause:** Missing or invalid API parameters.
95
+
96
+ **Fix**
97
+
98
+ - **reCAPTCHA:** ensure `sitekey` and `url` are correct.
99
+ - **Turnstile challenge page:** include `data` and `pagedata` if required.
100
+ - **Image captcha:** ensure the file exists or the base64 string is valid.
101
+
102
+ ---
103
+
104
+ ## ValidationException — File not found
105
+
106
+ **Symptom**
107
+
108
+ ```
109
+ ValidationException: File not found: captcha.png
110
+ ```
111
+
112
+ **Fix**
113
+
114
+ - Use an absolute path or verify the working directory.
115
+ - For base64, pass a string with no file extension and length > 50, or use a data-URI:
116
+
117
+ ```js
118
+ await solver.normal('data:image/png;base64,iVBORw0KGgo...');
119
+ ```
120
+
121
+ ---
122
+
123
+ ## reCAPTCHA token rejected by target site
124
+
125
+ **Symptom:** SDK returns a token, but the website rejects it.
126
+
127
+ **Possible causes & fixes**
128
+
129
+ | Cause | Fix |
130
+ |---|---|
131
+ | Wrong `sitekey` or `pageurl` | Must match the exact page where the widget loads |
132
+ | IP mismatch | Use the same proxy for solving and submitting the form |
133
+ | Enterprise / invisible flag wrong | Set `enterprise: 1` or `invisible: 1` if the page uses them |
134
+ | v3 action mismatch | Pass the correct `action` from `grecaptcha.execute()` |
135
+ | Token expired | Use the token immediately after receiving it |
136
+
137
+ **Proxy example (same IP for solve and submit):**
138
+
139
+ ```js
140
+ const proxy = { type: 'HTTP', uri: '1.2.3.4:3128' };
141
+ const result = await solver.recaptcha('...', '...', { proxy });
142
+ // submit form using the same proxy
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Turnstile challenge page — token works but page still blocks
148
+
149
+ **Symptom:** Token received but Cloudflare still challenges.
150
+
151
+ **Fix:** For challenge pages, CapSkip returns a User-Agent that must be used when submitting the token. The SDK returns it as `result.userAgent` — set it as the `User-Agent` header when you submit the `cf-turnstile-response` token.
152
+
153
+ ---
154
+
155
+ ## NetworkException during manual polling
156
+
157
+ **Symptom:** `getResult()` keeps rejecting with `NetworkException`.
158
+
159
+ **This is expected** while the captcha is still processing. Catch it and retry:
160
+
161
+ ```js
162
+ const { NetworkException } = require('capskip');
163
+
164
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
165
+
166
+ let code;
167
+ while (true) {
168
+ try {
169
+ code = await solver.getResult(captchaId);
170
+ break;
171
+ } catch (err) {
172
+ if (!(err instanceof NetworkException)) throw err;
173
+ await sleep(5000);
174
+ }
175
+ }
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Import errors after install
181
+
182
+ ```bash
183
+ npm install capskip@latest
184
+ node -e "console.log(require('capskip').version)"
185
+ ```
186
+
187
+ Make sure you are on Node.js 18 or newer:
188
+
189
+ ```bash
190
+ node --version
191
+ ```
192
+
193
+ ---
194
+
195
+ ## Still stuck?
196
+
197
+ 1. [CapSkip API docs](https://capskip.com/api-docs/)
198
+ 2. [GitHub Issues](https://github.com/capskip/capskip-node/issues)
199
+ 3. CapSkip support: support@capskip.com
200
+
201
+ When opening an issue, include:
202
+
203
+ - Node.js version (`node --version`)
204
+ - SDK version (`node -e "console.log(require('capskip').version)"`)
205
+ - CapSkip port and captcha type
206
+ - Full error / stack trace (redact sitekeys/tokens)