This workflow follows the Chainllm → Google Sheets recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"createdAt": "2025-05-23T06:06:15.188Z",
"updatedAt": "2025-05-26T14:02:47.000Z",
"id": "OeRgoOCODvsJe4nh",
"name": "YouTube AI Analys (modified) + community node transcript",
"active": false,
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{}
]
}
},
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
-560,
200
],
"id": "649191e1-f5e4-4633-bf0e-b2b0dc0eb572",
"name": "Schedule Trigger"
},
{
"parameters": {
"resource": "playlistItem",
"operation": "getAll",
"playlistId": "=UUPjNBjflYl0-HQtUvOx0Ibw",
"part": [
"snippet",
"contentDetails"
],
"options": {}
},
"type": "n8n-nodes-base.youTube",
"typeVersion": 1,
"position": [
-340,
-300
],
"id": "4e7b7526-06bc-4e8d-8491-68eb98e0cee7",
"name": "Greg Isenberg",
"credentials": {
"youTubeOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"resource": "playlistItem",
"operation": "getAll",
"playlistId": "=UUbo-KbSjJDG6JWQ_MTZ_rNA",
"part": [
"snippet",
"contentDetails"
],
"options": {}
},
"type": "n8n-nodes-base.youTube",
"typeVersion": 1,
"position": [
-340,
-100
],
"id": "d5676bb0-d728-4872-bd28-cd316cafd272",
"name": "Nick Saraev",
"credentials": {
"youTubeOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"resource": "playlistItem",
"operation": "getAll",
"playlistId": "=UU08Fah8EIryeOZRkjBRohcQ",
"part": [
"snippet",
"contentDetails"
],
"options": {}
},
"type": "n8n-nodes-base.youTube",
"typeVersion": 1,
"position": [
-340,
80
],
"id": "fdf196c5-9a57-4f47-86f1-05685b7e1c0e",
"name": "Creator Magic",
"credentials": {
"youTubeOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"resource": "playlistItem",
"operation": "getAll",
"playlistId": "=UUMwVTLZIRRUyyVrkjDpn4pA",
"part": [
"snippet",
"contentDetails"
],
"options": {}
},
"type": "n8n-nodes-base.youTube",
"typeVersion": 1,
"position": [
-340,
320
],
"id": "782335a1-fc11-4f25-97b8-9f2975100574",
"name": "Cole Medin",
"credentials": {
"youTubeOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"resource": "playlistItem",
"operation": "getAll",
"playlistId": "=UUI4xxi0p97BghIqgEPYx6sw",
"part": [
"snippet",
"contentDetails"
],
"options": {}
},
"type": "n8n-nodes-base.youTube",
"typeVersion": 1,
"position": [
-340,
520
],
"id": "2e4875a8-8dce-4f80-828d-8e60ee68533d",
"name": "Your AI Workflow",
"credentials": {
"youTubeOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"resource": "playlistItem",
"operation": "getAll",
"playlistId": "=UUc-FovAyBAQDw2Y7PQ_v0Zw",
"part": [
"snippet",
"contentDetails"
],
"options": {}
},
"type": "n8n-nodes-base.youTube",
"typeVersion": 1,
"position": [
-340,
720
],
"id": "f897c8c0-11dd-495b-bb9e-9c436aaaf32c",
"name": "Julian Goldie SEO",
"credentials": {
"youTubeOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "// \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043c\u0435\u0442\u043a\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u00ab\u043d\u0435\u0434\u0435\u043b\u044e \u043d\u0430\u0437\u0430\u0434\u00bb\nconst oneWeekAgo = Date.now() - 1 * 24 * 60 * 60 * 1000;\n\n// \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u043e \u0434\u0430\u0442\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u0437 snippet.publishedAt\nconst recentItems = items.filter(item => {\n const pubDate = new Date(item.json.snippet.publishedAt).getTime();\n return pubDate >= oneWeekAgo;\n});\n\nreturn recentItems;\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
440,
180
],
"id": "2e87fa5c-6926-4807-b6ec-4daf65ab9b3b",
"name": "24 hours"
},
{
"parameters": {
"numberInputs": 6
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3,
"position": [
160,
120
],
"id": "be67c46c-8761-4bab-81b9-d49dd68f6d34",
"name": "Merge YouTube videos"
},
{
"parameters": {
"jsCode": "// \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0443\u0437\u043b\u0435 \"Code\" \u0432 n8n.\n// \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443\u0437\u043b\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 'items' \u043a\u0430\u043a \u043c\u0430\u0441\u0441\u0438\u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.\n\n// \u041c\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\n// \u0441 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0442\u0440\u0430\u043d\u0441\u043a\u0440\u0438\u043f\u0446\u0438\u0438 \u0412\u041d\u0423\u0422\u0420\u0418 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 'json'.\n\nconst outputItems = items.map(item => {\n let concatenatedText = '';\n let transcript = null;\n\n // \u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0442\u0440\u0430\u043d\u0441\u043a\u0440\u0438\u043f\u0446\u0438\u0438,\n // \u043e\u0436\u0438\u0434\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 item.json.transcript.\n // \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 (?.) \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430.\n transcript = item?.json?.transcript;\n\n // \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c\n if (Array.isArray(transcript)) {\n // \u0424\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438\n // \u0438\u043b\u0438 \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 'text'.\n // \u0417\u0430\u0442\u0435\u043c \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043a\u0441\u0442 \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c.\n const textSegments = transcript\n .filter(entry => entry && typeof entry === 'object' && typeof entry.text === 'string')\n .map(entry => entry.text);\n\n concatenatedText = textSegments.join(' ');\n } else {\n // \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u043c\u0430\u0441\u0441\u0438\u0432 \u0442\u0440\u0430\u043d\u0441\u043a\u0440\u0438\u043f\u0446\u0438\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u043b\u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c\n console.warn(\"\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 'json.transcript' \u0438\u043b\u0438 \u043f\u0443\u0442\u044c \u043a \u043d\u0435\u043c\u0443:\", item);\n // \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 concatenatedText \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 ('').\n // \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438.\n }\n\n // \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442.\n // \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0432\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.\n // \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u043b\u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e 'json', \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0432\u043d\u0443\u0442\u0440\u044c \u043d\u0435\u0433\u043e.\n return {\n ...item, // \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0430 \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c\n json: { // \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0443 'json'\n ...(item.json || {}), // \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438\u0437 item.json (\u0435\u0441\u043b\u0438 \u043e\u043d \u0435\u0441\u0442\u044c)\n concatenatedTranscript: concatenatedText // \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u044e\u0434\u0430 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442\n }\n };\n});\n\n// \u0423\u0437\u0435\u043b \"Code\" \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.\nreturn outputItems;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1580,
160
],
"id": "e00e4f1a-6d09-4503-aee4-f4a0e653b721",
"name": "Code5"
},
{
"parameters": {
"mode": "combine",
"advanced": true,
"mergeByFields": {
"values": [
{
"field1": "firstExtractedTitle",
"field2": "title"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3,
"position": [
860,
740
],
"id": "b8cf5754-5426-4515-b563-63622b850a4f",
"name": "Merge"
},
{
"parameters": {
"operation": "appendOrUpdate",
"documentId": {
"__rl": true,
"value": "https://docs.google.com/spreadsheets/d/1pongTk5EFZI1D6RRpYwz_Ex_Tt3lsHfD0jHcGgnAq0k/edit?gid=0#gid=0",
"mode": "url"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Parsing",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pongTk5EFZI1D6RRpYwz_Ex_Tt3lsHfD0jHcGgnAq0k/edit#gid=0"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Title": "={{ $json.title }}",
"Link": "={{ $json.url }}",
"channelLink": "={{ $json.channel_id }}",
"videoLink": "={{ $json.videoId }}",
"json": "={{ $json.cleanedText }}"
},
"matchingColumns": [
"Title"
],
"schema": [
{
"id": "Title",
"displayName": "Title",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "Link",
"displayName": "Link",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "json",
"displayName": "json",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "videoLink",
"displayName": "videoLink",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "channelLink",
"displayName": "channelLink",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Topic",
"displayName": "Topic",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Description",
"displayName": "Description",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [
1340,
740
],
"id": "4aaf0cb0-5573-4258-b3a5-88ecfdfaa6a7",
"name": "Google Sheets2",
"disabled": true
},
{
"parameters": {
"jsCode": "const newItems = [];\n\nfor (const item of items) {\n const concatenatedTranscript = item.json.concatenatedTranscript;\n const title = item.json.title;\n\n // Create a new item object with the desired structure (separate columns)\n // You can name the properties (columns) as you wish\n newItems.push({\n json: {\n transcriptColumn: concatenatedTranscript,\n titleColumn: title\n }\n });\n}\n\nreturn newItems;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1120,
460
],
"id": "139fb4fe-60f5-41ee-a856-dd54b82b4e31",
"name": "Add Columns"
},
{
"parameters": {
"jsCode": "// \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0443\u0437\u043b\u0430 Code \u0432 n8n.\n// \u041e\u043d \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 (items).\n// \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043e\u043d \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0432\u0441\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 'json'.\n// \u0415\u0441\u043b\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u043a \u043d\u0435\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0448\u0430\u0433\u0438 \u043e\u0447\u0438\u0441\u0442\u043a\u0438\n// \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u043e\u0445\u043e\u0436\u0435\u0433\u043e \u043d\u0430 JSON.\n\n// \u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0441\u0442\u0440\u043e\u043a\u0438\nfunction cleanString(inputString) {\n // \u0415\u0441\u043b\u0438 \u0432\u0445\u043e\u0434\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0435\u0433\u043e \u043a\u0430\u043a \u0435\u0441\u0442\u044c.\n if (typeof inputString !== 'string') {\n return inputString;\n }\n\n let cleanedJsonString = inputString;\n\n // --- \u0428\u0430\u0433\u0438 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 ---\n\n // 1. \u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0435\u0434\u0443\u0449\u0438\u0439 \u043c\u0430\u0440\u043a\u0435\u0440 'json' (```json \u0438\u043b\u0438 ``json) \u0438 \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u044b/\u043f\u0435\u0440\u0435\u0432\u043e\u0434\u044b \u0441\u0442\u0440\u043e\u043a.\n // \u0424\u043b\u0430\u0433 'i' \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0434\u043b\u044f \u043d\u0435\u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0443 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f 'json'.\n // (?:```|``) \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0440\u0435\u043c \u0438\u043b\u0438 \u0434\u0432\u0443\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u043c \u043a\u0430\u0432\u044b\u0447\u043a\u0430\u043c.\n cleanedJsonString = cleanedJsonString.replace(/^\\s*(?:```|``)\\s*json\\s*\\n*/i, '');\n\n // 2. \u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043c\u044b\u043a\u0430\u044e\u0449\u0438\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0435 \u043a\u0430\u0432\u044b\u0447\u043a\u0438 (``` \u0438\u043b\u0438 ``) \u0438 \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u044b/\u043f\u0435\u0440\u0435\u0432\u043e\u0434\u044b \u0441\u0442\u0440\u043e\u043a.\n cleanedJsonString = cleanedJsonString.replace(/\\s*(?:```|``)\\s*$/, '');\n\n // 3. \u041e\u0431\u0440\u0435\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u0432\u0435\u0434\u0443\u0449\u0438\u0435/\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u044b.\n cleanedJsonString = cleanedJsonString.trim();\n\n // --- !!! \u041f\u0420\u0415\u0414\u0423\u041f\u0420\u0415\u0416\u0414\u0415\u041d\u0418\u0415 !!! ---\n // \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0430\u0436\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b JSON: \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 ([ ]) \u0438 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 ({ }).\n // \u041a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c JSON.\n // \u0415\u0441\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0443\u0437\u0435\u043b n8n \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c JSON.parse() \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430, \u043e\u043d \u041e\u0411\u042f\u0417\u0410\u0422\u0415\u041b\u042c\u041d\u041e \u0412\u042b\u0414\u0410\u0421\u0422 \u041e\u0428\u0418\u0411\u041a\u0423,\n // \u0435\u0441\u043b\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 JSON-\u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432. \u042d\u0442\u0430 \u043b\u043e\u0433\u0438\u043a\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0432\u0430\u0448\u0435\u043c\u0443 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u0437\u0430\u0434\u0430\u043d\u0438\u044e.\n cleanedJsonString = cleanedJsonString.replace(/[\\[\\]\\{\\}]/g, '');\n\n return cleanedJsonString;\n}\n\n// \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 'items'\nconst outputItems = items.map(item => {\n const newItem = {\n json: {},\n // \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0435\u0441\u0442\u044c\n ...(item.binary && { binary: item.binary })\n };\n\n // \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 item.json\n if (item.json && typeof item.json === 'object' && item.json !== null) {\n // \u041f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u043f\u043e \u0432\u0441\u0435\u043c \u043a\u043b\u044e\u0447\u0430\u043c \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 item.json\n for (const key in item.json) {\n if (Object.prototype.hasOwnProperty.call(item.json, key)) {\n // \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\n newItem.json[key] = cleanString(item.json[key]);\n }\n }\n } else if (item.json) {\n // \u0415\u0441\u043b\u0438 item.json \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c, \u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0442\u0440\u043e\u043a\u0430, \u0447\u0438\u0441\u043b\u043e),\n // \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.\n // \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0447\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.\n console.warn(`Warning: item.json for an item was not an object. Attempting to clean it directly. Value: ${item.json}`);\n newItem.json.unknownProcessedValue = cleanString(item.json);\n }\n\n\n return newItem;\n});\n\n// --- \u0412\u044b\u0432\u043e\u0434 ---\n// \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.\nreturn outputItems;\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
860,
460
],
"id": "70399041-0bb6-4c94-9a57-db6a4c1e1a83",
"name": "remove json1"
},
{
"parameters": {
"model": "openai/gpt-4.1",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"typeVersion": 1,
"position": [
1580,
700
],
"id": "52be3c99-2d4e-42c1-a94c-8fc3e7fec1a0",
"name": "OpenRouter Chat Model3",
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "// \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043b\u0438\u0448\u043d\u0438\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438\nconst cleanString = (inputText) => {\n let text = inputText;\n // \u0423\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0442\u0440\u043e\u043a\u0430\n if (typeof text !== 'string') {\n // \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 \u0441\u0442\u0440\u043e\u043a\u0430, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0435\u0435 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435.\n // \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439, \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0442\u0430\u043a\u0436\u0435 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0443\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0443.\n text = String(text);\n }\n return text\n .replace(/```json\\n/g, '') // \u0423\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u043d\u0430\u0447\u0430\u043b\u043e \u0431\u043b\u043e\u043a\u0430 json-\u043a\u043e\u0434\u0430, \u0435\u0441\u043b\u0438 \u043e\u043d\u043e \u0435\u0441\u0442\u044c\n .replace(/```/g, '') // \u0423\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0431\u043b\u043e\u043a\u0430 \u043a\u043e\u0434\u0430\n .replace(/\\n/g, ' ') // \u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0430 \u043f\u0440\u043e\u0431\u0435\u043b\u044b\n .replace(/\\s+/g, ' ') // \u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043d\u0430 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0431\u0435\u043b\n .trim(); // \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0440\u043e\u043a\u0438\n};\n\n// \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438.\nlet allInputItems = [];\n\n// \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c, \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b.\n// \u0412 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043c\u0435\u0442\u043e\u0434 $input.first(), \u0447\u0442\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u043e \u0434\u043b\u044f \u0441\u0440\u0435\u0434,\n// \u0433\u0434\u0435 $input \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c-\u0445\u0435\u043b\u043f\u0435\u0440\u043e\u043c \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0432\u0445\u043e\u0434\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c.\n// \u0412 \u0442\u0430\u043a\u0438\u0445 \u0441\u0440\u0435\u0434\u0430\u0445 \u043e\u0431\u044b\u0447\u043d\u043e \u0435\u0441\u0442\u044c \u0438 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.\n\nif (typeof $input.all === 'function') {\n // \u042d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, n8n) \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432\u0441\u0435\u0445 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.\n allInputItems = $input.all();\n} else if (Array.isArray($input)) {\n // \u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f $input \u0441\u0430\u043c\u0430 \u043f\u043e \u0441\u0435\u0431\u0435 \u0443\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.\n allInputItems = $input;\n} else if ($input && Array.isArray($input.items)) {\n // \u0415\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435 'items' \u043e\u0431\u044a\u0435\u043a\u0442\u0430 $input (\u0434\u0440\u0443\u0433\u043e\u0439 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d).\n allInputItems = $input.items;\n} else if ($input && typeof $input.first === 'function') {\n // \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 .first(), \u043d\u043e \u043d\u0435\u0442 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b (\u0442\u0438\u043f\u0430 .all() \u0438\u043b\u0438 .items).\n // \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u0440\u0430\u0437\u0443 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c,\n // \u0438\u043b\u0438 \u0447\u0442\u043e \u043a\u043e\u0434 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u0431\u044b\u043b \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d \u043d\u0430 \u043f\u0430\u043a\u0435\u0442\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443.\n // \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \"\u0432\u0441\u0435\" \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 .first() \u0437\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0435\u0442\n // \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c, \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e.\n console.warn(\"\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u043c\u0435\u0442\u043e\u0434 $input.first(), \u043d\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, $input.all() \u0438\u043b\u0438 $input.items). \u0411\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u044f\u0442\u0430 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c $input \u043a\u0430\u043a \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0435\u0441\u043b\u0438 \u043e\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435.\");\n // \u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c $input \u043a\u0430\u043a \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0435\u0441\u043b\u0438 \u043e\u043d \u0438\u043c\u0435\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 item.json.text\n if ($input && $input.json && typeof $input.json.text === 'string') {\n allInputItems = [$input]; // \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0441\u0430\u043c $input \u043a\u0430\u043a \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\n } else {\n // \u0415\u0441\u043b\u0438 $input.first() \u0435\u0441\u0442\u044c, \u043d\u043e $input \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u043d\u0443\u0436\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b,\n // \u0438 \u043d\u0435\u0442 $input.all(), \u0442\u043e \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0434\u0435\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \"\u0432\u0441\u0435\" \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b.\n console.error(\"\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 $input. $input \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c, \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u0430 .all() \u0438\u043b\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 .items, \u0438 \u0441\u0430\u043c \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u043d\u0443\u0436\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c $input.first() \u043a\u0430\u043a \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442.\");\n try {\n const firstItem = $input.first();\n if (firstItem && firstItem.json && typeof firstItem.json.text === 'string') {\n allInputItems = [firstItem]; // \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b\n } else {\n allInputItems = []; // \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u0436\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435\n }\n } catch(e) {\n console.error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a $input.first() \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b:\", e);\n allInputItems = [];\n }\n }\n} else if ($input && $input.json && typeof $input.json.text === 'string') {\n // \u0415\u0441\u043b\u0438 $input \u2014 \u044d\u0442\u043e \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 (\u043d\u0435 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438 \u043d\u0435 \u0445\u0435\u043b\u043f\u0435\u0440),\n // \u043d\u043e \u043e\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 { json: { text: \"...\" } }.\n allInputItems = [$input];\n} else {\n // \u0415\u0441\u043b\u0438 \u043d\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043d\u0435 \u043f\u043e\u0434\u043e\u0448\u0435\u043b.\n console.error(\"\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 $input. \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. $input:\", $input);\n allInputItems = []; // \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0443\u0441\u0442\u044b\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a \u0434\u0430\u043b\u0435\u0435\n}\n\n// \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430: \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e allInputItems \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c.\nif (!Array.isArray(allInputItems)) {\n console.error(\"\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f allInputItems \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0435\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b. \u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 allInputItems:\", allInputItems);\n // \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u043e\u0448\u0438\u0431\u043a\u043e\u0439,\n // \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435 \u0432 \u043b\u043e\u0433\u0430\u0445.\n return [];\n}\n\n// \u0415\u0441\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 allInputItems \u043f\u0443\u0441\u0442 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u0432\u0445\u043e\u0434 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e \u0438\u043b\u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443),\n// \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443.\nif (allInputItems.length === 0) {\n console.log(\"\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0438\u043b\u0438 \u043d\u0435 \u0431\u044b\u043b\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u044b.\");\n return []; // \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\n}\n\n// \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 allInputItems\nconst results = allInputItems.map((item, index) => {\n // \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0442\u0435\u043a\u0443\u0449\u0438\u0439 'item' \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043b\u044e\u0447 'json',\n // \u0438 'item.json' \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043b\u044e\u0447 'text' \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c.\n // \u042d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b $input.first() \u0432 \u0432\u0430\u0448\u0435\u043c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435.\n if (item && item.json && typeof item.json.text === 'string') {\n const inputString = item.json.text;\n // \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u043a \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c\u0443 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u043c\u0443\n const cleanedString = cleanString(inputString);\n // \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435\n return { json: { json: cleanedString } };\n } else {\n // \u0415\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0432\u0435\u0440\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438\u043b\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435,\n // \u043b\u043e\u0433\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u043e \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435.\n // \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438\u0437-\u0437\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \"\u043f\u043b\u043e\u0445\u043e\u0433\u043e\" \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.\n console.warn(`\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c ${index} \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0432\u0435\u0440\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438\u043b\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 'item.json.text'. \u042d\u043b\u0435\u043c\u0435\u043d\u0442:`, item);\n return { json: { error: \"\u041d\u0435\u0432\u0435\u0440\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438\u043b\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043e\u043b\u0435 'json.text'\", originalItem: item } };\n }\n});\n\n// \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.\n// \u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u044d\u0442\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u0432\u0438\u0434\u0430 { json: { cleanedText: \"...\" } }\n// \u0438\u043b\u0438 { json: { error: \"...\", originalItem: ... } } \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c.\nreturn results;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1960,
460
],
"id": "0d02b163-3c56-46c1-b282-2331ebd2b3a5",
"name": "Delete trash1"
},
{
"parameters": {
"mode": "combine",
"advanced": true,
"mergeByFields": {
"values": [
{
"field1": "=youtubeId",
"field2": "=videoId"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3,
"position": [
1360,
160
],
"id": "087cac36-0a7b-45c5-9ce3-19129d31ea7c",
"name": "Merge transcribation and title, url, etc1"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "60d0d292-7f04-40b4-acf3-8a64c13acd26",
"name": "title",
"value": "={{ $json.snippet.title }}",
"type": "string"
},
{
"id": "753c7ef6-4008-4b16-81f0-7fbe291f015a",
"name": "url",
"value": "=https://youtube.com/watch?v={{ $json.snippet.resourceId.videoId }}",
"type": "string"
},
{
"id": "b51008a2-7ca7-408c-b212-f8a441d7c3e5",
"name": "publishedAt",
"value": "={{ $json.snippet.publishedAt }}",
"type": "string"
},
{
"id": "32915e1e-22a5-452f-a234-8371d3993da3",
"name": "videoId",
"value": "={{ $json.snippet.resourceId.videoId }}",
"type": "string"
},
{
"id": "081f3dd5-08ce-455f-9275-e10a8078a5b5",
"name": "channel_id",
"value": "=https://www.youtube.com/channel/{{ $json.snippet.channelId }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
700,
180
],
"id": "e301662f-1528-4416-b4bb-08befb44fb1e",
"name": "Parse title ulr and publishedAt2"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "7f472442-7031-477a-91e5-7c4c1f395342",
"name": "transcript",
"value": "={{ $json.transcript }}",
"type": "array"
},
{
"id": "a31a1ac5-1b68-4555-a3b2-185871443971",
"name": "title",
"value": "={{ $json.title }}",
"type": "string"
},
{
"id": "9a348f4d-6993-4c14-8843-0f8526b66538",
"name": "url",
"value": "={{ $json.url }}",
"type": "string"
},
{
"id": "8cb5f6fc-103c-4632-be0f-bd20d2a871bd",
"name": "videoId",
"value": "={{ $json.videoId }}",
"type": "string"
},
{
"id": "8bf407f6-c4ca-42c1-b0d1-a870f4d533a5",
"name": "concatenatedTranscript",
"value": "={{ $json.concatenatedTranscript }}",
"type": "string"
},
{
"id": "148d1f7d-10dc-448a-960b-533f4113ee53",
"name": "channel_id",
"value": "={{ $json.channel_id }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
1800,
160
],
"id": "4972de2a-e514-470a-8a0d-aaf5cd476149",
"name": "Edit Fields"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "b3e41e7d-b40e-4ba8-88cb-38e12e541e40",
"leftValue": "={{ $json.transcriptColumn }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
1340,
460
],
"id": "89c2b0fe-d9c4-48f3-89e3-c895fb4aded8",
"name": "If"
},
{
"parameters": {
"jsCode": "const output = [];\n\n// \u041f\u0440\u043e\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0432\u0445\u043e\u0434\u043d\u043e\u043c\u0443 JSON-\u0444\u0430\u0439\u043b\u0443\nfor (const item of $input.all()) {\n const inputData = item.json.json; // \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 JSON \u0438\u0437 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\n\n // \u0420\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \"title\"\n const regex = /\"title\":\\s*\"(.*?)\"/;\n const match = inputData.match(regex);\n\n let firstTitle = null;\n if (match && match[1]) {\n firstTitle = match[1];\n }\n\n // \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0432\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u043d\u044b\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a\n output.push({\n json: {\n ...item.json, // \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\n firstExtractedTitle: firstTitle // \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u043b\u043e\u043d\u043a\u0443 \u0441 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u043d\u044b\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u043c\n }\n });\n}\n\n// \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432\nreturn output;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2180,
460
],
"id": "fcf8b29b-ac21-48f1-8a66-8f617ebd5d7d",
"name": "Code"
},
{
"parameters": {
"promptType": "define",
"text": "=",
"messages": {
"messageValues": [
{
"type": "HumanMessagePromptTemplate",
"message": "=\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0439 \u041e\u0414\u0418\u041d \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 JSON-\u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0443\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443 \u043f\u043e \u0414\u0410\u041d\u041d\u042b\u041c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043f\u0440\u0438\u0448\u043b\u044e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438. \u0421\u043e\u0431\u043b\u044e\u0434\u0430\u0439 \u0412\u0421\u0415 \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044c \u0441\u0435\u0431\u044f \u043f\u043e \u0447\u0435\u043a-\u043b\u0438\u0441\u0442\u0443 \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0432\u0435\u0434\u0438 \u0442\u043e\u043b\u044c\u043a\u043e JSON. \u0415\u0441\u043b\u0438 \u043f\u043e\u043d\u044f\u043b \u2014 \u043e\u0442\u0432\u0435\u0442\u044c: \u0414\u0430, \u0436\u0434\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435. \n\n\u2e3b 1\u2003\u0428\u0430\u0431\u043b\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u041e\u0411\u042f\u0417\u0410\u0422\u0415\u041b\u042c\u041d\u041e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c\n\u2e3b 1\u2003\u0428\u0430\u0431\u043b\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u041e\u0411\u042f\u0417\u0410\u0422\u0415\u041b\u042c\u041d\u041e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c\n{\n \"title\": \"\",\n \"description\": \"\",\n \"category\": \"681dfaab642ad2b18ee6e8d3\",\n \"difficulty\": \"beginner\",\n \"instructor\": \"67f4c1cf43048b820d373709\",\n \"image\": \"\",\n \"imagePreview\": \"\",\n \"modules\": [\n {\n \"title\": \"Module A\",\n \"desc
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openRouterApiyouTubeOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
YouTube AI Analys (modified) + community node transcript. Uses youTube, googleSheets, lmChatOpenRouter, chainLlm. Scheduled trigger; 26 nodes.
Source: https://github.com/AdminRHS/n8n-credentials-backup/blob/9be9e5c32e495d6bce2eb5bbc6a3411589f98c27/workflows/YouTube_AI_Analys_modified__community_node_transcript/YouTube_AI_Analys_modified__community_node_transcript.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
AI YouTube transcript. Uses youTube, googleSheets, lmChatOpenRouter, chainLlm. Scheduled trigger; 26 nodes.
This n8n template acts as your automated social media data analyst. Instead of manually checking your analytics across different dashboards every week, this workflow scrapes your latest stats, calcula
What It Does
Youtube Video Creator. Uses googleSheets, chainLlm, lmChatOpenAi, outputParserStructured. Scheduled trigger; 21 nodes.
The Ultimate AI Workflow for YouTube Community Posts (with Dynamic Images)