n8n-nodes-duckduckgo-search
Version:
A powerful and comprehensive n8n community node that seamlessly integrates DuckDuckGo search capabilities into your workflows. Search the web, find images, discover news, and explore videos - all with privacy-focused, reliable results.
1,023 lines (1,022 loc) • 118 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DuckDuckGo = void 0;
const n8n_workflow_1 = require("n8n-workflow");
const duck_duck_scrape_1 = require("duck-duck-scrape");
const directSearch_1 = require("./directSearch");
const types_1 = require("./types");
const processors_1 = require("./processors");
const constants_1 = require("./constants");
const utils_1 = require("./utils");
const cache_1 = require("./cache");
const telemetry_1 = require("./telemetry");
const searchOperators_1 = require("./searchOperators");
const vqdPagination_1 = require("./vqdPagination");
const fallbackSearch_1 = require("./fallbackSearch");
const LOCALE_OPTIONS = [
{ name: 'English (US)', value: 'en-us' },
{ name: 'English (UK)', value: 'uk-en' },
{ name: 'Spanish (Spain)', value: 'es-es' },
{ name: 'French (France)', value: 'fr-fr' },
{ name: 'German (Germany)', value: 'de-de' },
{ name: 'Italian (Italy)', value: 'it-it' },
{ name: 'Japanese (Japan)', value: 'jp-jp' },
{ name: 'Russian (Russia)', value: 'ru-ru' },
{ name: 'Chinese (China)', value: 'zh-cn' },
{ name: 'Portuguese (Brazil)', value: 'br-pt' },
{ name: 'Dutch (Netherlands)', value: 'nl-nl' },
{ name: 'Polish (Poland)', value: 'pl-pl' },
{ name: 'Swedish (Sweden)', value: 'se-sv' },
{ name: 'Korean (Korea)', value: 'kr-ko' },
{ name: 'Turkish (Turkey)', value: 'tr-tr' },
{ name: 'Arabic (Saudi Arabia)', value: 'sa-ar' },
{ name: 'Hebrew (Israel)', value: 'il-he' },
{ name: 'Persian (Iran)', value: 'ir-fa' },
];
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function getRandomUserAgent() {
const userAgents = [
'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1',
'Mozilla/5.0 (Linux; Android 11; SM-G998U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.98 Mobile Safari/537.36',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15',
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0',
];
return userAgents[Math.floor(Math.random() * userAgents.length)];
}
function getSafeSearchType(value) {
switch (value) {
case 0:
return duck_duck_scrape_1.SafeSearchType.STRICT;
case -1:
return duck_duck_scrape_1.SafeSearchType.MODERATE;
case -2:
return duck_duck_scrape_1.SafeSearchType.OFF;
default:
return duck_duck_scrape_1.SafeSearchType.MODERATE;
}
}
function getSearchTimeType(value) {
switch (value) {
case 'pastDay':
case 'd':
return duck_duck_scrape_1.SearchTimeType.DAY;
case 'pastWeek':
case 'w':
return duck_duck_scrape_1.SearchTimeType.WEEK;
case 'pastMonth':
case 'm':
return duck_duck_scrape_1.SearchTimeType.MONTH;
case 'pastYear':
case 'y':
return duck_duck_scrape_1.SearchTimeType.YEAR;
case 'anyTime':
case 'a':
default:
return duck_duck_scrape_1.SearchTimeType.ALL;
}
}
function getVideoDefinition(value) {
switch (value) {
case 'high':
case 'hd':
return duck_duck_scrape_1.VideoDefinition.HIGH;
case 'standard':
case 'sd':
return duck_duck_scrape_1.VideoDefinition.STANDARD;
default:
return duck_duck_scrape_1.VideoDefinition.ANY;
}
}
function getVideoDuration(value) {
switch (value) {
case 'short':
case 'SHORT':
return duck_duck_scrape_1.VideoDuration.SHORT;
case 'medium':
case 'MEDIUM':
return duck_duck_scrape_1.VideoDuration.MEDIUM;
case 'long':
case 'LONG':
return duck_duck_scrape_1.VideoDuration.LONG;
default:
return duck_duck_scrape_1.VideoDuration.ANY;
}
}
function getVideoLicense(value) {
switch (value) {
case 'creativeCommon':
case 'cc':
return duck_duck_scrape_1.VideoLicense.CREATIVE_COMMONS;
case 'youtube':
case 'yt':
return duck_duck_scrape_1.VideoLicense.YOUTUBE;
default:
return duck_duck_scrape_1.VideoLicense.ANY;
}
}
function enhanceSearchQuery(query, searchType = 'web') {
let enhancedQuery = query.trim();
if (searchType === 'web') {
if (/^(what|how|why|when|where|who|which|can|could|should|would|will|is|are|do|does|did)\s/i.test(enhancedQuery)) {
}
else if (/\b(buy|purchase|price|cost|review|compare|best|top|vs)\b/i.test(enhancedQuery)) {
if (!enhancedQuery.includes('2025') && !enhancedQuery.includes('2024')) {
enhancedQuery += ' 2025';
}
}
else if (/\b(error|fix|solution|tutorial|guide|how to|install|setup|config)\b/i.test(enhancedQuery)) {
if (!enhancedQuery.includes('2025') && !enhancedQuery.includes('2024')) {
enhancedQuery += ' 2025';
}
}
else if (/\b(news|latest|recent|update|today|now|current)\b/i.test(enhancedQuery)) {
if (!enhancedQuery.includes('2025')) {
enhancedQuery += ' 2025';
}
}
else if (enhancedQuery.split(' ').length <= 2 && enhancedQuery.length > 2) {
if (!/\b(definition|meaning|what is)\b/i.test(enhancedQuery)) {
enhancedQuery = `"${enhancedQuery}"`;
}
}
}
return enhancedQuery;
}
class DuckDuckGo {
constructor() {
this.description = {
displayName: constants_1.NODE_INFO.DISPLAY_NAME,
name: constants_1.NODE_INFO.NAME,
icon: 'file:duckduckgo.svg',
group: ['transform'],
version: constants_1.NODE_INFO.VERSION,
subtitle: '={{$parameter["operation"]}}',
description: constants_1.NODE_INFO.DESCRIPTION,
defaults: {
name: constants_1.NODE_INFO.DISPLAY_NAME,
},
inputs: ['main'],
outputs: ['main'],
credentials: [
{
name: 'duckDuckGoApi',
required: false,
displayOptions: {
show: {
useApiKey: [true],
},
},
},
],
properties: [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
default: types_1.DuckDuckGoOperation.Search,
noDataExpression: true,
required: true,
description: 'Type of search to perform with DuckDuckGo',
options: [
{
name: 'Web Search',
value: types_1.DuckDuckGoOperation.Search,
description: 'Search websites and web content',
action: 'Search the web',
},
{
name: 'Image Search',
value: types_1.DuckDuckGoOperation.SearchImages,
description: 'Find images across the web',
action: 'Search for images',
},
{
name: 'News Search',
value: types_1.DuckDuckGoOperation.SearchNews,
description: 'Discover news articles and updates',
action: 'Search for news',
},
{
name: 'Video Search',
value: types_1.DuckDuckGoOperation.SearchVideos,
description: 'Find videos from various sources',
action: 'Search for videos',
}
],
},
{
displayName: 'Locale',
name: 'locale',
type: 'options',
default: 'en-us',
description: 'Specify the search language/region locale',
options: LOCALE_OPTIONS,
},
{
displayName: 'Use API Key',
name: 'useApiKey',
type: 'boolean',
default: false,
description: 'Whether to use API key authentication for DuckDuckGo API access',
},
{
displayName: 'Search Query',
name: 'query',
type: 'string',
required: true,
default: '',
description: 'The search terms to look for on the web',
placeholder: 'Enter your search query',
displayOptions: {
show: {
operation: [
types_1.DuckDuckGoOperation.Search,
],
},
},
typeOptions: {
minLength: 1,
},
},
{
displayName: 'Web Search Options',
name: 'webSearchOptions',
type: 'collection',
placeholder: 'Add Option',
default: {
maxResults: constants_1.DEFAULT_PARAMETERS.MAX_RESULTS,
region: constants_1.DEFAULT_PARAMETERS.REGION,
safeSearch: constants_1.DEFAULT_PARAMETERS.SAFE_SEARCH,
},
displayOptions: {
show: {
operation: [
types_1.DuckDuckGoOperation.Search,
],
},
},
options: [
{
displayName: 'Maximum Results',
name: 'maxResults',
type: 'number',
default: constants_1.DEFAULT_PARAMETERS.MAX_RESULTS,
description: 'Maximum number of search results to return',
typeOptions: {
minValue: 1,
maxValue: 100,
},
},
{
displayName: 'Region',
name: 'region',
type: 'options',
default: constants_1.DEFAULT_PARAMETERS.REGION,
description: 'The region to target for web search results',
options: constants_1.REGIONS,
},
{
displayName: 'Safe Search',
name: 'safeSearch',
type: 'options',
default: constants_1.DEFAULT_PARAMETERS.SAFE_SEARCH,
description: 'Content filtering level for web search',
options: [
{
name: 'Strict',
value: types_1.SafeSearchLevel.Strict,
description: 'Filter explicit content',
},
{
name: 'Moderate',
value: types_1.SafeSearchLevel.Moderate,
description: 'Default filtering level',
},
{
name: 'Off',
value: types_1.SafeSearchLevel.Off,
description: 'No content filtering',
}
],
},
{
displayName: 'Time Period',
name: 'timePeriod',
type: 'options',
default: types_1.TimePeriod.AllTime,
description: 'Time range for web search results',
options: [
{
name: 'All Time',
value: types_1.TimePeriod.AllTime,
description: 'No time restriction',
},
{
name: 'Past Day',
value: types_1.TimePeriod.PastDay,
description: 'Last 24 hours',
},
{
name: 'Past Week',
value: types_1.TimePeriod.PastWeek,
description: 'Last 7 days',
},
{
name: 'Past Month',
value: types_1.TimePeriod.PastMonth,
description: 'Last 30 days',
},
{
name: 'Past Year',
value: types_1.TimePeriod.PastYear,
description: 'Last 365 days',
},
],
},
{
displayName: 'Return Raw Results',
name: 'returnRawResults',
type: 'boolean',
default: false,
description: 'Whether to return the raw API response instead of processed results',
},
{
displayName: 'Search Backend',
name: 'searchBackend',
type: 'options',
default: 'auto',
description: 'Choose which search backend to use for better reliability',
options: [
{
name: 'Auto (Recommended)',
value: 'auto',
description: 'Automatically tries multiple backends for best results',
},
{
name: 'Duck-Duck-Scrape',
value: 'duck-duck-scrape',
description: 'Primary search engine library',
},
{
name: 'SearchAPI',
value: 'search-api',
description: 'Alternative API-based search',
},
{
name: 'HTML Backend',
value: 'html',
description: 'Direct HTML parsing from html.duckduckgo.com',
},
{
name: 'Lite Backend',
value: 'lite',
description: 'Lightweight search from lite.duckduckgo.com',
},
],
},
{
displayName: 'Use Search Operators',
name: 'useSearchOperators',
type: 'boolean',
default: false,
description: 'Whether to enable advanced search operators',
},
{
displayName: 'Search Operators',
name: 'searchOperators',
type: 'collection',
placeholder: 'Add Search Operator',
default: {},
displayOptions: {
show: {
useSearchOperators: [true],
},
},
description: 'Advanced search operators to refine your search',
options: [
{
displayName: 'Site',
name: 'site',
type: 'string',
default: '',
placeholder: searchOperators_1.OPERATOR_INFO.site.placeholder,
description: `${searchOperators_1.OPERATOR_INFO.site.description}. Example: ${searchOperators_1.OPERATOR_INFO.site.example}`,
},
{
displayName: 'File Type',
name: 'filetype',
type: 'string',
default: '',
placeholder: searchOperators_1.OPERATOR_INFO.filetype.placeholder,
description: `${searchOperators_1.OPERATOR_INFO.filetype.description}. Example: ${searchOperators_1.OPERATOR_INFO.filetype.example}`,
},
{
displayName: 'In Title',
name: 'intitle',
type: 'string',
default: '',
placeholder: searchOperators_1.OPERATOR_INFO.intitle.placeholder,
description: `${searchOperators_1.OPERATOR_INFO.intitle.description}. Example: ${searchOperators_1.OPERATOR_INFO.intitle.example}`,
},
{
displayName: 'In URL',
name: 'inurl',
type: 'string',
default: '',
placeholder: searchOperators_1.OPERATOR_INFO.inurl.placeholder,
description: `${searchOperators_1.OPERATOR_INFO.inurl.description}. Example: ${searchOperators_1.OPERATOR_INFO.inurl.example}`,
},
{
displayName: 'In Body',
name: 'inbody',
type: 'string',
default: '',
placeholder: searchOperators_1.OPERATOR_INFO.inbody.placeholder,
description: `${searchOperators_1.OPERATOR_INFO.inbody.description}. Example: ${searchOperators_1.OPERATOR_INFO.inbody.example}`,
},
{
displayName: 'Exclude Words',
name: 'exclude',
type: 'string',
default: '',
placeholder: searchOperators_1.OPERATOR_INFO.exclude.placeholder,
description: `${searchOperators_1.OPERATOR_INFO.exclude.description}. Example: ${searchOperators_1.OPERATOR_INFO.exclude.example}`,
},
{
displayName: 'Exact Phrase',
name: 'exact',
type: 'string',
default: '',
placeholder: searchOperators_1.OPERATOR_INFO.exact.placeholder,
description: `${searchOperators_1.OPERATOR_INFO.exact.description}. Example: ${searchOperators_1.OPERATOR_INFO.exact.example}`,
},
{
displayName: 'OR Terms',
name: 'or',
type: 'string',
default: '',
placeholder: 'term1, term2, term3',
description: 'Search for any of these terms (comma-separated). Example: python, javascript, typescript',
},
{
displayName: 'Related',
name: 'related',
type: 'string',
default: '',
placeholder: searchOperators_1.OPERATOR_INFO.related.placeholder,
description: `${searchOperators_1.OPERATOR_INFO.related.description}. Example: ${searchOperators_1.OPERATOR_INFO.related.example}`,
},
{
displayName: 'Cache',
name: 'cache',
type: 'string',
default: '',
placeholder: searchOperators_1.OPERATOR_INFO.cache.placeholder,
description: `${searchOperators_1.OPERATOR_INFO.cache.description}. Example: ${searchOperators_1.OPERATOR_INFO.cache.example}`,
},
{
displayName: 'Define',
name: 'define',
type: 'string',
default: '',
placeholder: searchOperators_1.OPERATOR_INFO.define.placeholder,
description: `${searchOperators_1.OPERATOR_INFO.define.description}. Example: ${searchOperators_1.OPERATOR_INFO.define.example}`,
},
{
displayName: 'All In Title',
name: 'allintitle',
type: 'string',
default: '',
placeholder: searchOperators_1.OPERATOR_INFO.allintitle.placeholder,
description: `${searchOperators_1.OPERATOR_INFO.allintitle.description}. Example: ${searchOperators_1.OPERATOR_INFO.allintitle.example}`,
},
{
displayName: 'All In URL',
name: 'allinurl',
type: 'string',
default: '',
placeholder: searchOperators_1.OPERATOR_INFO.allinurl.placeholder,
description: `${searchOperators_1.OPERATOR_INFO.allinurl.description}. Example: ${searchOperators_1.OPERATOR_INFO.allinurl.example}`,
},
{
displayName: 'All In Text',
name: 'allintext',
type: 'string',
default: '',
placeholder: searchOperators_1.OPERATOR_INFO.allintext.placeholder,
description: `${searchOperators_1.OPERATOR_INFO.allintext.description}. Example: ${searchOperators_1.OPERATOR_INFO.allintext.example}`,
},
{
displayName: 'Location',
name: 'location',
type: 'string',
default: '',
placeholder: searchOperators_1.OPERATOR_INFO.location.placeholder,
description: `${searchOperators_1.OPERATOR_INFO.location.description}. Example: ${searchOperators_1.OPERATOR_INFO.location.example}`,
},
{
displayName: 'Language Code',
name: 'language',
type: 'string',
default: '',
placeholder: searchOperators_1.OPERATOR_INFO.language.placeholder,
description: `${searchOperators_1.OPERATOR_INFO.language.description}. Example: ${searchOperators_1.OPERATOR_INFO.language.example}`,
},
],
},
],
},
{
displayName: 'Image Search Query',
name: 'imageQuery',
type: 'string',
required: true,
default: '',
description: 'The search terms to find images for',
placeholder: 'Enter image search query',
displayOptions: {
show: {
operation: [
types_1.DuckDuckGoOperation.SearchImages,
],
},
},
typeOptions: {
minLength: 1,
},
},
{
displayName: 'Image Search Options',
name: 'imageSearchOptions',
type: 'collection',
placeholder: 'Add Option',
default: {
maxResults: constants_1.DEFAULT_PARAMETERS.MAX_RESULTS,
region: constants_1.DEFAULT_PARAMETERS.REGION,
safeSearch: constants_1.DEFAULT_PARAMETERS.SAFE_SEARCH,
},
displayOptions: {
show: {
operation: [
types_1.DuckDuckGoOperation.SearchImages,
],
},
},
options: [
{
displayName: 'Maximum Results',
name: 'maxResults',
type: 'number',
default: constants_1.DEFAULT_PARAMETERS.MAX_RESULTS,
description: 'Maximum number of image results to return',
typeOptions: {
minValue: 1,
maxValue: 100,
},
},
{
displayName: 'Region',
name: 'region',
type: 'options',
default: constants_1.DEFAULT_PARAMETERS.REGION,
description: 'The region to target for image search',
options: constants_1.REGIONS,
},
{
displayName: 'Safe Search',
name: 'safeSearch',
type: 'options',
default: constants_1.DEFAULT_PARAMETERS.SAFE_SEARCH,
description: 'Content filtering level for images',
options: [
{
name: 'Strict',
value: types_1.SafeSearchLevel.Strict,
description: 'Filter explicit images',
},
{
name: 'Moderate',
value: types_1.SafeSearchLevel.Moderate,
description: 'Default filtering level',
},
{
name: 'Off',
value: types_1.SafeSearchLevel.Off,
description: 'No image filtering',
}
],
},
{
displayName: 'Return Raw Results',
name: 'returnRawResults',
type: 'boolean',
default: false,
description: 'Whether to return the raw API response instead of processed results',
},
],
},
{
displayName: 'News Search Query',
name: 'newsQuery',
type: 'string',
required: true,
default: '',
description: 'The search terms to find news articles for',
placeholder: 'Enter news search query',
displayOptions: {
show: {
operation: [
types_1.DuckDuckGoOperation.SearchNews,
],
},
},
typeOptions: {
minLength: 1,
},
},
{
displayName: 'News Search Options',
name: 'newsSearchOptions',
type: 'collection',
placeholder: 'Add Option',
default: {
maxResults: constants_1.DEFAULT_PARAMETERS.MAX_RESULTS,
region: constants_1.DEFAULT_PARAMETERS.REGION,
safeSearch: constants_1.DEFAULT_PARAMETERS.SAFE_SEARCH,
},
displayOptions: {
show: {
operation: [
types_1.DuckDuckGoOperation.SearchNews,
],
},
},
options: [
{
displayName: 'Maximum Results',
name: 'maxResults',
type: 'number',
default: constants_1.DEFAULT_PARAMETERS.MAX_RESULTS,
description: 'Maximum number of news articles to return',
typeOptions: {
minValue: 1,
maxValue: 100,
},
},
{
displayName: 'Region',
name: 'region',
type: 'options',
default: constants_1.DEFAULT_PARAMETERS.REGION,
description: 'The region to target for news',
options: constants_1.REGIONS,
},
{
displayName: 'Safe Search',
name: 'safeSearch',
type: 'options',
default: constants_1.DEFAULT_PARAMETERS.SAFE_SEARCH,
description: 'Content filtering level for news articles',
options: [
{
name: 'Strict',
value: types_1.SafeSearchLevel.Strict,
description: 'Filter explicit content',
},
{
name: 'Moderate',
value: types_1.SafeSearchLevel.Moderate,
description: 'Default filtering level',
},
{
name: 'Off',
value: types_1.SafeSearchLevel.Off,
description: 'No content filtering',
}
],
},
{
displayName: 'Time Period',
name: 'timePeriod',
type: 'options',
default: types_1.TimePeriod.PastWeek,
description: 'Time range for news articles',
options: [
{
name: 'All Time',
value: types_1.TimePeriod.AllTime,
description: 'No time restriction',
},
{
name: 'Past Day',
value: types_1.TimePeriod.PastDay,
description: 'Last 24 hours',
},
{
name: 'Past Week',
value: types_1.TimePeriod.PastWeek,
description: 'Last 7 days',
},
{
name: 'Past Month',
value: types_1.TimePeriod.PastMonth,
description: 'Last 30 days',
},
{
name: 'Past Year',
value: types_1.TimePeriod.PastYear,
description: 'Last 365 days',
},
],
},
{
displayName: 'Return Raw Results',
name: 'returnRawResults',
type: 'boolean',
default: false,
description: 'Whether to return the raw API response instead of processed results',
},
],
},
{
displayName: 'Video Search Query',
name: 'videoQuery',
type: 'string',
required: true,
default: '',
description: 'The search terms to find videos for',
placeholder: 'Enter video search query',
displayOptions: {
show: {
operation: [
types_1.DuckDuckGoOperation.SearchVideos,
],
},
},
typeOptions: {
minLength: 1,
},
},
{
displayName: 'Video Search Options',
name: 'videoSearchOptions',
type: 'collection',
placeholder: 'Add Option',
default: {
maxResults: constants_1.DEFAULT_PARAMETERS.MAX_RESULTS,
region: constants_1.DEFAULT_PARAMETERS.REGION,
safeSearch: constants_1.DEFAULT_PARAMETERS.SAFE_SEARCH,
},
displayOptions: {
show: {
operation: [
types_1.DuckDuckGoOperation.SearchVideos,
],
},
},
options: [
{
displayName: 'Maximum Results',
name: 'maxResults',
type: 'number',
default: constants_1.DEFAULT_PARAMETERS.MAX_RESULTS,
description: 'Maximum number of videos to return',
typeOptions: {
minValue: 1,
maxValue: 100,
},
},
{
displayName: 'Region',
name: 'region',
type: 'options',
default: constants_1.DEFAULT_PARAMETERS.REGION,
description: 'The region to target for videos',
options: constants_1.REGIONS,
},
{
displayName: 'Safe Search',
name: 'safeSearch',
type: 'options',
default: constants_1.DEFAULT_PARAMETERS.SAFE_SEARCH,
description: 'Content filtering level for videos',
options: [
{
name: 'Strict',
value: types_1.SafeSearchLevel.Strict,
description: 'Filter explicit videos',
},
{
name: 'Moderate',
value: types_1.SafeSearchLevel.Moderate,
description: 'Default filtering level',
},
{
name: 'Off',
value: types_1.SafeSearchLevel.Off,
description: 'No video filtering',
}
],
},
{
displayName: 'Return Raw Results',
name: 'returnRawResults',
type: 'boolean',
default: false,
description: 'Whether to return the raw API response instead of processed results',
},
],
},
{
displayName: 'Error Handling',
name: 'errorHandling',
type: 'options',
default: 'continueOnFail',
description: 'How errors should be handled',
options: [
{
name: 'Break on Error',
value: 'breakOnError',
description: 'Stop executing when an error occurs',
},
{
name: 'Continue on Error',
value: 'continueOnFail',
description: 'Continue execution even when errors occur',
},
],
},
{
displayName: 'Debug Mode',
name: 'debugMode',
type: 'boolean',
default: false,
description: 'When enabled, includes detailed request and response information for troubleshooting',
},
{
displayName: 'Cache Settings',
name: 'cacheSettings',
type: 'collection',
placeholder: 'Add Cache Setting',
default: {
cacheTTL: 300,
enableCache: true,
},
options: [
{
displayName: 'Enable Cache',
name: 'enableCache',
type: 'boolean',
default: true,
description: 'Whether to cache search results to improve performance for repeated queries',
},
{
displayName: 'Cache TTL',
name: 'cacheTTL',
type: 'number',
default: 300,
description: 'Time in seconds to keep results in cache (Time-To-Live)',
typeOptions: {
minValue: 60,
maxValue: 86400,
},
},
],
},
{
displayName: 'Enable Telemetry',
name: 'enableTelemetry',
type: 'boolean',
default: false,
description: 'Whether to send anonymous usage data to help improve the node (no personal data is collected)',
},
{
displayName: 'Proxy Settings',
name: 'proxySettings',
type: 'collection',
placeholder: 'Add Proxy Setting',
default: {},
description: 'Configure proxy for all requests',
options: [
{
displayName: 'Use Proxy',
name: 'useProxy',
type: 'boolean',
default: false,
description: 'Whether to use a proxy for requests',
},
{
displayName: 'Proxy Type',
name: 'proxyType',
type: 'options',
default: 'http',
description: 'Type of proxy to use',
options: [
{
name: 'HTTP',
value: 'http',
},
{
name: 'HTTPS',
value: 'https',
},
{
name: 'SOCKS4',
value: 'socks4',
},
{
name: 'SOCKS5',
value: 'socks5',
},
],
displayOptions: {
show: {
useProxy: [true],
},
},
},
{
displayName: 'Proxy Host',
name: 'proxyHost',
type: 'string',
default: '',
placeholder: 'proxy.example.com',
description: 'Hostname or IP address of the proxy server',
displayOptions: {
show: {
useProxy: [true],
},
},
},
{
displayName: 'Proxy Port',
name: 'proxyPort',
type: 'number',
default: 8080,
description: 'Port number of the proxy server',
typeOptions: {
minValue: 1,
maxValue: 65535,
},
displayOptions: {
show: {
useProxy: [true],
},
},
},
{
displayName: 'Proxy Authentication',
name: 'proxyAuth',
type: 'boolean',
default: false,
description: 'Whether the proxy requires authentication',
displayOptions: {
show: {
useProxy: [true],
},
},
},
{
displayName: 'Proxy Username',
name: 'proxyUsername',
type: 'string',
default: '',
description: 'Username for proxy authentication',
displayOptions: {
show: {
useProxy: [true],
proxyAuth: [true],
},
},
},
{
displayName: 'Proxy Password',
name: 'proxyPassword',
type: 'string',
typeOptions: {