Smart Redirect to DuckDuckGo (Auto Language with Fallback)

Gerçek aramaları hızlıca DuckDuckGo'ya yönlendirir. Tarayıcı dilini algılar, geçerli değilse İngilizce (en-us) kullanır 🌍🚀🔥

当前为 2025-04-26 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Smart Redirect to DuckDuckGo (Auto Language with Fallback)
  3. // @namespace https://github.com/MehmetCanWT
  4. // @version 1.5
  5. // @description Gerçek aramaları hızlıca DuckDuckGo'ya yönlendirir. Tarayıcı dilini algılar, geçerli değilse İngilizce (en-us) kullanır 🌍🚀🔥
  6. // @author Mehmet
  7. // @match *://www.google.*/*
  8. // @match *://www.bing.com/*
  9. // @match *://yandex.com/*
  10. // @match *://yandex.com.tr/*
  11. // @grant none
  12. // @run-at document-start
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17.  
  18. const url = new URL(window.location.href);
  19.  
  20. const isGoogleSearch = url.hostname.includes('google.') && url.pathname === '/search';
  21. const isBingSearch = url.hostname.includes('bing.com') && url.pathname === '/search';
  22. const isYandexSearch = url.hostname.includes('yandex.') && url.pathname === '/search/';
  23.  
  24. if (isGoogleSearch || isBingSearch || isYandexSearch) {
  25. const query = url.searchParams.get('q') || url.searchParams.get('text');
  26.  
  27. if (query) {
  28. // Tarayıcı dilini al
  29. let language = navigator.language ? navigator.language.toLowerCase() : '';
  30.  
  31. // Geçerli dil mi kontrol et (örnek: tr-tr, en-us vs.)
  32. const validLangPattern = /^[a-z]{2}-[a-z]{2}$/;
  33. if (!validLangPattern.test(language)) {
  34. language = 'en-us'; // Geçerli değilse İngilizce yap
  35. }
  36.  
  37. const duckduckgoURL = `https://duckduckgo.com/?q=${encodeURIComponent(query)}&kl=${encodeURIComponent(language)}`;
  38.  
  39. window.location.replace(duckduckgoURL);
  40. }
  41. }
  42. })();