n8n-nodes-duckduckgo-search 30.0.4 → 30.0.5

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.
@@ -59,16 +59,6 @@ const LOCALE_OPTIONS = [
59
59
  function sleep(ms) {
60
60
  return new Promise(resolve => setTimeout(resolve, ms));
61
61
  }
62
- function getRandomUserAgent() {
63
- const userAgents = [
64
- 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1',
65
- 'Mozilla/5.0 (Linux; Android 14; SM-G998U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Mobile Safari/537.36',
66
- 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
67
- 'Mozilla/5.0 (Macintosh; Intel Mac OS X 14_0) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15',
68
- 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0',
69
- ];
70
- return userAgents[Math.floor(Math.random() * userAgents.length)];
71
- }
72
62
  function getSafeSearchType(value) {
73
63
  switch (value) {
74
64
  case 0:
@@ -1211,7 +1201,7 @@ class DuckDuckGo {
1211
1201
  url: htmlUrl,
1212
1202
  method: 'GET',
1213
1203
  headers: {
1214
- 'User-Agent': getRandomUserAgent(),
1204
+ 'User-Agent': constants_1.BROWSER_USER_AGENT,
1215
1205
  },
1216
1206
  });
1217
1207
  const page = parseHtmlResults(html);
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.searchVideosWithAPI = exports.searchNewsWithAPI = exports.searchImagesWithAPI = exports.searchWithAPI = exports.SearchAPIClient = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
+ const constants_1 = require("./constants");
8
9
  class SearchAPIClient {
9
10
  constructor(apiKey) {
10
11
  this.baseUrl = 'https://www.searchapi.io/api/v1/search';
@@ -30,7 +31,8 @@ class SearchAPIClient {
30
31
  const headers = {
31
32
  'Authorization': `Bearer ${this.apiKey}`,
32
33
  'Content-Type': 'application/json',
33
- 'User-Agent': 'n8n-duckduckgo-node/1.0'
34
+ 'User-Agent': constants_1.BROWSER_USER_AGENT,
35
+ 'Accept': 'application/json',
34
36
  };
35
37
  try {
36
38
  const response = await axios_1.default.get(url.toString(), {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NODE_INFO = exports.DEFAULT_PARAMETERS = exports.REGIONS = void 0;
3
+ exports.BROWSER_USER_AGENT = exports.NODE_INFO = exports.DEFAULT_PARAMETERS = exports.REGIONS = void 0;
4
4
  exports.REGIONS = [
5
5
  { name: 'Argentina', value: 'ar-es' },
6
6
  { name: 'Australia', value: 'au-en' },
@@ -63,3 +63,4 @@ exports.NODE_INFO = {
63
63
  VERSION: 1,
64
64
  DESCRIPTION: 'Search using DuckDuckGo',
65
65
  };
66
+ exports.BROWSER_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36';
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getSafeSearchString = exports.directImageSearch = exports.directWebSearch = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
+ const constants_1 = require("./constants");
8
9
  function cleanText(text) {
9
10
  return text
10
11
  .replace(/ /g, ' ')
@@ -28,7 +29,7 @@ async function directWebSearch(query, options = {}) {
28
29
  kp: options.safeSearch === 'strict' ? '1' : options.safeSearch === 'moderate' ? '-1' : '-2',
29
30
  }), {
30
31
  headers: {
31
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
32
+ 'User-Agent': constants_1.BROWSER_USER_AGENT,
32
33
  'Content-Type': 'application/x-www-form-urlencoded',
33
34
  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
34
35
  'Accept-Language': 'en-US,en;q=0.9',
@@ -93,7 +94,7 @@ async function directImageSearch(query, options = {}) {
93
94
  const searchUrl = `https://duckduckgo.com/?${searchParams.toString()}`;
94
95
  const response = await axios_1.default.get(searchUrl, {
95
96
  headers: {
96
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
97
+ 'User-Agent': constants_1.BROWSER_USER_AGENT,
97
98
  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
98
99
  'Accept-Language': 'en-US,en;q=0.9',
99
100
  'Accept-Encoding': 'gzip, deflate, br',
@@ -123,7 +124,7 @@ async function directImageSearch(query, options = {}) {
123
124
  });
124
125
  const imageResponse = await axios_1.default.get(`https://duckduckgo.com/i.js?${imageParams.toString()}`, {
125
126
  headers: {
126
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
127
+ 'User-Agent': constants_1.BROWSER_USER_AGENT,
127
128
  'Accept': 'application/json, text/javascript, */*; q=0.01',
128
129
  'Accept-Language': 'en-US,en;q=0.9',
129
130
  'Accept-Encoding': 'gzip, deflate, br',
@@ -7,6 +7,7 @@ exports.fallbackVideoSearch = exports.fallbackNewsSearch = exports.fallbackImage
7
7
  const duck_duck_scrape_1 = require("duck-duck-scrape");
8
8
  const apiClient_1 = require("./apiClient");
9
9
  const axios_1 = __importDefault(require("axios"));
10
+ const constants_1 = require("./constants");
10
11
  async function searchWithFallback(query, options = {}) {
11
12
  try {
12
13
  const result = await (0, duck_duck_scrape_1.search)(query, options);
@@ -114,7 +115,7 @@ async function fallbackWebSearch(query, options = {}) {
114
115
  });
115
116
  const response = await axios_1.default.get(`${searchUrl}?${params.toString()}`, {
116
117
  headers: {
117
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
118
+ 'User-Agent': constants_1.BROWSER_USER_AGENT,
118
119
  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
119
120
  'Accept-Language': 'en-US,en;q=0.5',
120
121
  'Accept-Encoding': 'gzip, deflate, br',
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.multiBackendSearch = exports.MultiBackendDuckDuckGoSearch = exports.Backend = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
+ const constants_1 = require("./constants");
8
9
  const duck_duck_scrape_1 = require("duck-duck-scrape");
9
10
  const apiClient_1 = require("./apiClient");
10
11
  var Backend;
@@ -191,7 +192,7 @@ class MultiBackendDuckDuckGoSearch {
191
192
  }), {
192
193
  headers: {
193
194
  'Referer': 'https://html.duckduckgo.com/',
194
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
195
+ 'User-Agent': constants_1.BROWSER_USER_AGENT,
195
196
  'Content-Type': 'application/x-www-form-urlencoded'
196
197
  },
197
198
  timeout: 15000
@@ -218,7 +219,7 @@ class MultiBackendDuckDuckGoSearch {
218
219
  }), {
219
220
  headers: {
220
221
  'Referer': 'https://lite.duckduckgo.com/',
221
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
222
+ 'User-Agent': constants_1.BROWSER_USER_AGENT,
222
223
  'Content-Type': 'application/x-www-form-urlencoded'
223
224
  },
224
225
  timeout: 15000
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-duckduckgo-search",
3
- "version": "30.0.4",
3
+ "version": "30.0.5",
4
4
  "description": "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.",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-duckduckgo-search",
3
- "version": "30.0.4",
3
+ "version": "30.0.5",
4
4
  "description": "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.",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",