Faceless video workflow n8n 1.106.03 self hosting

I am running a workflow on N8N 1.106.02 and having difficulty, please can someone assist. Thanks in advance

{
“nodes”: [
{
“parameters”: {},
“id”: “6da13ff6-a4d0-45c8-8263-2a28cd8d1349”,
“name”: “Start”,
“type”: “n8n-nodes-base.start”,
“typeVersion”: 1,
“position”: [
-1248,
-128
]
},
{
“parameters”: {
“values”: {
“string”: [
{
“name”: “url”,
“value”: “ 'What's going on here?' - Burnley announce Kyle Walker transfer in bizarre video
}
]
},
“options”: {}
},
“id”: “12f3446e-6cc6-4980-bdd8-65ced00fe4c7”,
“name”: “Set Article URL”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 2,
“position”: [
-1040,
-128
]
},
{
“parameters”: {
“url”: “={{$json[“url”]}}”,
“responseFormat”: “string”,
“options”: {}
},
“id”: “31c60433-34ea-4d7c-9d1f-1751a8327816”,
“name”: “Fetch Article”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 2,
“position”: [
-848,
-128
]
},
{
“parameters”: {
“functionCode”: “const text = $json[“data”] || $json[“body”] || ‘’;\nconst clean = text.replace(/<[^>]*>?/gm, ’ ').replace(/\s+/g, ’ ').trim();\nreturn [{ json: { article: clean } }];”
},
“id”: “7099351e-23c9-4189-a9fe-bed575cfb425”,
“name”: “Extract Text”,
“type”: “n8n-nodes-base.function”,
“typeVersion”: 1,
“position”: [
-640,
-128
]
},
{
“parameters”: {
“authentication”: “predefinedCredentialType”,
“nodeCredentialType”: “openAiApi”,
“url”: “https://api.openai.com/v1/chat/completions”,
“jsonParameters”: true,
“options”: {},
“headerParametersJson”: {
“Content-Type”: “application/json”,
“Authorization”: “Bearer YOUR_OPENAI_API_KEY”
}
},
“id”: “71d9044a-ac08-4a5d-8650-b672f43699d4”,
“name”: “Summarize with OpenAI”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 2,
“position”: [
-448,
-128
],
“credentials”: {
“openAiApi”: {
“id”: “Xj3QiXbB8guscdeY”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“functionCode”: “let data = $json;\n\nif (typeof $json.body === ‘string’) {\n try {\n data = JSON.parse($json.body);\n } catch (e) {\n throw new Error(“Failed to parse JSON from OpenAI response”);\n }\n}\n\nif (!data.choices || !data.choices[0] || !data.choices[0].message) {\n throw new Error(“OpenAI response does not contain choices[0].message”);\n}\n\nreturn [{\n json: {\n script: data.choices[0].message.content\n }\n}];\n”
},
“id”: “7224fa94-cf0f-43a9-a9f2-9df48d73790c”,
“name”: “Extract Script”,
“type”: “n8n-nodes-base.function”,
“typeVersion”: 1,
“position”: [
-240,
-128
]
},
{
“parameters”: {
“url”: “https://api.voicerss.org/”,
“responseFormat”: “file”,
“options”: {},
“queryParametersUi”: {
“parameter”: [
{
“name”: “key”,
“value”: “YOUR_TTS_API_KEY”
},
{
“name”: “hl”,
“value”: “en-us”
},
{
“name”: “src”,
“value”: “={{$json[“script”]}}”
},
{
“name”: “c”,
“value”: “MP3”
}
]
}
},
“id”: “4cf84330-ed4d-4132-ae8d-66b6dce3d675”,
“name”: “Generate TTS”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 2,
“position”: [
-48,
-128
]
},
{
“parameters”: {
“url”: “https://api.replicate.com/v1/predictions”,
“jsonParameters”: true,
“options”: {},
“headerParametersJson”: {
“Authorization”: “Token YOUR_REPLICATE_API_KEY”,
“Content-Type”: “application/json”
}
},
“id”: “16afb336-097b-4070-a80d-1c3a206d0139”,
“name”: “Generate Thumbnail”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 2,
“position”: [
160,
-128
]
},
{
“parameters”: {
“functionCode”: “return [{ json: { status: ‘Video Generated Placeholder’, script: $json[“script”], audio: ‘TTS_AUDIO_URL’, thumbnail: ‘THUMBNAIL_URL’ } }];”
},
“id”: “19a600aa-2da0-41ba-b8b1-1193c19d372c”,
“name”: “Generate Faceless Video”,
“type”: “n8n-nodes-base.function”,
“typeVersion”: 1,
“position”: [
368,
-128
]
}
],
“connections”: {
“Start”: {
“main”: [
[
{
“node”: “Set Article URL”,
“type”: “main”,
“index”: 0
}
]
]
},
“Set Article URL”: {
“main”: [
[
{
“node”: “Fetch Article”,
“type”: “main”,
“index”: 0
}
]
]
},
“Fetch Article”: {
“main”: [
[
{
“node”: “Extract Text”,
“type”: “main”,
“index”: 0
}
]
]
},
“Extract Text”: {
“main”: [
[
{
“node”: “Summarize with OpenAI”,
“type”: “main”,
“index”: 0
}
]
]
},
“Summarize with OpenAI”: {
“main”: [
[
{
“node”: “Extract Script”,
“type”: “main”,
“index”: 0
}
]
]
},
“Extract Script”: {
“main”: [
[
{
“node”: “Generate TTS”,
“type”: “main”,
“index”: 0
}
]
]
},
“Generate TTS”: {
“main”: [
[
{
“node”: “Generate Thumbnail”,
“type”: “main”,
“index”: 0
}
]
]
},
“Generate Thumbnail”: {
“main”: [
[
{
“node”: “Generate Faceless Video”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“instanceId”: “636883641f4b3b3b79cafadae47d9fd072c6a9713b678ed09e09a4d66ea677fd”
}
}
I am running a workflow on N8N 1.106.02 and having difficulty with fetch script node. This is the code that I have already
can anyone provide a solution. Thanks in advance.
let data = $json;
if (typeof $json.body === ‘string’) {
try {
data = JSON.parse($json.body);
} catch (e) {
throw new Error(“Failed to parse JSON from OpenAI response”);
}
}
if (!data.choices || !data.choices[0] || !data.choices[0].message) {
throw new Error(“OpenAI response does not contain choices[0].message”);
}
return [{
json: {
script: data.choices[0].message.content
}
}];

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.