// ==UserScript==
// @name 必应搜索过滤
// @namespace huelse/js-scripts/bing-filter
// @version 1.0.1.2
// @description 过滤必应和谷歌的搜索结果。包括几个不方便的网站、国内假新闻站和个人需要临时忽略的网站的过滤。
// @author limbopro
// @license MIT
// @match https://www.google.com/search*
// @match https://www.google.com.hk/search*
// @match https://www.bing.com/search*
// @match https://cn.bing.com/search*
// @match https://www.bing.com/?FORM*
// @icon https://www.bing.com/favicon.ico
// @run-at document-end
// @grant none
// ==/UserScript==
/* 源码地址
// https://limbopro.com/Adguard/contentFarm/contentFarm.js 每日更新;供 Quantumult X / Surge 等代理软件调用;
// https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/Adguard/contentFarm/contentFarm.js push 后更新至GitHub 方便查看历史更新内容
*/
/*
Written by limbopro
https://limbopro.com/archives/block-contentfarm.html
https://t.me/Adblock4limbo
There are 7179 content farm domains in total until now.
Last updated at 31/5月/2024/23:12
*/
/*
Google TxT Ads block
*/
function contentFarm_AdsRemove_Auto(){
//var ads_cssSelectors = [
//"[data-text-ad]",
//"#tvcap"
//];
//var ads_List = document.querySelectorAll( ads_cssSelectors );
//if (ads_List.length >0) {
//for (xyz = 0; xyz < ads_List.length; xyz++){
//ads_List[xyz].style.display = "none";
//}
//}
/*
var ads_cssSelectors = ["[data-text-ad],#tvcap"];
var ads_List = document.querySelectorAll( ads_cssSelectors );
var ads_Block;
for (ads_Block = 0; ads_Block < ads_List.length; ads_Block++){
ads_List[ads_Block].style.display = "none";
}
*/
/*
content farm domains list.
*/
var ads_host = [
".pc6.com",
".jb51.net",
"://myqqjd.com",
".sensetime.com",
".elecfans.com",
".shangyexinzhi.com",
"://aigcdaily.cn",
".guancha.cn",
".people.com.cn",
".pdnews.cn",
".cctv.cn",
".cctv.com",
".news.cn",
".huanqiu.com",
".china.com.cn",
".china.com",
".hunantoday.cn",
"://chinareform.net",
".szhgh.com",
".m4.cn",
".fx168news.com",
".youth.cn",
"://qbitai.com",
"://zhenyes.com",
".bbtnews.com.cn",
".caijing.com.cn",
".10jqka.com.cn",
".jrj.com.cn",
".mydrivers.com",
".scol.com.cn",
".cnstock.com",
".eastmoney.com",
".qianzhan.com",
".xinmin.cn",
".sqxfw.net",
".chanyejiawang.com",
".baai.ac.cn",
"://tre6.com",
"://mnsac.com",
"://shengco.com.cn",
".wyzxwk.com",
//"://dictionary.cambridge.org",
"https://weidown.com",
".xinhuanet.com",
".chinadaily.com.cn",
".uivita.com",
".dedaozhishi.cn",
".chinanews.com.cn",
".hswh.org.cn",
".stdaily.com",
".962.net",
".kxdw.com",
".jb51.net",
".xitongzhijia.net",
".pcsoft.com.cn",
"https://www.msn.cn/zh-cn/news/",
".gushiwen.cn",
"://zditect.com",
".whatthefuck.wtf"
//"csdn.net"
];
var search_results_css = [
"li.b_algo", // bing 搜索结果样式
".mnr-c.xpd.O9g5cc.uUPGi", // Google 富文本搜索结果 style
"div[data-sokoban-grid]", // 通用
"div.Ww4FFb.vt6azd.xpd.EtOod.pkphOe", // 新增 2023.08.27
"div.g", // Google PC 搜索结果样式
"div[class='g'][data-hveid]", // 这是谷歌PC端搜索结果页的 style
"div[class='mnr-c g'][data-hveid]", // 这是谷歌手机端搜索结果页的 style
"div[class][data-sokoban-container]"// 最后一个选择器也不需要逗号结尾
]
var i, x;
setTimeout(() => {
var huge = document.querySelectorAll(search_results_css);
console.log("捕获" + huge.length + "个有效样式!")
for (i = 0; i < ads_host.length; i++) {
var ads_host_css = "[href*='" + ads_host[i] + "']";
for (x = 0; x < huge.length; x++) {
if (huge[x].querySelectorAll(ads_host_css).length) {
huge[x].remove();
console.log(huge[x].textContent + " -> 涉及内容农场!已移除!")
}
}
}
}, 500);
timecount +=1;
console.log("循环第" + timecount + "次")
if (timecount === 1) {
clearInterval(id);
console.log("循环结束!")
}
}
contentFarm_AdsRemove_Auto();
var timecount = 0;
var id = setInterval(contentFarm_AdsRemove_Auto, 1000);