10

Using DuckDuckGo, it's possible to temporarily remove a specific site from search results by adding -site:example.com to the search query.

Is there a way to permanently block/blacklist/exclude undesired websites from search results? I didn't find anything in the DDG settings but maybe there is some Greasemonkey script or Firefox extension out there that could do the trick?

  • You§re asking for script recommendation... Use google for that. – Tomáš Zato - Reinstate Monica Aug 29 '16 at 12:06
  • 2
    no, i'm asking for any kind of way to achieve this. exactly like this question (about a different search engine) which has 49 upvotes at the time of writing this. if there's something wrong with my question, then there's something wrong with that one as well. – foerno Aug 29 '16 at 12:28
  • 1
    This question is okay, since there's a definite problem to be solved. A script or extension is just one way to do it. Obviously the Asker is open to any sort of solution. – ale Aug 29 '16 at 12:45
  • That said, @foerno, you should have a look at How do I ask a question that may require recommending a web app? – ale Aug 29 '16 at 13:49
3

With a standard URL rewrite/redirect pattern, you could use a Greasemonkey/Tampermonkey/generic userscript like:

// ==UserScript==
// @name        DuckDuckGo, Always add certain search parameters
// @match       *://*.duckduckgo.com/*
// @run-at      document-start
// @noframes
// @grant       none
// ==/UserScript==

//--- SET THIS NEXT VARIABLE TO TASTE.
var stickySrchTerm  = "-site:wikipedia.org";

var stckySrchEncdd  = encodeURIComponent (stickySrchTerm);
var oldUrlSearch    = location.search;

//--- Test that haven't already redirected.
if ( ! oldUrlSearch.includes (stckySrchEncdd) ) {
    //--- Our term must go in the `q=` portion of `location.search`.
    var srchParams  = oldUrlSearch.split ("&");
    for (var J = 0, L = srchParams.length;  J < L;  J++) {
        if (/^\??q=/.test (srchParams[J]) ) {
            srchParams[J] += "+" + stckySrchEncdd;
            break;
        }
    }
    var newUrlSearch    = srchParams.join ("&");
    var newURL          = location.protocol + "//"
                        + location.host
                        + location.pathname
                        + newUrlSearch
                        + location.hash
                        ;
    /*-- replace() puts the good page in the history instead of the
        bad page.
    */
    location.replace (newURL);
}
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.