From 9c07ee90d48c18608c14d17d8413ccb60df5a9a1 Mon Sep 17 00:00:00 2001 From: Hojjat Kamyabi <52712133+HojjatKamyabi@users.noreply.github.com> Date: Sun, 13 Sep 2026 22:26:31 +0000 Subject: [PATCH] Add separate bot for DuckDuckGo No-AI and updated seach section selector for duckduckgo --- src/content/ContentHandler.js | 9 +++++++-- src/content/bot/DuckDuckGoBot.js | 2 +- src/content/bot/DuckDuckGoNoAIBot.js | 7 +++++++ 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/content/bot/DuckDuckGoNoAIBot.js diff --git a/src/content/ContentHandler.js b/src/content/ContentHandler.js index 203dd2ac..6b060b77 100644 --- a/src/content/ContentHandler.js +++ b/src/content/ContentHandler.js @@ -2,6 +2,7 @@ import GoogleBot from './bot/GoogleBot'; import GoogleConsentBot from './bot/GoogleConsentBot'; import YahooConsentBot from './bot/YahooConsentBot'; import DuckDuckGoBot from './bot/DuckDuckGoBot'; +import DuckDuckGoNoAIBot from './bot/DuckDuckGoNoAIBot'; import YandexBot from './bot/YandexBot'; import BingBot from './bot/BingBot'; import YahooBot from './bot/YahooBot'; @@ -77,8 +78,12 @@ export default class ContentHandler { // otherwise default to google if (this.debug) console.log('GoogleBot'); return GoogleBot; - }else if(str =='duckduckgo'){ - if (this.debug) console.log('DuckDuckGoBot'); + }else if(str == "duckduckgo") { + if (window.location.hostname == "noai.duckduckgo.com") { + if (this.debug) console.log("DuckDuckGoNoAIBot"); + return DuckDuckGoNoAIBot; + } + if (this.debug) console.log("DuckDuckGoBot"); return DuckDuckGoBot; }else if(str =='yandex'){ if (this.debug) console.log('YandexBot'); diff --git a/src/content/bot/DuckDuckGoBot.js b/src/content/bot/DuckDuckGoBot.js index 604b0825..9a8f84ff 100644 --- a/src/content/bot/DuckDuckGoBot.js +++ b/src/content/bot/DuckDuckGoBot.js @@ -130,7 +130,7 @@ export default class DuckDuckGoBot extends Bot{ } get_search_input() { - return document.querySelector('#searchbox_input, input[name="q"], input[type="search"]'); + return document.querySelector('#searchbox_homepage > div > textarea'); } is_text_result_page(){ diff --git a/src/content/bot/DuckDuckGoNoAIBot.js b/src/content/bot/DuckDuckGoNoAIBot.js new file mode 100644 index 00000000..21228b8a --- /dev/null +++ b/src/content/bot/DuckDuckGoNoAIBot.js @@ -0,0 +1,7 @@ +import DuckDuckGoBot from "./DuckDuckGoBot"; + +export default class DuckDuckGoNoAIBot extends DuckDuckGoBot { + get_search_input() { + return document.querySelector('#searchbox_input, input[name="q"], input[type="search"]'); + } +} \ No newline at end of file