@brightdata/n8n-nodes-brightdata 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.
Files changed (32) hide show
  1. package/LICENSE.md +19 -0
  2. package/README.md +215 -0
  3. package/dist/__tests__/BrightData.node.test.d.ts +1 -0
  4. package/dist/__tests__/BrightData.node.test.js +21 -0
  5. package/dist/__tests__/BrightData.node.test.js.map +1 -0
  6. package/dist/credentials/BrightDataApi.credentials.d.ts +8 -0
  7. package/dist/credentials/BrightDataApi.credentials.js +31 -0
  8. package/dist/credentials/BrightDataApi.credentials.js.map +1 -0
  9. package/dist/nodes/BrightData/BrightData.node.d.ts +13 -0
  10. package/dist/nodes/BrightData/BrightData.node.js +703 -0
  11. package/dist/nodes/BrightData/BrightData.node.js.map +1 -0
  12. package/dist/nodes/BrightData/BrightData.node.json +18 -0
  13. package/dist/nodes/BrightData/GenericFunctions.d.ts +3 -0
  14. package/dist/nodes/BrightData/GenericFunctions.js +44 -0
  15. package/dist/nodes/BrightData/GenericFunctions.js.map +1 -0
  16. package/dist/nodes/BrightData/MarketplaceDatasetDescription.d.ts +3 -0
  17. package/dist/nodes/BrightData/MarketplaceDatasetDescription.js +1575 -0
  18. package/dist/nodes/BrightData/MarketplaceDatasetDescription.js.map +1 -0
  19. package/dist/nodes/BrightData/SearchFunctions.d.ts +4 -0
  20. package/dist/nodes/BrightData/SearchFunctions.js +36 -0
  21. package/dist/nodes/BrightData/SearchFunctions.js.map +1 -0
  22. package/dist/nodes/BrightData/WebScrapperDescription.d.ts +3 -0
  23. package/dist/nodes/BrightData/WebScrapperDescription.js +1452 -0
  24. package/dist/nodes/BrightData/WebScrapperDescription.js.map +1 -0
  25. package/dist/nodes/BrightData/WebUnlockerDescription.d.ts +3 -0
  26. package/dist/nodes/BrightData/WebUnlockerDescription.js +200 -0
  27. package/dist/nodes/BrightData/WebUnlockerDescription.js.map +1 -0
  28. package/dist/nodes/BrightData/brightdatasquared.svg +17 -0
  29. package/dist/package.json +64 -0
  30. package/dist/tsconfig.tsbuildinfo +1 -0
  31. package/index.js +0 -0
  32. package/package.json +64 -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.
package/README.md ADDED
@@ -0,0 +1,215 @@
1
+ ![Banner image](images/n8n-and-n8nhackers.png)
2
+
3
+ # n8n-nodes-brightdata
4
+
5
+ This is an n8n community node. It helps you to use [Bright Data APIs](https://docs.brightdata.com/scraping-automation/introduction) from n8n.
6
+
7
+ If you have any questions or remarks please [contact me](mailto:support@n8nhackers.com).
8
+
9
+ [n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.
10
+
11
+ ## Installation
12
+
13
+ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
14
+
15
+ ## Compatibility
16
+
17
+ This node was developed and tested with n8n version 1.81.4
18
+
19
+ ## Resources
20
+
21
+ This node currently supports the next Resources:
22
+
23
+ ### Marketplace Dataset
24
+
25
+ Bright Data’s Marketplace DataSet API allows access to a centralized platform providing regularly updated, ethically sourced datasets from multiple domains, offering flexible solutions for data customization and acquisition.
26
+
27
+ The next operations are available:
28
+
29
+ - Deliver Snapshot
30
+ - Filter Dataset
31
+ - Get Dataset Metadata
32
+ - Get Snapshot Content
33
+ - Get Snapshot Metadata
34
+ - Get Snapshot Parts
35
+ - List Datasets
36
+
37
+ Ideal for:
38
+
39
+ - Access to datasets across 120+ domains.
40
+ - High-quality, ethically sourced data ensuring accuracy and compliance.
41
+ - Regular updates from publicly available information.
42
+ - Ready-to-use and on-demand solutions.
43
+ - Flexible purchase options with comprehensive customization.
44
+ - Suitable for various fields like social media, real estate, B2B data, and AI training.
45
+
46
+ ### Web Unlocker
47
+
48
+ Bright Data’s Web Unlocker API makes data collection easy by managing proxies and avoiding blocks.
49
+
50
+ Just send an API request with the target website, and get clean HTML/JSON responses.
51
+
52
+ The Web Unlocker handles:
53
+
54
+ - Optimal proxy selection
55
+ - Custom headers
56
+ - Fingerprinting
57
+ - CAPTCHAs
58
+
59
+ Ideal for:
60
+
61
+ - Scraping any website without blocks
62
+ - Emulating real-user behavior
63
+ - Teams without proxy infrastructure
64
+ - Paying only for successful requests
65
+ - [Premium domains](https://docs.brightdata.com/scraping-automation/web-unlocker/features#current-list-of-premium-domains) hard to be scraped (MediaMarkt, Hermes... )
66
+
67
+ Please, follow [documentation](https://docs.brightdata.com/scraping-automation/web-unlocker/introduction) to setup this API.
68
+
69
+ #### Usage
70
+
71
+ - Resource: choose Unlocker API
72
+ - Operation: choose "Send a Request".
73
+ - Properties:
74
+ - zone: Choose between your existing zone names.
75
+ - url: The target URL you wish to access via Web Unlocker API.
76
+ - method: The method to call the target URL.
77
+ - format: Defines the response format. Use raw to receive the raw response from the target site. JSON is simpler for managing the output.
78
+ - country: The country you will use to access the target URL.
79
+
80
+ ### TL;DR - WebUnlocker
81
+
82
+ ![Get deals of the day](images/workflow-sample.png?raw=true "Get deals of the day")
83
+
84
+ Don't want to read? Install n8n-nodes-brightdata in your n8n from Settings / Community nodes. Copy the URL of [Get deals of the day](https://raw.githubusercontent.com/n8nhackers/n8n-nodes-brightdata/refs/heads/main/use-cases/workflow-sample.json "Get deals of the day") and paste into "Import for URL" submenu at n8n.
85
+
86
+ This n8n workflow automates the process of collecting and delivering the "Deals of the Day" from MediaMarkt, specifically tailored to user preferences, and sends those deals via email.
87
+
88
+ This workflow is useful for automating product deal recommendations based on user input and sending personalized emails with the best deals available.
89
+
90
+ #### Workflow Overview:
91
+
92
+ 1. **User Interaction via Form**:
93
+ - The user submits a form where they can select categories (such as appliances, cell phones, etc.) and provide their email address. This triggers the workflow to gather personalized deals based on their input.
94
+ 2. **Data Extraction**:
95
+ - Once the form is submitted, the workflow calls **Bright Data** community node to scrape data from the MediaMarkt website (`https://www.mediamarkt.es/es/campaign/campanas-y-ofertas`) using a proxy service. The data is retrieved in JSON format.
96
+ 3. **HTML Content Extraction**:
97
+ - The raw HTML content from the website is extracted, focusing on the title and body, which are key to processing the content for recommendation.
98
+ 4. **Recommendation Generation using OpenAI**:
99
+ - The extracted data is processed through **OpenAI** (GPT-4o-mini) to generate a list of recommended deals. This involves categorizing deals based on the user-selected categories, and filtering or translating content if necessary. The deal list includes properties like name, description, price, and a link.
100
+ 5. **Data Structuring**:
101
+ - The generated list of deals is split into individual deal items using **SplitOut**.
102
+ 6. **Document Creation**:
103
+ - Using **[Document Generator](https://www.npmjs.com/package/n8n-nodes-document-generator)** community node, an HTML template is populated with the recommended deals and structured into a user-friendly format.
104
+ 7. **Email Delivery**:
105
+ - The document containing the recommended deals is sent to the user's email via **SMTP email send** with a personalized message that includes the list of deals.
106
+
107
+ #### Workflow Connections:
108
+
109
+ 1. **Form Submission** → **Bright Data (Scrape Deals)**: The form triggers the request to scrape the MediaMarkt deals page.
110
+ 2. **Bright Data** → **HTML Extraction**: The scraped content is processed to extract key page data.
111
+ 3. **HTML Extraction** → **OpenAI (Deal Generation)**: The extracted content is used as input for GPT-4o-mini to generate deal recommendations.
112
+ 4. **OpenAI** → **SplitOut**: The results are split into individual deal items.
113
+ 5. **SplitOut** → **DocumentGenerator**: The items are formatted into an HTML document.
114
+ 6. **DocumentGenerator** → **Send Email**: The document is emailed to the user.
115
+
116
+ #### Final Output:
117
+
118
+ - The user receives an email with a personalized list of the best deals based on their selected categories.
119
+
120
+ #### Credentials Used:
121
+
122
+ - **Bright Data API**: For scraping data from MediaMarkt.
123
+ - **OpenAI API**: To generate the list of recommended deals using GPT-4o-mini.
124
+ - **SMTP**: For sending the email with the deals.
125
+
126
+ #### External nodes Used:
127
+
128
+ - **[Bright Data](https://www.npmjs.com/package/n8n-nodes-brightdata)**: For scrapping data from MediaMarkt.
129
+ - **[Document Generator](https://www.npmjs.com/package/n8n-nodes-document-generator)**: For generating html output using templates.
130
+
131
+ ### TL;DR - Marketplace Dataset
132
+
133
+ ![Marketplace Datasets](images/marketplace-dataset-workflow-sample.png?raw=true "Marketplace Datasets")
134
+
135
+ New Marketplace Dataset API allows to create custom snapshots by filtering existing Bright Data datasets (more than [160 datasets](https://docs.brightdata.com/datasets/introduction)).
136
+
137
+ Datasets are updated by Bright Data, so you don't have to scrape anything.
138
+
139
+ Your can get a list of records from the full dataset without scrapping the records by yourself. This is faster and cheaper than adquiring data from zero.
140
+ You can use datasets to build custom AI Agents like:
141
+
142
+ - Real Estate Agent to search houses to buy
143
+ - Candidates Agent to search future workers
144
+
145
+ Current existing datasets allow to get data from:
146
+
147
+ - LinkedIn
148
+ - Instagram
149
+ - Facebook
150
+ - Airbnb
151
+ - Crunchbase
152
+ - And many more (use operation 'List Datasets' to get all)
153
+
154
+ Install n8n-nodes-brightdata in your n8n from Settings / Community nodes. Copy the URL of [Get Marketplace Functions](https://raw.githubusercontent.com/n8nhackers/n8n-nodes-brightdata/refs/heads/main/use-cases/marketplace-dataset-workflow-sample.json) and paste into "Import for URL" submenu at n8n.
155
+
156
+ ### TL;DR - More samples
157
+
158
+ You can also use the next ready-to-use samples for your n8n (self-hosted version):
159
+
160
+ - [Update LinkedIn Profiles one by one with Bright Data and Google Sheets with no scrapping](https://raw.githubusercontent.com/n8nhackers/n8n-nodes-brightdata/refs/heads/main/use-cases/Update_LinkedIn_Profiles_one_by_one_with_Bright_Data_and_Google_Sheets_with_no_scrapping.json)![Update LinkedIn Profiles](images/Update_LinkedIn_Profiles_one_by_one_with_Bright_Data_and_Google_Sheets_with_no_scrapping.png?raw=true "Update LinkedIn Profiles")
161
+ - [Create a Prospect list for Commercial purposes with Google Search and Bright Data on-demand](https://raw.githubusercontent.com/n8nhackers/n8n-nodes-brightdata/refs/heads/main/use-cases/Create_a_Prospect_list_for_Commercial_purposes_with_Google_Search_and_Bright_Data_on_demand.json)![Create a Prospect List](images/Create_a_Prospect_list_for_Commercial_purposes_with_Google_Search_and_Bright_Data_on_demand.png?raw=true "Create a Prospect List")
162
+
163
+ # Changelog
164
+
165
+ Here you can find the list of changes applied to this node:
166
+
167
+ - 0.1.33: Add samples for WebScrapper/Scrape By URL and WebScrapper/Create Snapshot
168
+ - 0.1.32: Fix equals on MarketplaceDataset/filterSnapshot
169
+ - 0.1.31: Add webScrapper/downloadSnapshot
170
+ - 0.1.30: Add webScrapper/deliverSnapshot + Fix webScrapper/getSnapshots
171
+ - 0.1.29: Fix error on Marketplace/Get Snapshot Content
172
+ - 0.1.28: Fix errors on webScrapper resource
173
+ - 0.1.25: Create Resource for WebScrapper API
174
+ - 0.1.24: Return listDatasets in items output property
175
+ - 0.1.23: Add notify webhook to "Marketplace Dataset API/Trigger Snapshot by URL"
176
+ - 0.1.22: Return clear messages on API errors + improve filter Dataset
177
+ - 0.1.21: Add getSnapshots + Trigger snapshots to generate snapshots on demand
178
+ - 0.1.20: Added support to use Bright Data as an AI Agent tool
179
+ - 0.1.19: Added support for Marketplace DataSet endpoints
180
+ - 0.1.11: Added support for using this node as tool from an Agent
181
+
182
+ # Contribution
183
+
184
+ To make this node even better, please let us know, [how you use it](mailto:support@n8nhackers.com). Commits are always welcome.
185
+
186
+ You can test this node following the next instructions:
187
+
188
+ ```sh
189
+ git clone git@github.com:n8nhackers/n8n-nodes-brightdata.git
190
+ cd n8n-nodes-brightdata
191
+ nvm use
192
+ npm install -g n8n
193
+ yarn install
194
+ npm run build
195
+ npm link
196
+ mkdir ~/.n8n/custom/
197
+ cd ~/.n8n/custom/
198
+ npm link n8n-nodes-brightdata
199
+ cd ..
200
+ n8n start
201
+ ```
202
+
203
+ # Issues
204
+
205
+ If you have any issues, please [let us know on GitHub](https://github.com/n8nhackers/n8n-nodes-brightdata/issues).
206
+
207
+ # About
208
+
209
+ Nodes by [n8nhackers.com](https://n8nhackers.com). For productive use and consulting on this, [contact us please](mailto:support@n8nhackers.com).
210
+
211
+ Special thanks to [N8n nodemation](https://n8n.io) workflow automation by Jan Oberhauser.
212
+
213
+ # License
214
+
215
+ [MIT](https://github.com/n8n-io/n8n-nodes-starter/blob/master/LICENSE.md)
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const BrightData_node_1 = require("../nodes/BrightData/BrightData.node");
4
+ describe('BrightData', () => {
5
+ let node;
6
+ beforeEach(() => {
7
+ node = new BrightData_node_1.BrightData();
8
+ });
9
+ it('should be defined', () => {
10
+ expect(node).toBeDefined();
11
+ });
12
+ it('should have the correct properties', () => {
13
+ expect(node.description).toBeDefined();
14
+ expect(node.description.displayName).toBe('BrightData');
15
+ expect(node.description.name).toBe('brightData');
16
+ expect(node.description.icon).toBe('file:brightdatasquared.svg');
17
+ expect(node.description.group).toEqual(["transform"]);
18
+ expect(node.description.version).toBe(1);
19
+ });
20
+ });
21
+ //# sourceMappingURL=BrightData.node.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrightData.node.test.js","sourceRoot":"","sources":["../../__tests__/BrightData.node.test.ts"],"names":[],"mappings":";;AAAA,yEAAiE;AAEjE,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,IAAI,IAAgB,CAAC;IAErB,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,GAAG,IAAI,4BAAU,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC7B,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC7C,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;QACvC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACxD,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACjE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;QACtD,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { IAuthenticateGeneric, ICredentialType, INodeProperties } 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
+ }
@@ -0,0 +1,31 @@
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
+ }
29
+ }
30
+ exports.BrightDataApi = BrightDataApi;
31
+ //# sourceMappingURL=BrightDataApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrightDataApi.credentials.js","sourceRoot":"","sources":["../../credentials/BrightDataApi.credentials.ts"],"names":[],"mappings":";;;AAEA,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;IACH,CAAC;CAAA;AA5BD,sCA4BC"}
@@ -0,0 +1,13 @@
1
+ import { INodeType, INodeTypeDescription, INodeExecutionData, IExecuteFunctions } 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
+ }