n8n-nodes-pinterest 0.2.10 → 0.2.11

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/README.md CHANGED
@@ -4,20 +4,22 @@ Community n8n nodes for Pinterest using cookie-based authentication that mimics
4
4
 
5
5
  Supports:
6
6
 
7
- - Cookie-based authentication (session cookie)
8
- - List boards (current user)
9
- - Create a Pin by letting Pinterest scrape a public image URL
7
+ - Cookie-based authentication with `_pinterest_sess`
8
+ - List boards for the current user
9
+ - Create a Pin from a public image URL
10
+ - Optional HTTP proxy support
10
11
 
11
- ## 🚀 Full Documentation & Setup Guide
12
+ ## Full Documentation & Setup Guide
12
13
 
13
- **IMPORTANT:** For complete installation, setup, and usage instructions, please visit our comprehensive guide:
14
+ For complete installation, setup, and usage instructions, visit:
14
15
 
15
- 📖 **[Complete Guide: Automate Pinterest Posting with n8n](https://dps.media/huong-dan-toan-dien-tu-dong-dang-bai-len-pinterest-voi-n8n-update/)**
16
+ [Complete Guide: Automate Pinterest Posting with n8n](https://dps.media/huong-dan-toan-dien-tu-dong-dang-bai-len-pinterest-voi-n8n-update/)
17
+
18
+ The guide includes:
16
19
 
17
- This guide includes:
18
20
  - Step-by-step installation
19
21
  - Cookie authentication setup
20
- - 5+ workflow examples
22
+ - Workflow examples
21
23
  - Safety tips and troubleshooting
22
24
  - FAQ and best practices
23
25
 
@@ -31,29 +33,17 @@ Restart n8n. The node and credential will appear in the editor.
31
33
 
32
34
  ## Available Nodes
33
35
 
34
- - **Pinterest Cookie Get Boards**: Lists all your Pinterest boards
35
- - **Pinterest Cookie Create Pin**: Creates a new pin from image URL
36
-
37
- ## Features
38
-
39
- - Cookie-based authentication using `_pinterest_sess`
40
- - Automatic retry on common errors
41
- - Proxy support
42
- - Board management
43
- - Bulk pin creation
36
+ - **Pinterest Cookie -> Get Boards**: Lists all your Pinterest boards
37
+ - **Pinterest Cookie -> Create Pin**: Creates a new pin from an image URL
38
+ - **Pinterest Cookie -> Get Me**: Returns current account information
44
39
 
45
40
  ## Notes
46
41
 
47
- - Uses undocumented web endpoints; use at your own risk
48
- - May violate Pinterest's Terms of Service and can break without notice
42
+ - Uses undocumented Pinterest web endpoints; use at your own risk
43
+ - These endpoints can break without notice
44
+ - Use in accordance with Pinterest's Terms of Service
49
45
  - Consider proxies if Pinterest flags your IP
50
46
 
51
- ## ⚠️ Important
52
-
53
- For detailed setup instructions, cookie extraction, and advanced workflows, **please refer to the complete guide**:
54
-
55
- **[https://dps.media/huong-dan-toan-dien-tu-dong-dang-bai-len-pinterest-voi-n8n-update/](https://dps.media/huong-dan-toan-dien-tu-dong-dang-bai-len-pinterest-voi-n8n-update/)**
56
-
57
47
  ## Disclaimer
58
48
 
59
49
  This package uses cookie-based authentication and undocumented endpoints. Use at your own risk and in accordance with Pinterest's Terms of Service.
@@ -1,7 +1,8 @@
1
- import type { ICredentialType, INodeProperties } from 'n8n-workflow';
2
- export declare class PinterestCookieApi implements ICredentialType {
3
- name: string;
4
- displayName: string;
5
- documentationUrl: string;
6
- properties: INodeProperties[];
7
- }
1
+ import { ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class PinterestCookieApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ }
8
+ //# sourceMappingURL=PinterestCookieApi.credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PinterestCookieApi.credentials.d.ts","sourceRoot":"","sources":["../../src/credentials/PinterestCookieApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEhE,qBAAa,kBAAmB,YAAW,eAAe;IACxD,IAAI,SAAwB;IAC5B,WAAW,SAAsB;IACjC,gBAAgB,SAA0F;IAE1G,UAAU,EAAE,eAAe,EAAE,CAiB3B;CACH"}
@@ -1,29 +1,30 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PinterestCookieApi = void 0;
4
- class PinterestCookieApi {
5
- constructor() {
6
- this.name = 'pinterestCookieApi';
7
- this.displayName = 'Pinterest Cookie';
8
- this.documentationUrl = 'https://dps.media/huong-dan-toan-dien-tu-dong-dang-bai-len-pinterest-voi-n8n-update/';
9
- this.properties = [
10
- {
11
- displayName: 'Pinterest Session Cookie (_pinterest_sess)',
12
- name: 'pinterestSess',
13
- type: 'string',
14
- typeOptions: { password: true },
15
- default: '',
16
- required: true,
17
- description: 'Session cookie value.',
18
- },
19
- {
20
- displayName: 'Proxy',
21
- name: 'proxy',
22
- type: 'string',
23
- default: '',
24
- description: 'HTTP proxy format (host:port or user:pass@host:port).',
25
- },
26
- ];
27
- }
28
- }
29
- exports.PinterestCookieApi = PinterestCookieApi;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PinterestCookieApi = void 0;
4
+ class PinterestCookieApi {
5
+ constructor() {
6
+ this.name = 'pinterestCookieApi';
7
+ this.displayName = 'Pinterest Cookie';
8
+ this.documentationUrl = 'https://dps.media/huong-dan-toan-dien-tu-dong-dang-bai-len-pinterest-voi-n8n-update/';
9
+ this.properties = [
10
+ {
11
+ displayName: 'Pinterest Session Cookie (_pinterest_sess)',
12
+ name: 'pinterestSess',
13
+ type: 'string',
14
+ typeOptions: { password: true },
15
+ default: '',
16
+ required: true,
17
+ description: 'Session cookie value.',
18
+ },
19
+ {
20
+ displayName: 'Proxy',
21
+ name: 'proxy',
22
+ type: 'string',
23
+ default: '',
24
+ description: 'HTTP proxy format (host:port or user:pass@host:port).',
25
+ },
26
+ ];
27
+ }
28
+ }
29
+ exports.PinterestCookieApi = PinterestCookieApi;
30
+ //# sourceMappingURL=PinterestCookieApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PinterestCookieApi.credentials.js","sourceRoot":"","sources":["../../src/credentials/PinterestCookieApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,kBAAkB;IAA/B;QACE,SAAI,GAAG,oBAAoB,CAAC;QAC5B,gBAAW,GAAG,kBAAkB,CAAC;QACjC,qBAAgB,GAAG,sFAAsF,CAAC;QAE1G,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,4CAA4C;gBACzD,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,uBAAuB;aACrC;YACD;gBACE,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,uDAAuD;aACrE;SACF,CAAC;IACJ,CAAC;CAAA;AAvBD,gDAuBC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import type { INodeType } from 'n8n-workflow';
2
- import { PinterestCookieApi } from './credentials/PinterestCookieApi.credentials';
3
- export declare const nodes: INodeType[];
4
- export declare const credentials: (typeof PinterestCookieApi)[];
1
+ import { PinterestCookieApi } from './credentials/PinterestCookieApi.credentials';
2
+ import { PinterestCookie } from './nodes/PinterestCookie/PinterestCookie.node';
3
+ export declare const nodes: PinterestCookie[];
4
+ export declare const credentials: (typeof PinterestCookieApi)[];
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAE/E,eAAO,MAAM,KAAK,mBAA0B,CAAC;AAC7C,eAAO,MAAM,WAAW,+BAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.credentials = exports.nodes = void 0;
4
- const PinterestCookie_node_1 = require("./nodes/PinterestCookie/PinterestCookie.node");
5
- const PinterestCookieApi_credentials_1 = require("./credentials/PinterestCookieApi.credentials");
6
- exports.nodes = [new PinterestCookie_node_1.PinterestCookie()];
7
- exports.credentials = [PinterestCookieApi_credentials_1.PinterestCookieApi];
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.credentials = exports.nodes = void 0;
4
+ const PinterestCookieApi_credentials_1 = require("./credentials/PinterestCookieApi.credentials");
5
+ const PinterestCookie_node_1 = require("./nodes/PinterestCookie/PinterestCookie.node");
6
+ exports.nodes = [new PinterestCookie_node_1.PinterestCookie()];
7
+ exports.credentials = [PinterestCookieApi_credentials_1.PinterestCookieApi];
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iGAAkF;AAClF,uFAA+E;AAElE,QAAA,KAAK,GAAG,CAAC,IAAI,sCAAe,EAAE,CAAC,CAAC;AAChC,QAAA,WAAW,GAAG,CAAC,mDAAkB,CAAC,CAAC"}
@@ -1,10 +1,14 @@
1
- import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
- export declare class PinterestCookie implements INodeType {
3
- description: INodeTypeDescription;
4
- methods: {
5
- loadOptions: {
6
- getBoardsCookie(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
7
- };
8
- };
9
- execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
10
- }
1
+ import { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class PinterestCookie implements INodeType {
3
+ description: INodeTypeDescription;
4
+ methods: {
5
+ loadOptions: {
6
+ getBoardsCookie(this: ILoadOptionsFunctions): Promise<{
7
+ name: string;
8
+ value: string;
9
+ }[]>;
10
+ };
11
+ };
12
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
13
+ }
14
+ //# sourceMappingURL=PinterestCookie.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PinterestCookie.node.d.ts","sourceRoot":"","sources":["../../../src/nodes/PinterestCookie/PinterestCookie.node.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACrB,MAAM,cAAc,CAAC;AA+ItB,qBAAa,eAAgB,YAAW,SAAS;IAC/C,WAAW,EAAE,oBAAoB,CAgG/B;IAEF,OAAO;;kCAEyB,qBAAqB;;;;;MAgBnD;IAEI,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;CA0HxE"}
@@ -1,408 +1,341 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PinterestCookie = void 0;
4
- function randomCsrf() {
5
- // similar to plugin: base64 of microtime + random
6
- const seed = `${Date.now()}${Math.floor(Math.random() * 100000)}`;
7
- return Buffer.from(seed).toString('base64');
8
- }
9
- function buildCommonHeaders(csrf) {
10
- return {
11
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0',
12
- 'x-pinterest-pws-handler': 'www/[username].js',
13
- 'x-CSRFToken': csrf,
14
- 'Accept-Language': 'en-US,en;q=0.9',
15
- 'Accept': 'application/json, text/plain, */*',
16
- 'X-Requested-With': 'XMLHttpRequest',
17
- };
18
- }
19
- function buildCookieHeader(sess, csrf) {
20
- return `_pinterest_sess=${sess}; csrftoken=${csrf};`;
21
- }
22
- const PINTEREST_BASE = 'https://www.pinterest.com';
23
- function sanitizePinterestText(value, limit) {
24
- if (!value)
25
- return '';
26
- let sanitized = value.replace(/&amp;/g, '&').replace(/&#038;/g, '&');
27
- sanitized = sanitized.replace(/\r\n|\r|\n/g, '\n');
28
- sanitized = sanitized.replace(/\t/g, ' ').trim();
29
- if (sanitized.length > limit) {
30
- sanitized = sanitized.slice(0, limit - 3) + '...';
31
- }
32
- sanitized = sanitized.replace(/"/g, '\"');
33
- return sanitized;
34
- }
35
- function doubleEncodeUrl(value) {
36
- return encodeURIComponent(encodeURIComponent(value));
37
- }
38
- async function resolveBaseUrl(ctx, headers, proxy) {
39
- try {
40
- const resp = (await ctx.helpers.request({
41
- method: 'GET',
42
- uri: PINTEREST_BASE,
43
- headers,
44
- proxy: proxy || undefined,
45
- simple: false,
46
- resolveWithFullResponse: true,
47
- followRedirect: false,
48
- }));
49
- const loc = resp.headers['location'];
50
- if (loc) {
51
- try {
52
- const u = new URL(loc);
53
- return `${u.protocol}//${u.host}`;
54
- }
55
- catch { }
56
- }
57
- }
58
- catch { }
59
- return PINTEREST_BASE;
60
- }
61
- class PinterestCookie {
62
- constructor() {
63
- this.description = {
64
- displayName: 'Pinterest (Cookie)',
65
- name: 'pinterestCookie',
66
- icon: 'file:pinterest.svg',
67
- group: ['output'],
68
- version: 1,
69
- subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
70
- description: 'Pinterest via cookie method (web endpoints).',
71
- documentationUrl: 'https://dps.media/huong-dan-toan-dien-tu-dong-dang-bai-len-pinterest-voi-n8n-update/',
72
- defaults: { name: 'Pinterest (Cookie)' },
73
- inputs: ['main'],
74
- outputs: ['main'],
75
- credentials: [
76
- { name: 'pinterestCookieApi', required: true },
77
- ],
78
- properties: [
79
- {
80
- displayName: 'Resource',
81
- name: 'resource',
82
- type: 'options',
83
- noDataExpression: true,
84
- options: [
85
- { name: 'Pin', value: 'pin' },
86
- { name: 'Board', value: 'board' },
87
- { name: 'Me', value: 'me' },
88
- ],
89
- default: 'pin',
90
- },
91
- // Pin operations
92
- {
93
- displayName: 'Operation',
94
- name: 'operation',
95
- type: 'options',
96
- displayOptions: { show: { resource: ['pin'] } },
97
- options: [
98
- { name: 'Create', value: 'create', action: 'Create a pin' },
99
- ],
100
- default: 'create',
101
- },
102
- {
103
- displayName: 'Board',
104
- name: 'boardId',
105
- type: 'options',
106
- typeOptions: { loadOptionsMethod: 'getBoardsCookie' },
107
- displayOptions: { show: { resource: ['pin'], operation: ['create'] } },
108
- default: '',
109
- required: true,
110
- description: 'Select target board.',
111
- },
112
- {
113
- displayName: 'Image URL',
114
- name: 'imageUrl',
115
- type: 'string',
116
- default: '',
117
- required: true,
118
- displayOptions: { show: { resource: ['pin'], operation: ['create'] } },
119
- description: 'Image URL for Pinterest to scrape.',
120
- },
121
- {
122
- displayName: 'Title',
123
- name: 'title',
124
- type: 'string',
125
- default: '',
126
- typeOptions: { maxLength: 100 },
127
- displayOptions: { show: { resource: ['pin'], operation: ['create'] } },
128
- description: 'Pin title (max 100 chars).',
129
- },
130
- {
131
- displayName: 'Description',
132
- name: 'description',
133
- type: 'string',
134
- default: '',
135
- typeOptions: { maxLength: 800 },
136
- displayOptions: { show: { resource: ['pin'], operation: ['create'] } },
137
- description: 'Pin description (max 800 chars).',
138
- },
139
- {
140
- displayName: 'Link',
141
- name: 'link',
142
- type: 'string',
143
- default: '',
144
- displayOptions: { show: { resource: ['pin'], operation: ['create'] } },
145
- description: 'Destination URL.',
146
- },
147
- // Board ops
148
- {
149
- displayName: 'Operation',
150
- name: 'boardOperation',
151
- type: 'options',
152
- displayOptions: { show: { resource: ['board'] } },
153
- options: [
154
- { name: 'Get Many', value: 'getAll', action: 'List boards' },
155
- ],
156
- default: 'getAll',
157
- },
158
- // Me ops
159
- {
160
- displayName: 'Operation',
161
- name: 'meOperation',
162
- type: 'options',
163
- displayOptions: { show: { resource: ['me'] } },
164
- options: [
165
- { name: 'Get', value: 'get', action: 'Get my info' },
166
- ],
167
- default: 'get',
168
- },
169
- ],
170
- };
171
- this.methods = {
172
- loadOptions: {
173
- async getBoardsCookie() {
174
- var _a, _b;
175
- const creds = (await this.getCredentials('pinterestCookieApi'));
176
- const pinterestSess = String(creds.pinterestSess || creds.pinterestsess || '');
177
- const proxy = creds.proxy || '';
178
- const csrf = randomCsrf();
179
- const headers = {
180
- ...buildCommonHeaders(csrf),
181
- Cookie: buildCookieHeader(pinterestSess, csrf),
182
- };
183
- const base = await resolveBaseUrl(this, headers, proxy);
184
- // Fetch username first (like plugin getMyInfo)
185
- const meResp = (await this.helpers.request({
186
- method: 'GET',
187
- uri: `${base}/resource/HomefeedBadgingResource/get/`,
188
- headers,
189
- proxy: proxy || undefined,
190
- }));
191
- const meJson = JSON.parse(meResp);
192
- const username = String(((_b = (_a = meJson.client_context) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.username) || '');
193
- const boards = [];
194
- let bookmark = '';
195
- while (true) {
196
- const data = {
197
- options: {
198
- isPrefetch: false,
199
- privacy_filter: 'all',
200
- sort: 'custom',
201
- field_set_key: 'profile_grid_item',
202
- username,
203
- page_size: 25,
204
- group_by: 'visibility',
205
- include_archived: true,
206
- redux_normalize_feed: true,
207
- ...(bookmark ? { bookmarks: [bookmark] } : {}),
208
- },
209
- context: {},
210
- };
211
- const qs = { data: JSON.stringify(data) };
212
- const resp = (await this.helpers.request({
213
- method: 'GET',
214
- uri: `${base}/resource/BoardsResource/get/`,
215
- qs,
216
- headers,
217
- proxy: proxy || undefined,
218
- json: true,
219
- }));
220
- const resource = resp.resource_response || {};
221
- const pageBoards = resource.data || [];
222
- for (const b of pageBoards) {
223
- boards.push({ id: String(b.id), name: String(b.name || b.id) });
224
- }
225
- const next = String(resource.bookmark || '');
226
- if (!next || next === '-end-')
227
- break;
228
- bookmark = next;
229
- }
230
- return boards.map((b) => ({ name: b.name, value: b.id }));
231
- },
232
- },
233
- };
234
- }
235
- async execute() {
236
- var _a, _b;
237
- const items = this.getInputData();
238
- const returnData = [];
239
- const creds = (await this.getCredentials('pinterestCookieApi'));
240
- const pinterestSess = String(creds.pinterestSess || creds.pinterestsess || '');
241
- const proxy = creds.proxy || '';
242
- for (let i = 0; i < items.length; i++) {
243
- try {
244
- const resource = this.getNodeParameter('resource', i);
245
- const csrf = randomCsrf();
246
- const baseHeaders = buildCommonHeaders(csrf);
247
- const cookieHeader = buildCookieHeader(pinterestSess, csrf);
248
- const base = await resolveBaseUrl(this, { ...baseHeaders, Cookie: cookieHeader }, proxy);
249
- if (resource === 'me') {
250
- const resp = (await this.helpers.request({
251
- method: 'GET',
252
- uri: `${base}/resource/HomefeedBadgingResource/get/`,
253
- headers: { ...baseHeaders, Cookie: cookieHeader },
254
- proxy: proxy || undefined,
255
- }));
256
- const json = JSON.parse(resp);
257
- returnData.push({ json });
258
- continue;
259
- }
260
- if (resource === 'board') {
261
- // Fetch username first to scope boards
262
- const meResp = (await this.helpers.request({
263
- method: 'GET',
264
- uri: `${base}/resource/HomefeedBadgingResource/get/`,
265
- headers: { ...baseHeaders, Cookie: cookieHeader },
266
- proxy: proxy || undefined,
267
- }));
268
- const meJson = JSON.parse(meResp);
269
- const username = String(((_b = (_a = meJson.client_context) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.username) || '');
270
- const resp = (await this.helpers.request({
271
- method: 'GET',
272
- uri: `${base}/resource/BoardsResource/get/`,
273
- qs: {
274
- data: JSON.stringify({
275
- options: {
276
- isPrefetch: false,
277
- privacy_filter: 'all',
278
- sort: 'custom',
279
- field_set_key: 'profile_grid_item',
280
- username,
281
- page_size: 25,
282
- group_by: 'visibility',
283
- include_archived: true,
284
- redux_normalize_feed: true,
285
- },
286
- context: {},
287
- }),
288
- },
289
- headers: { ...baseHeaders, Cookie: cookieHeader },
290
- proxy: proxy || undefined,
291
- json: true,
292
- }));
293
- returnData.push({ json: resp });
294
- continue;
295
- }
296
- if (resource === 'pin') {
297
- const operation = this.getNodeParameter('operation', i);
298
- if (operation === 'create') {
299
- const boardId = this.getNodeParameter('boardId', i);
300
- const imageUrl = this.getNodeParameter('imageUrl', i);
301
- const title = this.getNodeParameter('title', i, '');
302
- const description = this.getNodeParameter('description', i, '');
303
- const link = this.getNodeParameter('link', i, '');
304
- const attemptCreate = async (payload, createOptions) => {
305
- var _a, _b, _c, _d, _e;
306
- const form = {
307
- source_url: (_a = createOptions === null || createOptions === void 0 ? void 0 : createOptions.sourceUrl) !== null && _a !== void 0 ? _a : '/pin-builder/',
308
- data: JSON.stringify(payload),
309
- };
310
- if (createOptions === null || createOptions === void 0 ? void 0 : createOptions.modulePath) {
311
- form.module_path = createOptions.modulePath;
312
- }
313
- const createResp = (await this.helpers.request({
314
- method: 'POST',
315
- uri: `${base}/resource/PinResource/create/`,
316
- form,
317
- headers: {
318
- ...baseHeaders,
319
- Cookie: cookieHeader,
320
- Referer: ((_b = createOptions === null || createOptions === void 0 ? void 0 : createOptions.sourceUrl) === null || _b === void 0 ? void 0 : _b.startsWith('/pin/find')) ? `${base}/pin/find/` : `${base}/pin-builder/`,
321
- Origin: base,
322
- 'X-Pinterest-Source-Url': (_c = createOptions === null || createOptions === void 0 ? void 0 : createOptions.sourceUrl) !== null && _c !== void 0 ? _c : '/pin-builder/',
323
- 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
324
- },
325
- proxy: proxy || undefined,
326
- simple: false,
327
- resolveWithFullResponse: true,
328
- }));
329
- const body = createResp.body || '';
330
- let created = {};
331
- try {
332
- created = JSON.parse(body);
333
- }
334
- catch { }
335
- const createdRes = created.resource_response || {};
336
- const pinData = createdRes.data || {};
337
- const id = String(pinData.id || '');
338
- const msg = createdRes.message || ((_d = createdRes.error) === null || _d === void 0 ? void 0 : _d.message) || '';
339
- const msgDetail = ((_e = createdRes.error) === null || _e === void 0 ? void 0 : _e.message_detail) || '';
340
- return { ok: Boolean(id), id, msg: String(msg || msgDetail || ''), body, payload };
341
- };
342
- const isLinkError = (msg) => /doesn['’]?t allow you to save Pins|does not allow you to save Pins|please make sure the url is correct/i.test(msg || '');
343
- const runStrategies = async (strategies) => {
344
- let lastResult = { ok: false };
345
- for (const strat of strategies) {
346
- lastResult = await attemptCreate(strat.payload, strat.options);
347
- if (lastResult.ok) {
348
- return lastResult;
349
- }
350
- if (isLinkError(lastResult.msg)) {
351
- continue;
352
- }
353
- }
354
- return lastResult;
355
- };
356
- let result = { ok: false };
357
- if (!imageUrl) {
358
- throw new Error('Image URL is required.');
359
- }
360
- const sanitizedTitle = sanitizePinterestText(title, 100);
361
- const sanitizedDesc = sanitizePinterestText(description, 500);
362
- const scrapedPayload = {
363
- options: {
364
- method: 'scraped',
365
- title: sanitizedTitle,
366
- description: sanitizedDesc,
367
- link: link,
368
- image_url: imageUrl,
369
- share_facebook: false,
370
- board_id: boardId,
371
- scrape_metric: { source: 'www_url_scrape' },
372
- },
373
- context: {},
374
- };
375
- const scrapedOptions = {
376
- sourceUrl: `/pin/find/?url=${doubleEncodeUrl(imageUrl)}`,
377
- modulePath: 'App()%3EModalManager%3EModal%3EPinCreate%3EBoardPicker%3ESelectList(view_type%3DpinCreate%2C+selected_section_index%3Dundefined%2C+selected_item_index%3Dundefined%2C+highlight_matched_text%3Dtrue%2C+suppress_hover_events%3Dundefined%2C+scroll_selected_item_into_view%3Dtrue%2C+select_first_item_after_update%3Dfalse%2C+item_module%3D%5Bobject+Object%5D)',
378
- };
379
- const strategies = [
380
- { payload: scrapedPayload, options: scrapedOptions },
381
- ];
382
- if (link) {
383
- const withoutLink = JSON.parse(JSON.stringify(scrapedPayload));
384
- if (withoutLink.options) {
385
- withoutLink.options.link = '';
386
- }
387
- strategies.push({ payload: withoutLink, options: scrapedOptions });
388
- }
389
- result = await runStrategies(strategies);
390
- if (!result.ok) {
391
- throw new Error(result.msg || result.body || 'Create failed');
392
- }
393
- returnData.push({ json: { id: result.id, link: `https://www.pinterest.com/pin/${result.id}` } });
394
- }
395
- }
396
- }
397
- catch (error) {
398
- if (this.continueOnFail()) {
399
- returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
400
- continue;
401
- }
402
- throw error;
403
- }
404
- }
405
- return [returnData];
406
- }
407
- }
408
- exports.PinterestCookie = PinterestCookie;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PinterestCookie = void 0;
4
+ const PINTEREST_BASE = 'https://www.pinterest.com';
5
+ function randomCsrf() {
6
+ const seed = `${Date.now()}${Math.floor(Math.random() * 100000)}`;
7
+ return Buffer.from(seed).toString('base64');
8
+ }
9
+ function buildCommonHeaders(csrf) {
10
+ return {
11
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0',
12
+ 'x-pinterest-pws-handler': 'www/[username].js',
13
+ 'x-CSRFToken': csrf,
14
+ 'Accept-Language': 'en-US,en;q=0.9',
15
+ Accept: 'application/json, text/plain, */*',
16
+ 'X-Requested-With': 'XMLHttpRequest',
17
+ };
18
+ }
19
+ function buildCookieHeader(sess, csrf) {
20
+ return `_pinterest_sess=${sess}; csrftoken=${csrf};`;
21
+ }
22
+ function sanitizePinterestText(value, limit) {
23
+ if (!value)
24
+ return '';
25
+ let sanitized = value.replace(/&amp;/g, '&').replace(/&#038;/g, '&');
26
+ sanitized = sanitized.replace(/\r\n|\r|\n/g, '\n');
27
+ sanitized = sanitized.replace(/\t/g, ' ').trim();
28
+ if (sanitized.length > limit) {
29
+ sanitized = sanitized.slice(0, limit - 3) + '...';
30
+ }
31
+ return sanitized.replace(/"/g, '\\"');
32
+ }
33
+ function doubleEncodeUrl(value) {
34
+ return encodeURIComponent(encodeURIComponent(value));
35
+ }
36
+ function parsePinterestJson(value) {
37
+ if (typeof value === 'string') {
38
+ return JSON.parse(value);
39
+ }
40
+ return value;
41
+ }
42
+ async function resolveBaseUrl(ctx, headers, proxy) {
43
+ try {
44
+ const resp = await ctx.helpers.request({
45
+ method: 'GET',
46
+ uri: PINTEREST_BASE,
47
+ headers,
48
+ proxy: proxy || undefined,
49
+ simple: false,
50
+ resolveWithFullResponse: true,
51
+ followRedirect: false,
52
+ });
53
+ const loc = resp?.headers?.location;
54
+ if (loc) {
55
+ try {
56
+ const url = new URL(loc);
57
+ return `${url.protocol}//${url.host}`;
58
+ }
59
+ catch { }
60
+ }
61
+ }
62
+ catch { }
63
+ return PINTEREST_BASE;
64
+ }
65
+ async function getUsername(ctx, base, headers, proxy) {
66
+ const meResp = await ctx.helpers.request({
67
+ method: 'GET',
68
+ uri: `${base}/resource/HomefeedBadgingResource/get/`,
69
+ headers,
70
+ proxy: proxy || undefined,
71
+ });
72
+ const meJson = parsePinterestJson(meResp);
73
+ return String(meJson?.client_context?.user?.username || '');
74
+ }
75
+ async function fetchBoards(ctx, base, headers, proxy, username) {
76
+ const boards = [];
77
+ let bookmark = '';
78
+ do {
79
+ const data = {
80
+ options: {
81
+ isPrefetch: false,
82
+ privacy_filter: 'all',
83
+ sort: 'custom',
84
+ field_set_key: 'profile_grid_item',
85
+ username,
86
+ page_size: 25,
87
+ group_by: 'visibility',
88
+ include_archived: true,
89
+ redux_normalize_feed: true,
90
+ ...(bookmark ? { bookmarks: [bookmark] } : {}),
91
+ },
92
+ context: {},
93
+ };
94
+ const resp = await ctx.helpers.request({
95
+ method: 'GET',
96
+ uri: `${base}/resource/BoardsResource/get/`,
97
+ qs: { data: JSON.stringify(data) },
98
+ headers,
99
+ proxy: proxy || undefined,
100
+ json: true,
101
+ });
102
+ const resource = resp?.resource_response || {};
103
+ const pageBoards = Array.isArray(resource.data) ? resource.data : [];
104
+ for (const board of pageBoards) {
105
+ if (board?.id) {
106
+ boards.push({ id: String(board.id), name: String(board.name || board.id) });
107
+ }
108
+ }
109
+ bookmark = String(resource.bookmark || '');
110
+ } while (bookmark && bookmark !== '-end-');
111
+ return boards;
112
+ }
113
+ class PinterestCookie {
114
+ constructor() {
115
+ this.description = {
116
+ displayName: 'Pinterest (Cookie)',
117
+ name: 'pinterestCookie',
118
+ icon: 'file:pinterest.svg',
119
+ group: ['output'],
120
+ version: 1,
121
+ subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
122
+ description: 'Pinterest via cookie method (web endpoints).',
123
+ documentationUrl: 'https://dps.media/huong-dan-toan-dien-tu-dong-dang-bai-len-pinterest-voi-n8n-update/',
124
+ defaults: { name: 'Pinterest (Cookie)' },
125
+ inputs: ['main'],
126
+ outputs: ['main'],
127
+ credentials: [{ name: 'pinterestCookieApi', required: true }],
128
+ properties: [
129
+ {
130
+ displayName: 'Resource',
131
+ name: 'resource',
132
+ type: 'options',
133
+ noDataExpression: true,
134
+ options: [
135
+ { name: 'Pin', value: 'pin' },
136
+ { name: 'Board', value: 'board' },
137
+ { name: 'Me', value: 'me' },
138
+ ],
139
+ default: 'pin',
140
+ },
141
+ {
142
+ displayName: 'Operation',
143
+ name: 'operation',
144
+ type: 'options',
145
+ displayOptions: { show: { resource: ['pin'] } },
146
+ options: [{ name: 'Create', value: 'create', action: 'Create a pin' }],
147
+ default: 'create',
148
+ },
149
+ {
150
+ displayName: 'Board',
151
+ name: 'boardId',
152
+ type: 'options',
153
+ typeOptions: { loadOptionsMethod: 'getBoardsCookie' },
154
+ displayOptions: { show: { resource: ['pin'], operation: ['create'] } },
155
+ default: '',
156
+ required: true,
157
+ description: 'Select target board.',
158
+ },
159
+ {
160
+ displayName: 'Image URL',
161
+ name: 'imageUrl',
162
+ type: 'string',
163
+ default: '',
164
+ required: true,
165
+ displayOptions: { show: { resource: ['pin'], operation: ['create'] } },
166
+ description: 'Image URL for Pinterest to scrape.',
167
+ },
168
+ {
169
+ displayName: 'Title',
170
+ name: 'title',
171
+ type: 'string',
172
+ default: '',
173
+ typeOptions: { maxLength: 100 },
174
+ displayOptions: { show: { resource: ['pin'], operation: ['create'] } },
175
+ description: 'Pin title (max 100 chars).',
176
+ },
177
+ {
178
+ displayName: 'Description',
179
+ name: 'description',
180
+ type: 'string',
181
+ default: '',
182
+ typeOptions: { maxLength: 800 },
183
+ displayOptions: { show: { resource: ['pin'], operation: ['create'] } },
184
+ description: 'Pin description (max 800 chars).',
185
+ },
186
+ {
187
+ displayName: 'Link',
188
+ name: 'link',
189
+ type: 'string',
190
+ default: '',
191
+ displayOptions: { show: { resource: ['pin'], operation: ['create'] } },
192
+ description: 'Destination URL.',
193
+ },
194
+ {
195
+ displayName: 'Operation',
196
+ name: 'boardOperation',
197
+ type: 'options',
198
+ displayOptions: { show: { resource: ['board'] } },
199
+ options: [{ name: 'Get Many', value: 'getAll', action: 'List boards' }],
200
+ default: 'getAll',
201
+ },
202
+ {
203
+ displayName: 'Operation',
204
+ name: 'meOperation',
205
+ type: 'options',
206
+ displayOptions: { show: { resource: ['me'] } },
207
+ options: [{ name: 'Get', value: 'get', action: 'Get my info' }],
208
+ default: 'get',
209
+ },
210
+ ],
211
+ };
212
+ this.methods = {
213
+ loadOptions: {
214
+ async getBoardsCookie() {
215
+ const creds = await this.getCredentials('pinterestCookieApi');
216
+ const pinterestSess = String(creds.pinterestSess || creds.pinterestsess || '');
217
+ const proxy = String(creds.proxy || '');
218
+ const csrf = randomCsrf();
219
+ const headers = {
220
+ ...buildCommonHeaders(csrf),
221
+ Cookie: buildCookieHeader(pinterestSess, csrf),
222
+ };
223
+ const base = await resolveBaseUrl(this, headers, proxy);
224
+ const username = await getUsername(this, base, headers, proxy);
225
+ const boards = await fetchBoards(this, base, headers, proxy, username);
226
+ return boards.map((board) => ({ name: board.name, value: board.id }));
227
+ },
228
+ },
229
+ };
230
+ }
231
+ async execute() {
232
+ const items = this.getInputData();
233
+ const returnData = [];
234
+ const creds = await this.getCredentials('pinterestCookieApi');
235
+ const pinterestSess = String(creds.pinterestSess || creds.pinterestsess || '');
236
+ const proxy = String(creds.proxy || '');
237
+ for (let i = 0; i < items.length; i++) {
238
+ try {
239
+ const resource = this.getNodeParameter('resource', i);
240
+ const csrf = randomCsrf();
241
+ const baseHeaders = buildCommonHeaders(csrf);
242
+ const cookieHeader = buildCookieHeader(pinterestSess, csrf);
243
+ const headers = { ...baseHeaders, Cookie: cookieHeader };
244
+ const base = await resolveBaseUrl(this, headers, proxy);
245
+ if (resource === 'me') {
246
+ const resp = await this.helpers.request({
247
+ method: 'GET',
248
+ uri: `${base}/resource/HomefeedBadgingResource/get/`,
249
+ headers,
250
+ proxy: proxy || undefined,
251
+ });
252
+ returnData.push({ json: parsePinterestJson(resp) });
253
+ continue;
254
+ }
255
+ if (resource === 'board') {
256
+ const username = await getUsername(this, base, headers, proxy);
257
+ const boards = await fetchBoards(this, base, headers, proxy, username);
258
+ returnData.push({ json: { boards } });
259
+ continue;
260
+ }
261
+ if (resource === 'pin') {
262
+ const operation = this.getNodeParameter('operation', i);
263
+ if (operation === 'create') {
264
+ const boardId = this.getNodeParameter('boardId', i);
265
+ const imageUrl = this.getNodeParameter('imageUrl', i);
266
+ const title = this.getNodeParameter('title', i, '');
267
+ const description = this.getNodeParameter('description', i, '');
268
+ const link = this.getNodeParameter('link', i, '');
269
+ if (!imageUrl) {
270
+ throw new Error('Image URL is required.');
271
+ }
272
+ const sanitizedTitle = sanitizePinterestText(title, 100);
273
+ const sanitizedDescription = sanitizePinterestText(description, 500);
274
+ const sourceUrl = `/pin/find/?url=${doubleEncodeUrl(imageUrl)}`;
275
+ const payload = {
276
+ options: {
277
+ method: 'scraped',
278
+ title: sanitizedTitle,
279
+ description: sanitizedDescription,
280
+ link,
281
+ image_url: imageUrl,
282
+ share_facebook: false,
283
+ board_id: boardId,
284
+ scrape_metric: { source: 'www_url_scrape' },
285
+ },
286
+ context: {},
287
+ };
288
+ const form = {
289
+ source_url: sourceUrl,
290
+ data: JSON.stringify(payload),
291
+ module_path: 'App()%3EModalManager%3EModal%3EPinCreate%3EBoardPicker%3ESelectList(view_type%3DpinCreate%2C+selected_section_index%3Dundefined%2C+selected_item_index%3Dundefined%2C+highlight_matched_text%3Dtrue%2C+suppress_hover_events%3Dundefined%2C+scroll_selected_item_into_view%3Dtrue%2C+select_first_item_after_update%3Dfalse%2C+item_module%3D%5Bobject+Object%5D)',
292
+ };
293
+ const createResp = await this.helpers.request({
294
+ method: 'POST',
295
+ uri: `${base}/resource/PinResource/create/`,
296
+ form,
297
+ headers: {
298
+ ...headers,
299
+ Referer: `${base}/pin/find/`,
300
+ Origin: base,
301
+ 'X-Pinterest-Source-Url': sourceUrl,
302
+ 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
303
+ },
304
+ proxy: proxy || undefined,
305
+ simple: false,
306
+ resolveWithFullResponse: true,
307
+ });
308
+ const body = createResp?.body || '';
309
+ let created = {};
310
+ try {
311
+ created = parsePinterestJson(body);
312
+ }
313
+ catch { }
314
+ const createdResource = created?.resource_response || {};
315
+ const pinData = createdResource?.data || {};
316
+ const id = String(pinData.id || '');
317
+ const message = createdResource?.message ||
318
+ createdResource?.error?.message ||
319
+ createdResource?.error?.message_detail ||
320
+ '';
321
+ if (!id) {
322
+ throw new Error(String(message || body || 'Create failed'));
323
+ }
324
+ returnData.push({ json: { id, link: `https://www.pinterest.com/pin/${id}` } });
325
+ }
326
+ }
327
+ }
328
+ catch (error) {
329
+ const errorMessage = error instanceof Error ? error.message : String(error);
330
+ if (this.continueOnFail()) {
331
+ returnData.push({ json: { error: errorMessage }, pairedItem: { item: i } });
332
+ continue;
333
+ }
334
+ throw error;
335
+ }
336
+ }
337
+ return [returnData];
338
+ }
339
+ }
340
+ exports.PinterestCookie = PinterestCookie;
341
+ //# sourceMappingURL=PinterestCookie.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PinterestCookie.node.js","sourceRoot":"","sources":["../../../src/nodes/PinterestCookie/PinterestCookie.node.ts"],"names":[],"mappings":";;;AAQA,MAAM,cAAc,GAAG,2BAA2B,CAAC;AAEnD,SAAS,UAAU;IACjB,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;IAClE,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAY;IACtC,OAAO;QACL,YAAY,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AO,KAAK,EAAE;gBACd,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAE5E,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE;oBACzB,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;oBAC5E,SAAS;iBACV;gBAED,MAAM,KAAK,CAAC;aACb;SACF;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACtB,CAAC;CACF;AAjPD,0CAiPC"}
package/package.json CHANGED
@@ -1,24 +1,31 @@
1
1
  {
2
2
  "name": "n8n-nodes-pinterest",
3
- "version": "0.2.10",
4
- "description": "n8n community nodes for Pinterest v5 API (list boards, create pins)",
3
+ "version": "0.2.11",
4
+ "description": "n8n community nodes for Pinterest using cookie-based authentication",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",
7
7
  "n8n",
8
8
  "pinterest",
9
9
  "pins",
10
- "boards"
10
+ "boards",
11
+ "cookie",
12
+ "automation"
11
13
  ],
12
- "author": "Community",
13
14
  "license": "MIT",
15
+ "homepage": "https://dps.media/huong-dan-toan-dien-tu-dong-dang-bai-len-pinterest-voi-n8n-update/",
16
+ "author": "Community",
14
17
  "main": "dist/index.js",
15
- "types": "dist/index.d.ts",
18
+ "scripts": {
19
+ "build": "node scripts/clean-dist.mjs && tsc -p . && node scripts/copy-assets.mjs",
20
+ "dev": "tsc --watch",
21
+ "format": "prettier --write \"src/**/*.ts\"",
22
+ "lint": "eslint src/**/*.ts",
23
+ "test": "jest",
24
+ "prepublishOnly": "npm run build"
25
+ },
16
26
  "files": [
17
27
  "dist/**"
18
28
  ],
19
- "scripts": {
20
- "build": "tsc -p . && node scripts/copy-assets.mjs"
21
- },
22
29
  "n8n": {
23
30
  "credentials": [
24
31
  "dist/credentials/PinterestCookieApi.credentials.js"
@@ -28,9 +35,19 @@
28
35
  ]
29
36
  },
30
37
  "devDependencies": {
31
- "@types/node": "^18.19.0",
32
- "n8n-core": "^1.58.0",
33
- "n8n-workflow": "^1.58.0",
34
- "typescript": "^5.4.5"
38
+ "@types/node": "^18.17.0",
39
+ "@typescript-eslint/eslint-plugin": "^5.45.0",
40
+ "@typescript-eslint/parser": "^5.45.0",
41
+ "eslint": "^8.28.0",
42
+ "eslint-plugin-n8n-nodes-base": "^1.11.0",
43
+ "jest": "^29.3.1",
44
+ "prettier": "^2.8.0",
45
+ "typescript": "^4.9.4"
46
+ },
47
+ "dependencies": {
48
+ "n8n-workflow": "^1.82.0"
49
+ },
50
+ "engines": {
51
+ "node": ">=18.17.0"
35
52
  }
36
53
  }