Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 14 additions & 35 deletions nodes/Supadata/Supadata.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,39 +40,14 @@ export class Supadata implements INodeType {
type: 'options',
noDataExpression: true,
options: [
{ name: 'Extract', value: 'extract' },
{ name: 'Media', value: 'media' },
{ name: 'YouTube', value: 'youtube' },
{ name: 'Web', value: 'webScrape' },
],
default: 'media',
},

// --------------------------------------------------------------------------------------------------------
// Extract Operations (AI-powered structured data extraction)
// --------------------------------------------------------------------------------------------------------
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['extract'],
},
},
options: [
{
name: 'Extract Data',
value: 'extractData',
description: 'Extract structured data from a video using AI',
action: 'Extract structured data from a video',
},
],
default: 'extractData',
},

// Extract Fields
// Extract Fields (shown under Media resource)
{
displayName: 'URL',
name: 'extractUrl',
Expand All @@ -81,7 +56,7 @@ export class Supadata implements INodeType {
required: true,
displayOptions: {
show: {
resource: ['extract'],
resource: ['media'],
operation: ['extractData'],
},
},
Expand Down Expand Up @@ -112,7 +87,7 @@ export class Supadata implements INodeType {
default: 'prompt',
displayOptions: {
show: {
resource: ['extract'],
resource: ['media'],
operation: ['extractData'],
},
},
Expand All @@ -129,7 +104,7 @@ export class Supadata implements INodeType {
required: true,
displayOptions: {
show: {
resource: ['extract'],
resource: ['media'],
operation: ['extractData'],
extractInputMode: ['prompt', 'both'],
},
Expand All @@ -145,7 +120,7 @@ export class Supadata implements INodeType {
required: true,
displayOptions: {
show: {
resource: ['extract'],
resource: ['media'],
operation: ['extractData'],
extractInputMode: ['schema', 'both'],
},
Expand All @@ -160,7 +135,7 @@ export class Supadata implements INodeType {
default: {},
displayOptions: {
show: {
resource: ['extract'],
resource: ['media'],
operation: ['extractData'],
},
},
Expand Down Expand Up @@ -204,6 +179,12 @@ export class Supadata implements INodeType {
},
},
options: [
{
name: 'Extract Structured Data',
value: 'extractData',
description: 'Extract structured data from a video using AI',
action: 'Extract structured data from a video',
},
{
name: 'Get Metadata',
value: 'getMetadata',
Expand Down Expand Up @@ -528,7 +509,7 @@ export class Supadata implements INodeType {
const operation = this.getNodeParameter('operation', i) as string;
let responseData;

if (resource === 'extract') {
if (resource === 'media') {
if (operation === 'extractData') {
const url = this.getNodeParameter('extractUrl', i) as string;
const inputMode = this.getNodeParameter('extractInputMode', i) as string;
Expand Down Expand Up @@ -563,9 +544,7 @@ export class Supadata implements INodeType {
pollInterval,
maxWaitTime,
);
}
} else if (resource === 'media') {
if (operation === 'getMetadata') {
} else if (operation === 'getMetadata') {
const videoUrl = this.getNodeParameter('videoUrl', i) as string;
responseData = await supadataApiRequest.call(
this,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "n8n-nodes-supadata",
"version": "0.4.0",
"version": "0.5.0",
"description": "Tool for extracting content from YouTube videos and web pages",
"keywords": [
"n8n-community-node-package",
Expand Down