@endoer/n8n-nodes-brightdata-modified 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/LICENSE.md +19 -0
- package/dist/credentials/BrightDataApi.credentials.d.ts +9 -0
- package/dist/credentials/BrightDataApi.credentials.js +38 -0
- package/dist/credentials/BrightDataApi.credentials.js.map +1 -0
- package/dist/nodes/BrightData/BrightData.node.d.ts +13 -0
- package/dist/nodes/BrightData/BrightData.node.js +179 -0
- package/dist/nodes/BrightData/BrightData.node.js.map +1 -0
- package/dist/nodes/BrightData/BrightData.node.json +18 -0
- package/dist/nodes/BrightData/GenericFunctions.d.ts +2 -0
- package/dist/nodes/BrightData/GenericFunctions.js +26 -0
- package/dist/nodes/BrightData/GenericFunctions.js.map +1 -0
- package/dist/nodes/BrightData/MarketplaceDatasetDescription.d.ts +3 -0
- package/dist/nodes/BrightData/MarketplaceDatasetDescription.js +1547 -0
- package/dist/nodes/BrightData/MarketplaceDatasetDescription.js.map +1 -0
- package/dist/nodes/BrightData/SearchFunctions.d.ts +5 -0
- package/dist/nodes/BrightData/SearchFunctions.js +73 -0
- package/dist/nodes/BrightData/SearchFunctions.js.map +1 -0
- package/dist/nodes/BrightData/WebScrapperDescription.d.ts +3 -0
- package/dist/nodes/BrightData/WebScrapperDescription.js +1442 -0
- package/dist/nodes/BrightData/WebScrapperDescription.js.map +1 -0
- package/dist/nodes/BrightData/WebUnlockerDescription.d.ts +3 -0
- package/dist/nodes/BrightData/WebUnlockerDescription.js +285 -0
- package/dist/nodes/BrightData/WebUnlockerDescription.js.map +1 -0
- package/dist/package.json +66 -0
- package/index.js +0 -0
- package/package.json +58 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright 2022 n8n
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
+
so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IAuthenticateGeneric, ICredentialType, INodeProperties, ICredentialTestRequest } from 'n8n-workflow';
|
|
2
|
+
export declare class BrightDataApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticateGeneric;
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrightDataApi = void 0;
|
|
4
|
+
class BrightDataApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'brightdataApi';
|
|
7
|
+
this.displayName = 'BrightData API';
|
|
8
|
+
this.documentationUrl = 'https://docs.brightdata.com/api-reference/introduction';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Token',
|
|
12
|
+
name: 'token',
|
|
13
|
+
type: 'string',
|
|
14
|
+
typeOptions: {
|
|
15
|
+
password: true,
|
|
16
|
+
},
|
|
17
|
+
default: '',
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
this.authenticate = {
|
|
21
|
+
type: 'generic',
|
|
22
|
+
properties: {
|
|
23
|
+
headers: {
|
|
24
|
+
Authorization: '={{"Bearer " + $credentials.token}}',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
this.test = {
|
|
29
|
+
request: {
|
|
30
|
+
baseURL: 'https://api.brightdata.com',
|
|
31
|
+
url: '/zone/get_active_zones',
|
|
32
|
+
method: 'GET',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.BrightDataApi = BrightDataApi;
|
|
38
|
+
//# sourceMappingURL=BrightDataApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrightDataApi.credentials.js","sourceRoot":"","sources":["../../credentials/BrightDataApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,aAAa;IAA1B;QACC,SAAI,GAAG,eAAe,CAAC;QACvB,gBAAW,GAAG,gBAAgB,CAAC;QAC/B,qBAAgB,GAAG,wDAAwD,CAAC;QAC5E,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;aACX;SACD,CAAC;QAMF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,qCAAqC;iBACpD;aACD;SACD,CAAC;QACF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,4BAA4B;gBACrC,GAAG,EAAE,wBAAwB;gBAC7B,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AAnCD,sCAmCC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
import { getActiveZones, getCountries, getDataSets } from './SearchFunctions';
|
|
3
|
+
export declare class BrightData implements INodeType {
|
|
4
|
+
description: INodeTypeDescription;
|
|
5
|
+
methods: {
|
|
6
|
+
listSearch: {
|
|
7
|
+
getActiveZones: typeof getActiveZones;
|
|
8
|
+
getCountries: typeof getCountries;
|
|
9
|
+
getDataSets: typeof getDataSets;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrightData = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const WebUnlockerDescription_1 = require("./WebUnlockerDescription");
|
|
6
|
+
const MarketplaceDatasetDescription_1 = require("./MarketplaceDatasetDescription");
|
|
7
|
+
const WebScrapperDescription_1 = require("./WebScrapperDescription");
|
|
8
|
+
const SearchFunctions_1 = require("./SearchFunctions");
|
|
9
|
+
const GenericFunctions_1 = require("./GenericFunctions");
|
|
10
|
+
class BrightData {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.description = {
|
|
13
|
+
displayName: 'BrightData',
|
|
14
|
+
name: 'brightData',
|
|
15
|
+
icon: 'file:brightdatasquared.svg',
|
|
16
|
+
group: ['transform'],
|
|
17
|
+
version: 1,
|
|
18
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
19
|
+
description: 'Interact with Bright Data to scrape websites or use existing datasets from the marketplace to generate adapted snapshots',
|
|
20
|
+
defaults: {
|
|
21
|
+
name: 'BrightData',
|
|
22
|
+
},
|
|
23
|
+
usableAsTool: true,
|
|
24
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
25
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
26
|
+
credentials: [
|
|
27
|
+
{
|
|
28
|
+
name: 'brightdataApi',
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
requestDefaults: {
|
|
33
|
+
ignoreHttpStatusErrors: true,
|
|
34
|
+
baseURL: 'https://api.brightdata.com',
|
|
35
|
+
headers: {
|
|
36
|
+
Accept: 'application/json',
|
|
37
|
+
'Content-Type': 'application/json',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
properties: [
|
|
41
|
+
{
|
|
42
|
+
displayName: 'Resource',
|
|
43
|
+
name: 'resource',
|
|
44
|
+
type: 'options',
|
|
45
|
+
noDataExpression: true,
|
|
46
|
+
options: [
|
|
47
|
+
{
|
|
48
|
+
name: 'Marketplace Dataset',
|
|
49
|
+
value: 'marketplaceDataset',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'Web Scraper',
|
|
53
|
+
value: 'webScrapper',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'Web Unlocker',
|
|
57
|
+
value: 'webUnlocker',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
default: 'webUnlocker',
|
|
61
|
+
},
|
|
62
|
+
...WebUnlockerDescription_1.webUnlockerOperations,
|
|
63
|
+
...WebUnlockerDescription_1.webUnlockerFields,
|
|
64
|
+
...MarketplaceDatasetDescription_1.marketplaceDatasetOperations,
|
|
65
|
+
...MarketplaceDatasetDescription_1.marketplaceDatasetFields,
|
|
66
|
+
...WebScrapperDescription_1.webScrapperOperations,
|
|
67
|
+
...WebScrapperDescription_1.webScrapperFields,
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
this.methods = {
|
|
71
|
+
listSearch: {
|
|
72
|
+
getActiveZones: SearchFunctions_1.getActiveZones,
|
|
73
|
+
getCountries: SearchFunctions_1.getCountries,
|
|
74
|
+
getDataSets: SearchFunctions_1.getDataSets,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
async execute() {
|
|
79
|
+
const items = this.getInputData();
|
|
80
|
+
const returnData = [];
|
|
81
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
82
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
83
|
+
if (resource === 'webUnlocker') {
|
|
84
|
+
const usePersistence = this.getNodeParameter('usePersistence', 0, false);
|
|
85
|
+
const workflowStaticData = this.getWorkflowStaticData('node');
|
|
86
|
+
let workingCountry = (usePersistence && workflowStaticData.lastWorkingCountry);
|
|
87
|
+
for (let i = 0; i < items.length; i++) {
|
|
88
|
+
try {
|
|
89
|
+
const rotateCountries = this.getNodeParameter('rotateCountries', i, false);
|
|
90
|
+
const primaryCountryData = this.getNodeParameter('country', i);
|
|
91
|
+
const primaryCountry = primaryCountryData.value;
|
|
92
|
+
const zoneData = this.getNodeParameter('zone', i);
|
|
93
|
+
const zone = zoneData.value;
|
|
94
|
+
let countriesToTry = [primaryCountry];
|
|
95
|
+
if (workingCountry) {
|
|
96
|
+
countriesToTry = [workingCountry, ...countriesToTry.filter((c) => c !== workingCountry)];
|
|
97
|
+
}
|
|
98
|
+
if (rotateCountries) {
|
|
99
|
+
const additionalCountriesStr = this.getNodeParameter('additionalCountries', i, '');
|
|
100
|
+
if (additionalCountriesStr) {
|
|
101
|
+
const extras = additionalCountriesStr
|
|
102
|
+
.split(/[ ,;]+/)
|
|
103
|
+
.map((c) => c.trim())
|
|
104
|
+
.filter((c) => c);
|
|
105
|
+
countriesToTry = [...new Set([...countriesToTry, ...extras])];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
let lastError;
|
|
109
|
+
let success = false;
|
|
110
|
+
for (const country of countriesToTry) {
|
|
111
|
+
try {
|
|
112
|
+
let body = {};
|
|
113
|
+
if (operation === 'request') {
|
|
114
|
+
const method = this.getNodeParameter('method', i);
|
|
115
|
+
const url = this.getNodeParameter('url', i);
|
|
116
|
+
const format = this.getNodeParameter('format', i);
|
|
117
|
+
const dataFormat = this.getNodeParameter('data_format', i, '');
|
|
118
|
+
body = {
|
|
119
|
+
zone,
|
|
120
|
+
country,
|
|
121
|
+
method,
|
|
122
|
+
url,
|
|
123
|
+
format: dataFormat === 'markdown' ? 'raw' : format,
|
|
124
|
+
};
|
|
125
|
+
if (dataFormat) {
|
|
126
|
+
body.data_format = dataFormat;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else if (operation === 'WebSearch') {
|
|
130
|
+
const query = this.getNodeParameter('query', i);
|
|
131
|
+
const page = this.getNodeParameter('page', i, 1);
|
|
132
|
+
const url = `https://www.google.com/search?q=${encodeURIComponent(query)}&start=${(page - 1) * 10}&brd_json=1`;
|
|
133
|
+
body = {
|
|
134
|
+
zone,
|
|
135
|
+
country,
|
|
136
|
+
url,
|
|
137
|
+
format: 'raw',
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
const responseData = await GenericFunctions_1.brightdataApiRequest.call(this, 'POST', '/request', body);
|
|
141
|
+
if (workingCountry !== country) {
|
|
142
|
+
workingCountry = country;
|
|
143
|
+
if (usePersistence) {
|
|
144
|
+
workflowStaticData.lastWorkingCountry = country;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const executionData = this.helpers.returnJsonArray(responseData);
|
|
148
|
+
for (const entry of executionData) {
|
|
149
|
+
entry.json.country_code = country;
|
|
150
|
+
returnData.push(entry);
|
|
151
|
+
}
|
|
152
|
+
success = true;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
lastError = error;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (!success) {
|
|
160
|
+
throw lastError;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
if (this.continueOnFail()) {
|
|
165
|
+
returnData.push({ json: { error: error.message } });
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
throw error;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return [returnData];
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
return await this.helpers.executeRouting.call(this);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
exports.BrightData = BrightData;
|
|
179
|
+
//# sourceMappingURL=BrightData.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrightData.node.js","sourceRoot":"","sources":["../../../nodes/BrightData/BrightData.node.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AAEtB,qEAAoF;AACpF,mFAGyC;AACzC,qEAAoF;AACpF,uDAA8E;AAC9E,yDAA0D;AAE1D,MAAa,UAAU;IAAvB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,YAAY;YACzB,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,4BAA4B;YAClC,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EACV,0HAA0H;YAC3H,QAAQ,EAAE;gBACT,IAAI,EAAE,YAAY;aAClB;YACD,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,eAAe;oBACrB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,eAAe,EAAE;gBAChB,sBAAsB,EAAE,IAAI;gBAC5B,OAAO,EAAE,4BAA4B;gBACrC,OAAO,EAAE;oBACR,MAAM,EAAE,kBAAkB;oBAC1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AAI,CAAC,CAAC;QACrD,CAAC;IACF,CAAC;CACD;AApLD,gCAoLC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-brightdata.BrightData",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Development", "Developer Tools", "HTML", "Scrapping"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://docs.brightdata.com/api-reference/rest-api/proxy-rest-api-playground"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://docs.brightdata.com/api-reference/rest-api/proxy-rest-api-playground"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { IExecuteFunctions, IHookFunctions, ILoadOptionsFunctions, IDataObject } from 'n8n-workflow';
|
|
2
|
+
export declare function brightdataApiRequest(this: IExecuteFunctions | IHookFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body?: any, query?: IDataObject, headers?: IDataObject, option?: IDataObject): Promise<any>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.brightdataApiRequest = brightdataApiRequest;
|
|
4
|
+
async function brightdataApiRequest(method, endpoint, body = {}, query = {}, headers = {}, option = {}) {
|
|
5
|
+
endpoint = endpoint.startsWith('/') ? endpoint : `/${endpoint}`;
|
|
6
|
+
const options = {
|
|
7
|
+
method,
|
|
8
|
+
body,
|
|
9
|
+
qs: query,
|
|
10
|
+
url: `https://api.brightdata.com${endpoint}`,
|
|
11
|
+
headers: {
|
|
12
|
+
Accept: 'application/json',
|
|
13
|
+
'Content-Type': 'application/json',
|
|
14
|
+
...headers,
|
|
15
|
+
},
|
|
16
|
+
json: true,
|
|
17
|
+
...option,
|
|
18
|
+
};
|
|
19
|
+
try {
|
|
20
|
+
return await this.helpers.httpRequestWithAuthentication.call(this, 'brightdataApi', options);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=GenericFunctions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/BrightData/GenericFunctions.ts"],"names":[],"mappings":";;AAOA,oDA8BC;AA9BM,KAAK,UAAU,oBAAoB,CAEzC,MAAc,EACd,QAAgB,EAChB,OAAY,EAAE,EACd,QAAqB,EAAE,EACvB,UAAuB,EAAE,EACzB,SAAsB,EAAE;IAExB,QAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,CAAC;IAEhE,MAAM,OAAO,GAAQ;QACpB,MAAM;QACN,IAAI;QACJ,EAAE,EAAE,KAAK;QACT,GAAG,EAAE,6BAA6B,QAAQ,EAAE;QAC5C,OAAO,EAAE;YACR,MAAM,EAAE,kBAAkB;YAC1B,cAAc,EAAE,kBAAkB;YAClC,GAAG,OAAO;SACV;QACD,IAAI,EAAE,IAAI;QACV,GAAG,MAAM;KACT,CAAC;IAEF,IAAI,CAAC;QACJ,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IAC9F,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,KAAK,CAAC;IACb,CAAC;AACF,CAAC"}
|