recognize 0.2.4 → 1.0.0

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.
package/example/test.js CHANGED
@@ -1,28 +1,35 @@
1
- var Recognize = require('../recognize');
2
- var fs = require('fs');
1
+ import { readFile } from "node:fs/promises";
2
+ import Recognize, { SOURCE } from "../index.js";
3
3
 
4
- var recognize = new Recognize('rucaptcha', {
5
- key:'api-key'
4
+ const recognize = new Recognize(SOURCE.RUCAPTCHA, {
5
+ key: "api-key",
6
6
  });
7
7
 
8
- recognize.balanse(function(price)
9
- {
10
- console.log('My balance:', price);
11
- });
8
+ const price = await recognize.balanse();
9
+ console.log("My balance:", price);
12
10
 
13
- fs.readFile('./example/captcha.png', function(err, data){
14
- recognize.solving(data, function(err, id, code)
15
- {
16
- if(err) throw err;
17
- if(code)
18
- console.log('Captcha:', code);
19
- else
20
- {
21
- console.log('Captcha not valid');
22
- recognize.report(id, function(err, answer)
23
- {
24
- console.log(answer);
25
- });
26
- }
27
- });
28
- });
11
+ // const buff = await readFile("./example/captcha.png");
12
+
13
+ const { id, result } = await recognize
14
+ .solvingRecaptcha3(
15
+ "https://www.reestr-zalogov.ru/search/index",
16
+ "6LdKJhMaAAAAAIfeHC6FZc-UVfzDQpiOjaJUWoxr",
17
+ "search_notary",
18
+ "0.3"
19
+ )
20
+ .catch(console.error);
21
+
22
+ console.log(result);
23
+
24
+ // const r = await recognize.reportGood(id).catch((err) => err.message);
25
+ // console.log(r);
26
+ // recognize.solving(data, function (err, id, code) {
27
+ // if (err) throw err;
28
+ // if (code) console.log("Captcha:", code);
29
+ // else {
30
+ // console.log("Captcha not valid");
31
+ // recognize.report(id, function (err, answer) {
32
+ // console.log(answer);
33
+ // });
34
+ // }
35
+ // });
package/index.js ADDED
@@ -0,0 +1,300 @@
1
+ import { setTimeout } from "node:timers/promises";
2
+ import http from "node:http";
3
+
4
+ export const SOURCE = {
5
+ RUCAPTCHA: "RUCAPTCHA",
6
+ ANTIGATE: "ANTIGATE",
7
+ CAPTCHA24: "CAPTCHA24",
8
+ };
9
+
10
+ const _SOURCE = {
11
+ [SOURCE.RUCAPTCHA]: {
12
+ baseUrl: "rucaptcha.com",
13
+ soft_id: 768,
14
+ },
15
+ [SOURCE.ANTIGATE]: {
16
+ baseUrl: "anti-captcha.com",
17
+ soft_id: 720,
18
+ },
19
+ [SOURCE.CAPTCHA24]: {
20
+ baseUrl: "captcha24.com",
21
+ soft_id: 921,
22
+ },
23
+ };
24
+
25
+ export default class Recognize {
26
+ constructor(sourceCode, options) {
27
+ if (!options || !options.key) throw new Error("not key");
28
+ const source = _SOURCE[sourceCode];
29
+ if (!source) throw new Error("invalid type");
30
+
31
+ this._options = {
32
+ ...options,
33
+ baseUrl: source.baseUrl,
34
+ soft_id: source.soft_id,
35
+ };
36
+ }
37
+
38
+ balanse() {
39
+ return new Promise((resolve, reject) => {
40
+ http
41
+ .get(
42
+ {
43
+ hostname: this._options.baseUrl,
44
+ port: 80,
45
+ path: `/res.php?key=${this._options.key}&action=getbalance&json=1`,
46
+ },
47
+ function (res) {
48
+ var body = [];
49
+ res.on("data", function (chunk) {
50
+ body.push(chunk);
51
+ });
52
+ res.on("end", function () {
53
+ try {
54
+ const { status, request } = JSON.parse(body.join(""));
55
+ if (status === 1) {
56
+ return resolve(request);
57
+ }
58
+ return reject(new Error(request));
59
+ } catch (err) {
60
+ reject(err);
61
+ }
62
+ });
63
+ }
64
+ )
65
+ .on("error", reject);
66
+ });
67
+ }
68
+
69
+ solvingImage(buff, options = {}) {
70
+ return new Promise((resolve, reject) => {
71
+ const postData = JSON.stringify({
72
+ ...options,
73
+ soft_id: this._options.soft_id,
74
+ method: "base64",
75
+ key: this._options.key,
76
+ body: buff.toString("base64"),
77
+ json: "1",
78
+ });
79
+
80
+ const req = http.request(
81
+ {
82
+ hostname: this._options.baseUrl,
83
+ port: 80,
84
+ path: "/in.php",
85
+ method: "POST",
86
+ headers: {
87
+ "Content-Type": "application/json",
88
+ "Content-Length": Buffer.byteLength(postData),
89
+ },
90
+ },
91
+ (res) => {
92
+ const body = [];
93
+ res.setEncoding("utf8");
94
+ res.on("data", (chunk) => {
95
+ body.push(chunk);
96
+ });
97
+ res.on("end", () => {
98
+ const { status, request } = JSON.parse(body.join(""));
99
+ // console.log(request);
100
+ if (status === 1) {
101
+ waitResult(this._options.baseUrl, this._options.key, request)
102
+ .then((result) => resolve({ id: request, result }))
103
+ .catch((error) => reject(error));
104
+ } else {
105
+ reject(new Error(request));
106
+ }
107
+ });
108
+ }
109
+ );
110
+
111
+ req.on("error", reject);
112
+ req.write(postData);
113
+ req.end();
114
+ });
115
+ }
116
+
117
+ solvingRecaptcha2(url, googleKey, options = {}) {
118
+ return new Promise((resolve, reject) => {
119
+ const postData = JSON.stringify({
120
+ ...options,
121
+ soft_id: this._options.soft_id,
122
+ method: "userrecaptcha",
123
+ key: this._options.key,
124
+ pageurl: url,
125
+ googlekey: googleKey,
126
+ json: "1",
127
+ });
128
+
129
+ const req = http.request(
130
+ {
131
+ hostname: this._options.baseUrl,
132
+ port: 80,
133
+ path: "/in.php",
134
+ method: "POST",
135
+ headers: {
136
+ "Content-Type": "application/json",
137
+ "Content-Length": Buffer.byteLength(postData),
138
+ },
139
+ },
140
+ (res) => {
141
+ const body = [];
142
+ res.setEncoding("utf8");
143
+ res.on("data", (chunk) => {
144
+ body.push(chunk);
145
+ });
146
+ res.on("end", () => {
147
+ const { status, request } = JSON.parse(body.join(""));
148
+ // console.log(request);
149
+ if (status === 1) {
150
+ waitResult(this._options.baseUrl, this._options.key, request)
151
+ .then((result) => resolve({ id: request, result }))
152
+ .catch((error) => reject(error));
153
+ } else {
154
+ reject(new Error(request));
155
+ }
156
+ });
157
+ }
158
+ );
159
+
160
+ req.on("error", reject);
161
+ req.write(postData);
162
+ req.end();
163
+ });
164
+ }
165
+
166
+ solvingRecaptcha3(url, googleKey, action, score = "0.3", options = {}) {
167
+ return new Promise((resolve, reject) => {
168
+ const postData = JSON.stringify({
169
+ ...options,
170
+ soft_id: this._options.soft_id,
171
+ method: "userrecaptcha",
172
+ version: "v3",
173
+ action,
174
+ min_score: score,
175
+ key: this._options.key,
176
+ pageurl: url,
177
+ googlekey: googleKey,
178
+ json: "1",
179
+ });
180
+
181
+ const req = http.request(
182
+ {
183
+ hostname: this._options.baseUrl,
184
+ port: 80,
185
+ path: "/in.php",
186
+ method: "POST",
187
+ headers: {
188
+ "Content-Type": "application/json",
189
+ "Content-Length": Buffer.byteLength(postData),
190
+ },
191
+ },
192
+ (res) => {
193
+ const body = [];
194
+ res.setEncoding("utf8");
195
+ res.on("data", (chunk) => {
196
+ body.push(chunk);
197
+ });
198
+ res.on("end", () => {
199
+ const { status, request } = JSON.parse(body.join(""));
200
+ // console.log(request);
201
+ if (status === 1) {
202
+ waitResult(this._options.baseUrl, this._options.key, request)
203
+ .then((result) => resolve({ id: request, result }))
204
+ .catch((error) => reject(error));
205
+ } else {
206
+ reject(new Error(request));
207
+ }
208
+ });
209
+ }
210
+ );
211
+
212
+ req.on("error", reject);
213
+ req.write(postData);
214
+ req.end();
215
+ });
216
+ }
217
+
218
+ reportBad(id) {
219
+ return new Promise((resolve, reject) => {
220
+ http
221
+ .get(
222
+ {
223
+ hostname: this._options.baseUrl,
224
+ port: 80,
225
+ path: `/res.php?key=${this._options.key}&action=reportbad&id=${id}&json=1`,
226
+ },
227
+ function (res) {
228
+ const body = [];
229
+ res.setEncoding("utf8");
230
+ res.on("data", function (chunk) {
231
+ body.push(chunk);
232
+ });
233
+ res.on("end", function () {
234
+ const { status, request } = JSON.parse(body.join(""));
235
+ if (status === 0) return reject(new Error(request));
236
+ resolve(request);
237
+ });
238
+ }
239
+ )
240
+ .on("error", reject);
241
+ });
242
+ }
243
+
244
+ reportGood(id) {
245
+ return new Promise((resolve, reject) => {
246
+ http
247
+ .get(
248
+ {
249
+ hostname: this._options.baseUrl,
250
+ port: 80,
251
+ path: `/res.php?key=${this._options.key}&action=reportgood&id=${id}&json=1`,
252
+ },
253
+ function (res) {
254
+ const body = [];
255
+ res.setEncoding("utf8");
256
+ res.on("data", function (chunk) {
257
+ body.push(chunk);
258
+ });
259
+ res.on("end", function () {
260
+ const { status, request } = JSON.parse(body.join(""));
261
+ if (status === 0) return reject(new Error(request));
262
+ resolve(request);
263
+ });
264
+ }
265
+ )
266
+ .on("error", reject);
267
+ });
268
+ }
269
+ }
270
+
271
+ const httpGet = (request) => {
272
+ return new Promise((resolve, reject) => {
273
+ return http
274
+ .get(request, (res) => {
275
+ const body = [];
276
+ res.setEncoding("utf8");
277
+ res.on("data", function (chunk) {
278
+ body.push(chunk);
279
+ });
280
+ res.on("end", () => {
281
+ resolve(JSON.parse(body.join("")));
282
+ });
283
+ })
284
+ .on("error", reject);
285
+ });
286
+ };
287
+
288
+ const waitResult = async (baseUrl, key, id) => {
289
+ await setTimeout(1000);
290
+ const { status, request } = await httpGet({
291
+ hostname: baseUrl,
292
+ port: 80,
293
+ path: `/res.php?key=${key}&action=get&id=${id}&json=1`,
294
+ });
295
+
296
+ if (request === "CAPCHA_NOT_READY") return waitResult(baseUrl, key, id);
297
+ else if (status === 0) throw new Error(request);
298
+
299
+ return request;
300
+ };
package/package.json CHANGED
@@ -1,11 +1,9 @@
1
1
  {
2
2
  "name": "recognize",
3
- "version": "0.2.4",
3
+ "version": "1.0.0",
4
4
  "description": "Client for solving services using node.js",
5
- "main": "recognize.js",
6
- "directories": {
7
- "example": "example"
8
- },
5
+ "main": "index.js",
6
+ "type": "module",
9
7
  "scripts": {
10
8
  "test": "echo \"Error: no test specified\" && exit 1"
11
9
  },
@@ -16,8 +14,7 @@
16
14
  "keywords": [
17
15
  "captcha",
18
16
  "rucaptcha",
19
- "antigate",
20
- "captcha24"
17
+ "antigate"
21
18
  ],
22
19
  "author": "kdinisv",
23
20
  "license": "MIT",
package/.idea/.name DELETED
@@ -1 +0,0 @@
1
- Recognize
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$" />
5
- <orderEntry type="inheritedJdk" />
6
- <orderEntry type="sourceFolder" forTests="false" />
7
- <orderEntry type="library" name="Node.js v0.12.5 Core Modules" level="application" />
8
- </component>
9
- </module>
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="JavaScriptLibraryMappings">
4
- <file url="PROJECT" libraries="{Node.js v0.12.5 Core Modules}" />
5
- <includedPredefinedLibrary name="Node.js Globals" />
6
- <excludedPredefinedLibrary name="HTML" />
7
- <excludedPredefinedLibrary name="HTML5 / EcmaScript 5" />
8
- </component>
9
- </project>
package/.idea/misc.xml DELETED
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectLevelVcsManager" settingsEditedManually="false">
4
- <OptionsSetting value="true" id="Add" />
5
- <OptionsSetting value="true" id="Remove" />
6
- <OptionsSetting value="true" id="Checkout" />
7
- <OptionsSetting value="true" id="Update" />
8
- <OptionsSetting value="true" id="Status" />
9
- <OptionsSetting value="true" id="Edit" />
10
- <ConfirmationsSetting value="0" id="Add" />
11
- <ConfirmationsSetting value="0" id="Remove" />
12
- </component>
13
- <component name="ProjectRootManager" version="2" />
14
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/Recognize.iml" filepath="$PROJECT_DIR$/.idea/Recognize.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
@@ -1,668 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ChangeListManager">
4
- <list default="true" id="1ecfc3a7-6aa8-432c-8b90-ff284535fe70" name="Default" comment="" />
5
- <list id="92b126ca-89a7-444a-80a6-da3adc29066b" name="New changelist" comment="">
6
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/jsLibraryMappings.xml" />
7
- </list>
8
- <ignored path="Recognize.iws" />
9
- <ignored path=".idea/workspace.xml" />
10
- <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
11
- <option name="TRACKING_ENABLED" value="true" />
12
- <option name="SHOW_DIALOG" value="false" />
13
- <option name="HIGHLIGHT_CONFLICTS" value="true" />
14
- <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
15
- <option name="LAST_RESOLUTION" value="IGNORE" />
16
- </component>
17
- <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
18
- <component name="CreatePatchCommitExecutor">
19
- <option name="PATCH_PATH" value="" />
20
- </component>
21
- <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
22
- <component name="FavoritesManager">
23
- <favorites_list name="Recognize" />
24
- </component>
25
- <component name="FileEditorManager">
26
- <leaf>
27
- <file leaf-file-name="recognize.js" pinned="false" current-in-tab="false">
28
- <entry file="file://$PROJECT_DIR$/recognize.js">
29
- <provider selected="true" editor-type-id="text-editor">
30
- <state vertical-scroll-proportion="0.0">
31
- <caret line="57" column="34" selection-start-line="57" selection-start-column="34" selection-end-line="57" selection-end-column="34" />
32
- <folding />
33
- </state>
34
- </provider>
35
- </entry>
36
- </file>
37
- <file leaf-file-name="package.json" pinned="false" current-in-tab="true">
38
- <entry file="file://$PROJECT_DIR$/package.json">
39
- <provider selected="true" editor-type-id="text-editor">
40
- <state vertical-scroll-proportion="0.5706714">
41
- <caret line="19" column="12" selection-start-line="19" selection-start-column="12" selection-end-line="19" selection-end-column="12" />
42
- <folding />
43
- </state>
44
- </provider>
45
- </entry>
46
- </file>
47
- <file leaf-file-name="README.md" pinned="false" current-in-tab="false">
48
- <entry file="file://$PROJECT_DIR$/README.md">
49
- <provider selected="true" editor-type-id="text-editor">
50
- <state vertical-scroll-proportion="-0.0">
51
- <caret line="31" column="22" selection-start-line="31" selection-start-column="22" selection-end-line="31" selection-end-column="22" />
52
- <folding />
53
- </state>
54
- </provider>
55
- <provider editor-type-id="MarkdownPreviewEditor">
56
- <state />
57
- </provider>
58
- </entry>
59
- </file>
60
- <file leaf-file-name="test.js" pinned="false" current-in-tab="false">
61
- <entry file="file://$PROJECT_DIR$/example/test.js">
62
- <provider selected="true" editor-type-id="text-editor">
63
- <state vertical-scroll-proportion="0.0">
64
- <caret line="12" column="33" selection-start-line="12" selection-start-column="33" selection-end-line="12" selection-end-column="33" />
65
- <folding />
66
- </state>
67
- </provider>
68
- </entry>
69
- </file>
70
- </leaf>
71
- </component>
72
- <component name="FileTemplateManagerImpl">
73
- <option name="RECENT_TEMPLATES">
74
- <list>
75
- <option value="JavaScript File" />
76
- </list>
77
- </option>
78
- </component>
79
- <component name="Git.Settings">
80
- <option name="UPDATE_TYPE" value="REBASE" />
81
- <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
82
- </component>
83
- <component name="IdeDocumentHistory">
84
- <option name="CHANGED_PATHS">
85
- <list>
86
- <option value="$PROJECT_DIR$/clients/rucaptcha.js" />
87
- <option value="$PROJECT_DIR$/example/test.js" />
88
- <option value="$PROJECT_DIR$/README.md" />
89
- <option value="$PROJECT_DIR$/recognize.js" />
90
- <option value="$PROJECT_DIR$/package.json" />
91
- </list>
92
- </option>
93
- </component>
94
- <component name="JsBuildToolGruntFileManager" detection-done="true" />
95
- <component name="JsGulpfileManager">
96
- <detection-done>true</detection-done>
97
- </component>
98
- <component name="NamedScopeManager">
99
- <order />
100
- </component>
101
- <component name="ProjectFrameBounds">
102
- <option name="x" value="-8" />
103
- <option name="y" value="-8" />
104
- <option name="width" value="1936" />
105
- <option name="height" value="1056" />
106
- </component>
107
- <component name="ProjectLevelVcsManager" settingsEditedManually="false">
108
- <OptionsSetting value="true" id="Add" />
109
- <OptionsSetting value="true" id="Remove" />
110
- <OptionsSetting value="true" id="Checkout" />
111
- <OptionsSetting value="true" id="Update" />
112
- <OptionsSetting value="true" id="Status" />
113
- <OptionsSetting value="true" id="Edit" />
114
- <ConfirmationsSetting value="0" id="Add" />
115
- <ConfirmationsSetting value="0" id="Remove" />
116
- </component>
117
- <component name="ProjectView">
118
- <navigator currentView="ProjectPane" proportions="" version="1">
119
- <flattenPackages />
120
- <showMembers />
121
- <showModules />
122
- <showLibraryContents />
123
- <hideEmptyPackages />
124
- <abbreviatePackageNames />
125
- <autoscrollToSource />
126
- <autoscrollFromSource />
127
- <sortByType />
128
- </navigator>
129
- <panes>
130
- <pane id="Scratches" />
131
- <pane id="Scope" />
132
- <pane id="ProjectPane">
133
- <subPane>
134
- <PATH>
135
- <PATH_ELEMENT>
136
- <option name="myItemId" value="Recognize" />
137
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
138
- </PATH_ELEMENT>
139
- </PATH>
140
- <PATH>
141
- <PATH_ELEMENT>
142
- <option name="myItemId" value="Recognize" />
143
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
144
- </PATH_ELEMENT>
145
- <PATH_ELEMENT>
146
- <option name="myItemId" value="Recognize" />
147
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
148
- </PATH_ELEMENT>
149
- </PATH>
150
- </subPane>
151
- </pane>
152
- </panes>
153
- </component>
154
- <component name="PropertiesComponent">
155
- <property name="last_opened_file_path" value="$USER_HOME$/Documents/Node.js/nalog" />
156
- <property name="WebServerToolWindowFactoryState" value="false" />
157
- <property name="FullScreen" value="false" />
158
- <property name="settings.editor.selected.configurable" value="project.propVCSSupport.Mappings" />
159
- <property name="settings.editor.splitter.proportion" value="0.2" />
160
- <property name="recentsLimit" value="5" />
161
- <property name="restartRequiresConfirmation" value="true" />
162
- </component>
163
- <component name="RecentsManager">
164
- <key name="CopyFile.RECENT_KEYS">
165
- <recent name="E:\develop\Recognize" />
166
- </key>
167
- </component>
168
- <component name="RestoreUpdateTree" date="Moments ago" ActionInfo="_Update">
169
- <UpdatedFiles>
170
- <FILE-GROUP>
171
- <option name="myUpdateName" value="Updated from server" />
172
- <option name="myStatusName" value="Changed on server" />
173
- <option name="mySupportsDeletion" value="false" />
174
- <option name="myCanBeAbsent" value="false" />
175
- <option name="myId" value="CHANGED_ON_SERVER" />
176
- <FILE-GROUP>
177
- <option name="myUpdateName" value="Updated" />
178
- <option name="myStatusName" value="Changed" />
179
- <option name="mySupportsDeletion" value="false" />
180
- <option name="myCanBeAbsent" value="false" />
181
- <option name="myId" value="UPDATED" />
182
- <PATH vcs="Git" revision="">$PROJECT_DIR$/README.md</PATH>
183
- </FILE-GROUP>
184
- <FILE-GROUP>
185
- <option name="myUpdateName" value="Created" />
186
- <option name="myStatusName" value="Created" />
187
- <option name="mySupportsDeletion" value="false" />
188
- <option name="myCanBeAbsent" value="false" />
189
- <option name="myId" value="CREATED" />
190
- </FILE-GROUP>
191
- <FILE-GROUP>
192
- <option name="myUpdateName" value="Deleted" />
193
- <option name="myStatusName" value="Deleted" />
194
- <option name="mySupportsDeletion" value="false" />
195
- <option name="myCanBeAbsent" value="true" />
196
- <option name="myId" value="REMOVED_FROM_REPOSITORY" />
197
- </FILE-GROUP>
198
- <FILE-GROUP>
199
- <option name="myUpdateName" value="Restored" />
200
- <option name="myStatusName" value="Will be restored" />
201
- <option name="mySupportsDeletion" value="false" />
202
- <option name="myCanBeAbsent" value="false" />
203
- <option name="myId" value="RESTORED" />
204
- </FILE-GROUP>
205
- </FILE-GROUP>
206
- <FILE-GROUP>
207
- <option name="myUpdateName" value="Modified" />
208
- <option name="myStatusName" value="Modified" />
209
- <option name="mySupportsDeletion" value="false" />
210
- <option name="myCanBeAbsent" value="false" />
211
- <option name="myId" value="MODIFIED" />
212
- </FILE-GROUP>
213
- <FILE-GROUP>
214
- <option name="myUpdateName" value="Skipped" />
215
- <option name="myStatusName" value="Skipped" />
216
- <option name="mySupportsDeletion" value="false" />
217
- <option name="myCanBeAbsent" value="false" />
218
- <option name="myId" value="SKIPPED" />
219
- </FILE-GROUP>
220
- <FILE-GROUP>
221
- <option name="myUpdateName" value="Merged with conflicts" />
222
- <option name="myStatusName" value="Will be merged with conflicts" />
223
- <option name="mySupportsDeletion" value="false" />
224
- <option name="myCanBeAbsent" value="false" />
225
- <option name="myId" value="MERGED_WITH_CONFLICTS" />
226
- </FILE-GROUP>
227
- <FILE-GROUP>
228
- <option name="myUpdateName" value="Merged with tree conflicts" />
229
- <option name="myStatusName" value="Merged with tree conflicts" />
230
- <option name="mySupportsDeletion" value="false" />
231
- <option name="myCanBeAbsent" value="false" />
232
- <option name="myId" value="MERGED_WITH_TREE_CONFLICT" />
233
- </FILE-GROUP>
234
- <FILE-GROUP>
235
- <option name="myUpdateName" value="Merged with property conflicts" />
236
- <option name="myStatusName" value="Will be merged with property conflicts" />
237
- <option name="mySupportsDeletion" value="false" />
238
- <option name="myCanBeAbsent" value="false" />
239
- <option name="myId" value="MERGED_WITH_PROPERTY_CONFLICT" />
240
- </FILE-GROUP>
241
- <FILE-GROUP>
242
- <option name="myUpdateName" value="Merged" />
243
- <option name="myStatusName" value="Will be merged" />
244
- <option name="mySupportsDeletion" value="false" />
245
- <option name="myCanBeAbsent" value="false" />
246
- <option name="myId" value="MERGED" />
247
- </FILE-GROUP>
248
- <FILE-GROUP>
249
- <option name="myUpdateName" value="Not in repository" />
250
- <option name="myStatusName" value="Not in repository" />
251
- <option name="mySupportsDeletion" value="true" />
252
- <option name="myCanBeAbsent" value="false" />
253
- <option name="myId" value="UNKNOWN" />
254
- </FILE-GROUP>
255
- <FILE-GROUP>
256
- <option name="myUpdateName" value="Locally added" />
257
- <option name="myStatusName" value="Locally added" />
258
- <option name="mySupportsDeletion" value="false" />
259
- <option name="myCanBeAbsent" value="false" />
260
- <option name="myId" value="LOCALLY_ADDED" />
261
- </FILE-GROUP>
262
- <FILE-GROUP>
263
- <option name="myUpdateName" value="Locally removed" />
264
- <option name="myStatusName" value="Locally removed" />
265
- <option name="mySupportsDeletion" value="false" />
266
- <option name="myCanBeAbsent" value="false" />
267
- <option name="myId" value="LOCALLY_REMOVED" />
268
- </FILE-GROUP>
269
- <FILE-GROUP>
270
- <option name="myUpdateName" value="Switched" />
271
- <option name="myStatusName" value="Switched" />
272
- <option name="mySupportsDeletion" value="false" />
273
- <option name="myCanBeAbsent" value="false" />
274
- <option name="myId" value="SWITCHED" />
275
- </FILE-GROUP>
276
- </UpdatedFiles>
277
- </component>
278
- <component name="RunManager" selected="Node.js.Unnamed">
279
- <configuration default="true" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application">
280
- <method />
281
- </configuration>
282
- <configuration default="true" type="DartUnitRunConfigurationType" factoryName="DartUnit">
283
- <method />
284
- </configuration>
285
- <configuration default="true" type="JavaScriptTestRunnerKarma" factoryName="Karma" config-file="">
286
- <envs />
287
- <method />
288
- </configuration>
289
- <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
290
- <method />
291
- </configuration>
292
- <configuration default="true" type="JsTestDriver-test-runner" factoryName="JsTestDriver">
293
- <setting name="configLocationType" value="CONFIG_FILE" />
294
- <setting name="settingsFile" value="" />
295
- <setting name="serverType" value="INTERNAL" />
296
- <setting name="preferredDebugBrowser" value="Chrome" />
297
- <method />
298
- </configuration>
299
- <configuration default="true" type="NodeJSConfigurationType" factoryName="Node.js" working-dir="">
300
- <method />
301
- </configuration>
302
- <configuration default="true" type="cucumber.js" factoryName="Cucumber.js">
303
- <option name="cucumberJsArguments" value="" />
304
- <option name="executablePath" />
305
- <option name="filePath" />
306
- <method />
307
- </configuration>
308
- <configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
309
- <node-options />
310
- <gulpfile />
311
- <tasks />
312
- <arguments />
313
- <pass-parent-envs>true</pass-parent-envs>
314
- <envs />
315
- <method />
316
- </configuration>
317
- <configuration default="false" name="Unnamed" type="NodeJSConfigurationType" factoryName="Node.js" path-to-node="C:/Program Files/nodejs/node" path-to-js-file="example/test.js" working-dir="$PROJECT_DIR$">
318
- <method />
319
- </configuration>
320
- <list size="1">
321
- <item index="0" class="java.lang.String" itemvalue="Node.js.Unnamed" />
322
- </list>
323
- </component>
324
- <component name="ShelveChangesManager" show_recycled="false" />
325
- <component name="SvnConfiguration">
326
- <configuration>C:\Users\Zybr\AppData\Roaming\Subversion</configuration>
327
- </component>
328
- <component name="TaskManager">
329
- <task active="true" id="Default" summary="Default task">
330
- <changelist id="1ecfc3a7-6aa8-432c-8b90-ff284535fe70" name="Default" comment="" />
331
- <changelist id="92b126ca-89a7-444a-80a6-da3adc29066b" name="New changelist" comment="" />
332
- <created>1435610958491</created>
333
- <option name="number" value="Default" />
334
- <updated>1435610958491</updated>
335
- </task>
336
- <task id="LOCAL-00001" summary="Client for RuCaptcha.com using node.js">
337
- <created>1435611001818</created>
338
- <option name="number" value="00001" />
339
- <option name="project" value="LOCAL" />
340
- <updated>1435611001818</updated>
341
- </task>
342
- <task id="LOCAL-00002" summary="Client for RuCaptcha.com using node.js">
343
- <created>1435623391620</created>
344
- <option name="number" value="00002" />
345
- <option name="project" value="LOCAL" />
346
- <updated>1435623391620</updated>
347
- </task>
348
- <task id="LOCAL-00003" summary="add service antigate">
349
- <created>1435698063625</created>
350
- <option name="number" value="00003" />
351
- <option name="project" value="LOCAL" />
352
- <updated>1435698063625</updated>
353
- </task>
354
- <task id="LOCAL-00004" summary="add service antigate">
355
- <created>1435700198886</created>
356
- <option name="number" value="00004" />
357
- <option name="project" value="LOCAL" />
358
- <updated>1435700198886</updated>
359
- </task>
360
- <task id="LOCAL-00005" summary="add service captcha24">
361
- <created>1435709324987</created>
362
- <option name="number" value="00005" />
363
- <option name="project" value="LOCAL" />
364
- <updated>1435709324987</updated>
365
- </task>
366
- <task id="LOCAL-00006" summary="add service antigate">
367
- <created>1435709371124</created>
368
- <option name="number" value="00006" />
369
- <option name="project" value="LOCAL" />
370
- <updated>1435709371124</updated>
371
- </task>
372
- <task id="LOCAL-00007" summary="add service antigate">
373
- <created>1435709387220</created>
374
- <option name="number" value="00007" />
375
- <option name="project" value="LOCAL" />
376
- <updated>1435709387220</updated>
377
- </task>
378
- <task id="LOCAL-00008" summary="Исправлена ошибка">
379
- <created>1436626380079</created>
380
- <option name="number" value="00008" />
381
- <option name="project" value="LOCAL" />
382
- <updated>1436626380079</updated>
383
- </task>
384
- <option name="localTasksCounter" value="9" />
385
- <servers />
386
- </component>
387
- <component name="ToolWindowManager">
388
- <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
389
- <editor active="true" />
390
- <layout>
391
- <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.16649105" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
392
- <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
393
- <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
394
- <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
395
- <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
396
- <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32972974" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
397
- <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32972974" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
398
- <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
399
- <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32829374" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
400
- <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
401
- <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
402
- <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
403
- <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
404
- <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
405
- <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
406
- <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
407
- <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
408
- <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
409
- </layout>
410
- </component>
411
- <component name="Vcs.Log.UiProperties">
412
- <option name="RECENTLY_FILTERED_USER_GROUPS">
413
- <collection />
414
- </option>
415
- <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
416
- <collection />
417
- </option>
418
- </component>
419
- <component name="VcsContentAnnotationSettings">
420
- <option name="myLimit" value="2678400000" />
421
- </component>
422
- <component name="VcsManagerConfiguration">
423
- <MESSAGE value="Client for RuCaptcha.com using node.js" />
424
- <MESSAGE value="add service captcha24" />
425
- <MESSAGE value="add service antigate" />
426
- <MESSAGE value="Исправлена ошибка" />
427
- <option name="LAST_COMMIT_MESSAGE" value="Исправлена ошибка" />
428
- </component>
429
- <component name="XDebuggerManager">
430
- <breakpoint-manager />
431
- <watches-manager />
432
- </component>
433
- <component name="editorHistoryManager">
434
- <entry file="file://$PROJECT_DIR$/recognize.js">
435
- <provider selected="true" editor-type-id="text-editor">
436
- <state vertical-scroll-proportion="0.0">
437
- <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
438
- <folding />
439
- </state>
440
- </provider>
441
- </entry>
442
- <entry file="file://$PROJECT_DIR$/package.json">
443
- <provider selected="true" editor-type-id="text-editor">
444
- <state vertical-scroll-proportion="0.0">
445
- <caret line="20" column="4" selection-start-line="20" selection-start-column="4" selection-end-line="20" selection-end-column="4" />
446
- <folding />
447
- </state>
448
- </provider>
449
- </entry>
450
- <entry file="file://$PROJECT_DIR$/README.md">
451
- <provider selected="true" editor-type-id="text-editor">
452
- <state vertical-scroll-proportion="0.0">
453
- <caret line="31" column="22" selection-start-line="31" selection-start-column="22" selection-end-line="31" selection-end-column="22" />
454
- <folding />
455
- </state>
456
- </provider>
457
- <provider editor-type-id="MarkdownPreviewEditor">
458
- <state />
459
- </provider>
460
- </entry>
461
- <entry file="file://$PROJECT_DIR$/example/test.js">
462
- <provider selected="true" editor-type-id="text-editor">
463
- <state vertical-scroll-proportion="0.0">
464
- <caret line="12" column="33" selection-start-line="12" selection-start-column="33" selection-end-line="12" selection-end-column="33" />
465
- <folding />
466
- </state>
467
- </provider>
468
- </entry>
469
- <entry file="file://$PROJECT_DIR$/recognize.js">
470
- <provider selected="true" editor-type-id="text-editor">
471
- <state vertical-scroll-proportion="0.0">
472
- <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
473
- <folding />
474
- </state>
475
- </provider>
476
- </entry>
477
- <entry file="file://$PROJECT_DIR$/package.json">
478
- <provider selected="true" editor-type-id="text-editor">
479
- <state vertical-scroll-proportion="0.0">
480
- <caret line="20" column="4" selection-start-line="20" selection-start-column="4" selection-end-line="20" selection-end-column="4" />
481
- <folding />
482
- </state>
483
- </provider>
484
- </entry>
485
- <entry file="file://$PROJECT_DIR$/README.md">
486
- <provider selected="true" editor-type-id="text-editor">
487
- <state vertical-scroll-proportion="0.0">
488
- <caret line="31" column="22" selection-start-line="31" selection-start-column="22" selection-end-line="31" selection-end-column="22" />
489
- <folding />
490
- </state>
491
- </provider>
492
- <provider editor-type-id="MarkdownPreviewEditor">
493
- <state />
494
- </provider>
495
- </entry>
496
- <entry file="file://$PROJECT_DIR$/example/test.js">
497
- <provider selected="true" editor-type-id="text-editor">
498
- <state vertical-scroll-proportion="0.0">
499
- <caret line="12" column="33" selection-start-line="12" selection-start-column="33" selection-end-line="12" selection-end-column="33" />
500
- <folding />
501
- </state>
502
- </provider>
503
- </entry>
504
- <entry file="file://$PROJECT_DIR$/recognize.js">
505
- <provider selected="true" editor-type-id="text-editor">
506
- <state vertical-scroll-proportion="0.0">
507
- <caret line="19" column="23" selection-start-line="19" selection-start-column="14" selection-end-line="19" selection-end-column="23" />
508
- <folding />
509
- </state>
510
- </provider>
511
- </entry>
512
- <entry file="file://$PROJECT_DIR$/package.json">
513
- <provider selected="true" editor-type-id="text-editor">
514
- <state vertical-scroll-proportion="0.0">
515
- <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
516
- <folding />
517
- </state>
518
- </provider>
519
- </entry>
520
- <entry file="file://$PROJECT_DIR$/README.md">
521
- <provider selected="true" editor-type-id="text-editor">
522
- <state vertical-scroll-proportion="0.0">
523
- <caret line="31" column="22" selection-start-line="31" selection-start-column="22" selection-end-line="31" selection-end-column="22" />
524
- <folding />
525
- </state>
526
- </provider>
527
- <provider editor-type-id="MarkdownPreviewEditor">
528
- <state />
529
- </provider>
530
- </entry>
531
- <entry file="file://$PROJECT_DIR$/example/test.js">
532
- <provider selected="true" editor-type-id="text-editor">
533
- <state vertical-scroll-proportion="0.0">
534
- <caret line="12" column="33" selection-start-line="12" selection-start-column="33" selection-end-line="12" selection-end-column="33" />
535
- <folding />
536
- </state>
537
- </provider>
538
- </entry>
539
- <entry file="file://$PROJECT_DIR$/recognize.js">
540
- <provider selected="true" editor-type-id="text-editor">
541
- <state vertical-scroll-proportion="0.0">
542
- <caret line="19" column="23" selection-start-line="19" selection-start-column="14" selection-end-line="19" selection-end-column="23" />
543
- <folding />
544
- </state>
545
- </provider>
546
- </entry>
547
- <entry file="file://$PROJECT_DIR$/package.json">
548
- <provider selected="true" editor-type-id="text-editor">
549
- <state vertical-scroll-proportion="0.0">
550
- <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
551
- <folding />
552
- </state>
553
- </provider>
554
- </entry>
555
- <entry file="file://$PROJECT_DIR$/README.md">
556
- <provider selected="true" editor-type-id="text-editor">
557
- <state vertical-scroll-proportion="0.0">
558
- <caret line="31" column="22" selection-start-line="31" selection-start-column="22" selection-end-line="31" selection-end-column="22" />
559
- <folding />
560
- </state>
561
- </provider>
562
- <provider editor-type-id="MarkdownPreviewEditor">
563
- <state />
564
- </provider>
565
- </entry>
566
- <entry file="file://$PROJECT_DIR$/example/test.js">
567
- <provider selected="true" editor-type-id="text-editor">
568
- <state vertical-scroll-proportion="0.0">
569
- <caret line="12" column="33" selection-start-line="12" selection-start-column="33" selection-end-line="12" selection-end-column="33" />
570
- <folding />
571
- </state>
572
- </provider>
573
- </entry>
574
- <entry file="file://$PROJECT_DIR$/recognize.js">
575
- <provider selected="true" editor-type-id="text-editor">
576
- <state vertical-scroll-proportion="0.0">
577
- <caret line="19" column="23" selection-start-line="19" selection-start-column="14" selection-end-line="19" selection-end-column="23" />
578
- <folding />
579
- </state>
580
- </provider>
581
- </entry>
582
- <entry file="file://$PROJECT_DIR$/package.json">
583
- <provider selected="true" editor-type-id="text-editor">
584
- <state vertical-scroll-proportion="0.0">
585
- <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
586
- <folding />
587
- </state>
588
- </provider>
589
- </entry>
590
- <entry file="file://$PROJECT_DIR$/README.md">
591
- <provider selected="true" editor-type-id="text-editor">
592
- <state vertical-scroll-proportion="0.0">
593
- <caret line="31" column="22" selection-start-line="31" selection-start-column="22" selection-end-line="31" selection-end-column="22" />
594
- <folding />
595
- </state>
596
- </provider>
597
- <provider editor-type-id="MarkdownPreviewEditor">
598
- <state />
599
- </provider>
600
- </entry>
601
- <entry file="file://$PROJECT_DIR$/example/test.js">
602
- <provider selected="true" editor-type-id="text-editor">
603
- <state vertical-scroll-proportion="0.0">
604
- <caret line="12" column="33" selection-start-line="12" selection-start-column="33" selection-end-line="12" selection-end-column="33" />
605
- <folding />
606
- </state>
607
- </provider>
608
- </entry>
609
- <entry file="file://$PROJECT_DIR$/recognize.js">
610
- <provider selected="true" editor-type-id="text-editor">
611
- <state vertical-scroll-proportion="0.0">
612
- <caret line="17" column="51" selection-start-line="17" selection-start-column="51" selection-end-line="17" selection-end-column="51" />
613
- <folding />
614
- </state>
615
- </provider>
616
- </entry>
617
- <entry file="file://$PROJECT_DIR$/package.json">
618
- <provider selected="true" editor-type-id="text-editor">
619
- <state vertical-scroll-proportion="0.0">
620
- <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
621
- <folding />
622
- </state>
623
- </provider>
624
- </entry>
625
- <entry file="file://$PROJECT_DIR$/.idea/jsLibraryMappings.xml">
626
- <provider selected="true" editor-type-id="text-editor">
627
- <state vertical-scroll-proportion="0.0">
628
- <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
629
- </state>
630
- </provider>
631
- </entry>
632
- <entry file="file://$PROJECT_DIR$/README.md">
633
- <provider selected="true" editor-type-id="text-editor">
634
- <state vertical-scroll-proportion="0.0">
635
- <caret line="31" column="22" selection-start-line="31" selection-start-column="22" selection-end-line="31" selection-end-column="22" />
636
- <folding />
637
- </state>
638
- </provider>
639
- <provider editor-type-id="MarkdownPreviewEditor">
640
- <state />
641
- </provider>
642
- </entry>
643
- <entry file="file://$PROJECT_DIR$/example/test.js">
644
- <provider selected="true" editor-type-id="text-editor">
645
- <state vertical-scroll-proportion="0.0">
646
- <caret line="12" column="33" selection-start-line="12" selection-start-column="33" selection-end-line="12" selection-end-column="33" />
647
- <folding />
648
- </state>
649
- </provider>
650
- </entry>
651
- <entry file="file://$PROJECT_DIR$/recognize.js">
652
- <provider selected="true" editor-type-id="text-editor">
653
- <state vertical-scroll-proportion="0.0">
654
- <caret line="57" column="34" selection-start-line="57" selection-start-column="34" selection-end-line="57" selection-end-column="34" />
655
- <folding />
656
- </state>
657
- </provider>
658
- </entry>
659
- <entry file="file://$PROJECT_DIR$/package.json">
660
- <provider selected="true" editor-type-id="text-editor">
661
- <state vertical-scroll-proportion="0.5706714">
662
- <caret line="19" column="12" selection-start-line="19" selection-start-column="12" selection-end-line="19" selection-end-column="12" />
663
- <folding />
664
- </state>
665
- </provider>
666
- </entry>
667
- </component>
668
- </project>
package/recognize.js DELETED
@@ -1,135 +0,0 @@
1
- module.exports = Recognize;
2
-
3
- var http = require('http');
4
- var uri = require('url');
5
- var querystring = require('querystring');
6
-
7
- function Recognize(type, settings)
8
- {
9
- this.type = type;
10
- switch(type)
11
- {
12
- case 'rucaptcha':
13
- this.baseUrl = 'http://rucaptcha.com';
14
- this.id = 768;
15
- break;
16
- case 'antigate':
17
- this.baseUrl = 'http://anti-captcha.com';
18
- this.id = 720;
19
- break;
20
- case 'captcha24':
21
- this.baseUrl = 'http://captcha24.com';
22
- this.id = 921;
23
- break;
24
- default :
25
- throw new Error('invalid type');
26
-
27
- }
28
- this.settings = settings || {};
29
- this.key = this.settings.key || this.key;
30
- require('events').EventEmitter.call(this);
31
- }
32
-
33
- require('util').inherits(Recognize, require('events').EventEmitter);
34
-
35
- Recognize.prototype = {
36
- solving: function(file, settings, cb){
37
- if(typeof settings == 'function')
38
- {
39
- cb = settings;
40
- settings = {};
41
- }
42
- settings = settings || this.settings || {};
43
-
44
- var self = this;
45
- var options = uri.parse(this.baseUrl + '/in.php');
46
- options.method = 'POST';
47
- options.headers = {
48
- 'Content-Type': 'application/x-www-form-urlencoded'
49
- };
50
- var req = http.request(options, function(res){
51
- var body = [];
52
- res.on('data', function (chunk) {
53
- body.push(chunk);
54
- });
55
- res.on('end', function () {
56
- var answer = body.toString().split('|');
57
- //console.log(answer);
58
- switch (answer[0])
59
- {
60
- case 'OK':
61
- get(self.baseUrl, self.key, answer[1], function(err, code){
62
- cb(err, answer[1], code);
63
- });
64
- break;
65
- default :
66
- cb(answer[0]);
67
- }
68
- });
69
- });
70
-
71
- req.on('error', function(e) {
72
- cb(e.message, null, null);
73
- });
74
- settings.soft_id = this.id;
75
- settings.method = 'base64';
76
- settings.key = this.key;
77
- settings.body = file.toString('base64');
78
- req.write(querystring.stringify(settings));
79
- req.end();
80
- },
81
- balanse: function(cb){
82
- var self = this;
83
-
84
- http.get(this.baseUrl + '/res.php?key=' + self.key + '&action=getbalance', function(res){
85
- var body = [];
86
- res.on('data', function (chunk) {
87
- body.push(chunk);
88
- });
89
- res.on('end', function () {
90
- cb(body.toString());
91
- });
92
- }).on('error', function(err){
93
- console.error(err);
94
- });
95
- },
96
- report: function(id, cb)
97
- {
98
- var self = this;
99
- http.get(this.baseUrl + '/res.php?key=' + self.key + '&action=reportbad&id=' + id, function(res){
100
- var body = [];
101
- res.on('data', function (chunk) {
102
- body.push(chunk);
103
- });
104
- res.on('end', function () {
105
- cb(null, body.toString());
106
- });
107
- }).on('error', function(err){
108
- console.error(err);
109
- });
110
- }
111
- };
112
-
113
- function get(baseUrl, key, id, cb){
114
- http.get(baseUrl + '/res.php?key=' + key + '&action=get&id=' + id, function(res){
115
- var body = [];
116
- res.on('data', function (chunk) {
117
- body.push(chunk);
118
- });
119
- res.on('end', function () {
120
- var answer = body.toString().split('|');
121
- switch(answer[0]){
122
- case 'OK':
123
- cb(null, answer[1]);
124
- break;
125
- case 'CAPCHA_NOT_READY':
126
- setTimeout(get, 1000, baseUrl, key, id, cb);
127
- break;
128
- default :
129
- cb(answer[0], null);
130
- }
131
- });
132
- }).on('error', function(err){
133
- console.error(err);
134
- });
135
- };