Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
![img.png](images/keyNode.png)
4. Select Task Type:

![selectCaptcha.png](images/selectCaptcha.png)
![selectCaptcha1.png](images/selectCaptcha1.png)

- Use the Task Type dropdown to choose the kind of captcha you want to solve:
- JSON (Custom Task) – supply any valid CapMonster task JSON.
Expand Down
Binary file removed images/selectCaptcha.png
Binary file not shown.
Binary file added images/selectCaptcha1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 15 additions & 15 deletions nodes/CapmonsterCloud/captchas/geeTestV4.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { INodeProperties, IDataObject, IExecuteFunctions } from 'n8n-workflow';
import { getProxyFields } from '../proxy';
import { userAgent } from '../const';
import { userAgent as defaultUserAgent } from '../const';

export const geeTestV4Fields: INodeProperties[] = [
{
Expand All @@ -10,6 +10,7 @@ export const geeTestV4Fields: INodeProperties[] = [
required: true,
displayOptions: { show: { operation: ['geeTestV4'] } },
default: '',
description: 'Whether Address of the page on which the captcha is solved',
},
{
displayName: 'GT',
Expand All @@ -18,53 +19,52 @@ export const geeTestV4Fields: INodeProperties[] = [
required: true,
displayOptions: { show: { operation: ['geeTestV4'] } },
default: '',
description: 'GeeTest captcha_id parameter for the domain',
description: 'Whether The GeeTest identifier key for the domain - the captcha_id parameter',
},
{
displayName: 'Geetest API Subdomain',
name: 'geetestApiServerSubdomain',
type: 'string',
displayOptions: { show: { operation: ['geeTestV4'] } },
default: '',
description: 'Custom Geetest API subdomain (не api.geetest.com)',
description:
'Geetest API subdomain server (must be different from api.geetest.com). Optional parameter, required for some sites.',
},

{
displayName: 'Geetest Get Lib',
name: 'geetestGetLib',
type: 'string',
typeOptions: { editor: 'codeNodeEditor', rows: 3 },
displayOptions: { show: { operation: ['geeTestV4'] } },
default: '',
description: 'JSON string с параметрами загрузки скрипта',
description: 'Path to the captcha script to display it on the page. Send JSON as a string.',
},

{
displayName: 'Init Parameters',
name: 'initParameters',
type: 'json',
displayOptions: { show: { operation: ['geeTestV4'] } },
default: {},
description: 'Дополнительные параметры для версии 4 (используются с riskType)',
description:
'Whether Additional parameters for version 4, used together with “riskType” (captcha type/characteristics of its verification)',
},

{
displayName: 'User Agent',
name: 'userAgent',
type: 'string',
displayOptions: { show: { operation: ['geeTestV4'] } },
default: userAgent,
description: 'Browser User-Agent used for captcha recognition',
default: defaultUserAgent,
description: 'Whether Browser User-Agent used to recognize captcha',
},
];

export const buildGeeTestV4 = function (this: IExecuteFunctions, i: number): IDataObject {
const result: IDataObject = {
type: 'GeeTestTask',
version: 4,
websiteURL: this.getNodeParameter('websiteURL', i),
gt: this.getNodeParameter('gt', i),
version: 4,
...getProxyFields.call(this, i), // добавляет прокси, если указаны
...getProxyFields.call(this, i),
};

const subdomain = this.getNodeParameter('geetestApiServerSubdomain', i, '') as string;
Expand All @@ -76,8 +76,8 @@ export const buildGeeTestV4 = function (this: IExecuteFunctions, i: number): IDa
const initParams = this.getNodeParameter('initParameters', i, {}) as object;
if (initParams && Object.keys(initParams).length > 0) result.initParameters = initParams;

const userAgent = this.getNodeParameter('userAgent', i, '') as string;
if (userAgent) result.userAgent = userAgent;
const ua = this.getNodeParameter('userAgent', i, '') as string;
if (ua) result.userAgent = ua;

return result;
};
};
58 changes: 55 additions & 3 deletions nodes/CapmonsterCloud/captchas/imageToText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { INodeProperties, IExecuteFunctions, IDataObject } from 'n8n-workflow';

export const imageToText: INodeProperties[] = [
{
displayName: 'Body',
displayName: 'Body (Base64)',
name: 'body',
type: 'string',
typeOptions: {
Expand All @@ -11,14 +11,66 @@ export const imageToText: INodeProperties[] = [
required: true,
displayOptions: { show: { operation: ['imageToText'] } },
default: '',
description: 'Base64',
description: 'File body encoded in base64. Make sure to send it without line breaks.',
},
{
displayName: 'Captcha Module',
name: 'capMonsterModule',
type: 'string',
displayOptions: { show: { operation: ['imageToText'] } },
default: '',
description: 'Recognition module name (e.g., "yandex", "special")',
},
{
displayName: 'Recognizing Threshold',
name: 'recognizingThreshold',
type: 'number',
typeOptions: {
minValue: 0,
maxValue: 100,
},
displayOptions: { show: { operation: ['imageToText'] } },
default: 0,
description: 'Captcha recognition threshold (0–100)',
},
{
displayName: 'Case Sensitive',
name: 'case',
type: 'boolean',
displayOptions: { show: { operation: ['imageToText'] } },
default: false,
description: 'Whether Set to true if captcha is case sensitive',
},
{
displayName: 'Numeric Only',
name: 'numeric',
type: 'options',
options: [
{ name: 'No', value: 0 },
{ name: 'Yes', value: 1 },
],
displayOptions: { show: { operation: ['imageToText'] } },
default: 0,
description: 'Set to 1 if captcha contains numbers only',
},
{
displayName: 'Math Captcha',
name: 'math',
type: 'boolean',
displayOptions: { show: { operation: ['imageToText'] } },
default: false,
description: 'Whether Set to true if captcha requires a mathematical operation',
},
];


export const buildImageToText = function (this: IExecuteFunctions, i: number): IDataObject {
return {
type: 'ImageToTextTask',
body: this.getNodeParameter('body', i),
capMonsterModule: this.getNodeParameter('capMonsterModule', i, ''),
recognizingThreshold: this.getNodeParameter('recognizingThreshold', i, 0),
case: this.getNodeParameter('case', i, false),
numeric: this.getNodeParameter('numeric', i, 0),
math: this.getNodeParameter('math', i, false),
};
};
54 changes: 44 additions & 10 deletions nodes/CapmonsterCloud/captchas/recaptchaClick.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,48 @@
import { INodeProperties, IDataObject, IExecuteFunctions } from 'n8n-workflow';
import { userAgent } from '../const';
import { userAgent as defaultUserAgent } from '../const';

export const recaptchaClick: INodeProperties[] = [
{
displayName: 'Website URL',
name: 'websiteUrl',
type: 'string',
required: true,
displayOptions: { show: { operation: ['recaptchaClick'] } },
default: '',
description: 'URL of the page where the captcha is solved',
},
{
displayName: 'Image URLs',
name: 'imageUrls',
type: 'string',
typeOptions: { editor: 'codeNodeEditor', rows: 5 },
required: true,
displayOptions: { show: { operation: ['recaptchaClick'] } },
default: '["https://example.com/captcha.jpg"]',
description: 'Array of image URLs (required if imagesBase64 is empty)',
},
{
displayName: 'Images Base64',
name: 'imagesBase64',
type: 'string',
typeOptions: { editor: 'codeNodeEditor', rows: 5 },
displayOptions: { show: { operation: ['recaptchaClick'] } },
default: '[]',
description: 'Array of image base64 strings (required if imageUrls is empty)',
},
{
displayName: 'Metadata',
name: 'metadata',
type: 'string',
typeOptions: { editor: 'codeNodeEditor', rows: 5 },
typeOptions: { editor: 'codeNodeEditor', rows: 7 },
displayOptions: { show: { operation: ['recaptchaClick'] } },
default: '{}',
description: 'Metadata including Grid, TaskDefinition or Task',
},
{
displayName: 'User Agent',
name: 'userAgent',
type: 'string',
displayOptions: { show: { operation: ['recaptchaClick'] } },
default: userAgent,
default: defaultUserAgent,
description: 'User-Agent для запроса к сайту',
},
];
Expand All @@ -46,19 +56,43 @@ export const buildRecaptchaClick = function (this: IExecuteFunctions, i: number)
throw new Error('Metadata should be valid JSON');
}

if (!metadata.Grid) {
throw new Error('Metadata must include "Grid" (4x4, 3x3, 1x1)');
}
if (!metadata.Task && !metadata.TaskDefinition) {
throw new Error('Metadata must include either "Task" or "TaskDefinition"');
}

const imageUrlsRaw = this.getNodeParameter('imageUrls', i) as string;
let imageUrls: string[] = [];
try {
imageUrls = JSON.parse(imageUrlsRaw);
} catch {
throw new Error('Image URLs should be valid JSON array');
if (imageUrlsRaw) {
try {
imageUrls = JSON.parse(imageUrlsRaw);
} catch {
throw new Error('Image URLs should be a valid JSON array');
}
}

const imagesBase64Raw = this.getNodeParameter('imagesBase64', i, '[]') as string;
let imagesBase64: string[] = [];
if (imagesBase64Raw) {
try {
imagesBase64 = JSON.parse(imagesBase64Raw);
} catch {
throw new Error('Images Base64 should be a valid JSON array');
}
}

if (imageUrls.length === 0 && imagesBase64.length === 0) {
throw new Error('Either imageUrls or imagesBase64 must be provided');
}

return {
type: 'ComplexImageTask',
class: 'recaptcha',
websiteUrl: this.getNodeParameter('websiteUrl', i),
imageUrls,
imageUrls: imageUrls.length ? imageUrls : undefined,
imagesBase64: imagesBase64.length ? imagesBase64 : undefined,
metadata,
userAgent: this.getNodeParameter('userAgent', i, undefined),
};
Expand Down
34 changes: 0 additions & 34 deletions nodes/CapmonsterCloud/captchas/recaptchaV3Enterprise.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { INodeProperties, IDataObject, IExecuteFunctions } from 'n8n-workflow';
import { getProxyFields } from '../proxy';
import { userAgent } from '../const';

export const recaptchaV3Enterprise: INodeProperties[] = [
{
Expand Down Expand Up @@ -41,30 +40,6 @@ export const recaptchaV3Enterprise: INodeProperties[] = [
default: 'verify',
description: 'Action parameter passed by the ReCaptcha widget (e.g. login_test)',
},
{
displayName: 'User Agent',
name: 'userAgent',
type: 'string',
displayOptions: { show: { operation: ['recaptchaV3Enterprise'] } },
default: userAgent,
description: 'Browser User-Agent string used in emulation',
},
{
displayName: 'Cookies',
name: 'cookies',
type: 'string',
displayOptions: { show: { operation: ['recaptchaV3Enterprise'] } },
default: '',
description: 'Additional cookies: name1=value1; name2=value2',
},
{
displayName: 'API Domain',
name: 'apiDomain',
type: 'string',
displayOptions: { show: { operation: ['recaptchaV3Enterprise'] } },
default: '',
description: 'Domain to load reCAPTCHA from (e.g. www.google.com)',
},
];

export const buildRecaptchaV3Enterprise = function (
Expand All @@ -84,14 +59,5 @@ export const buildRecaptchaV3Enterprise = function (
const pageAction = this.getNodeParameter('pageAction', i, 'verify') as string;
if (pageAction) result.pageAction = pageAction;

const userAgent = this.getNodeParameter('userAgent', i, '') as string;
if (userAgent) result.userAgent = userAgent;

const cookies = this.getNodeParameter('cookies', i, '') as string;
if (cookies) result.cookies = cookies;

const apiDomain = this.getNodeParameter('apiDomain', i, '') as string;
if (apiDomain) result.apiDomain = apiDomain;

return result;
};
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zennolab_com/n8n-nodes-capmonstercloud",
"version": "0.0.4",
"version": "0.0.5",
"publishConfig": {
"access": "public"
},
Expand Down
Loading