Google Search Spam Filter

removes blacklisted search results

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name            Google Search Spam Filter
// @name:ru         Фильтр спама в результатах поиска Google
// @description     removes blacklisted search results
// @description:ru  скрывает ненужные результаты в выдаче
// @namespace       https://www.google.com/search
// @include         /^https?://(www\.)?google\.\w+//
// @copyright       2018, StSav012
// @author          StSav012
// @grant           none
// @version         0.1.20210411.2
// @run-at          document-end
// ==/UserScript==

/* jshint esversion: 6 */
/* jshint browser: true */

"use strict";

// blacklisted URLs
var spamURLs = ['http://qaru.site/', 'https://stackoverrun.com/', 'https://manjaro.ru/', 'https://qastack.ru/', 'https://coderoad.ru/',
                'https://overcoder.net/', 'https://overcoder.net:8443/', 'https://www.coder.work/', 'https://helpexe.ru', 'https://www.dvhu.com/',
                'http://doc.crossplatform.ru/', 'https://quares.ru/', 'https://www.cnpython.com/', 'http://hk.uwenku.com/', 'https://www.debugcn.com/',
                'https://tr.coredump.biz/', 'https://www.thinbug.com/', 'https://cloud6.net/'];

for (let u of spamURLs) {
  var junk = document.querySelectorAll('div a[href^="' + u + '"]:not([class])');
  for (let j of junk) {
    var p = j.parentNode;
    while (p.tagName == 'DIV' && !p.classList.contains('g')) {
      p = p.parentNode;
    }
    // console.log('found', p);
    p.parentNode.removeChild(p);
  }
}