前不久查询资料浏览器老是推知乎的回答,众所周知,知乎屏蔽了未登录用户,未登录仅给你看一半,打开开发者都没招,既然解决不了问题,那就解决知乎!!!
未登录状态
未添加过滤代码,开篇就是知乎
添加过滤代码
总不能每次都在搜索框后面加 -site:zhihu.com 吧,我这里写了一个脚本,只需要安装拓展《篡改猴》
这是已经安装好的
点击添加新脚本
将脚本添加即可
脚本
// ==UserScript==
// @name 屏蔽知乎结果
// @version 0.0.1
// @description 自动屏蔽搜索引擎结果中的知乎链接
// @license MIT
// @author You
// @include /^https?://(www|cse)\.google(\.\w+)+/search\?.*$/
// @include /^https?://(www\.)?bing\.com/search\?.*$/
// @include /^https?://(www\.)?baidu\.com/search\?.*$/
// @include /^https?://(www\.)?duckduckgo\.com/\?q=.*$/
// @run-at document-start
// @grant none
// @compatible chrome >= 49
// @compatible firefox >= 29
// @compatible opera >= 46
// @compatible safari >= 10.1
// ==/UserScript==
(function () {
'use strict';
// 获取当前页面的查询参数
const params = new URLSearchParams(location.search);
const q = params.get("q"); // 搜索关键词
// 定义需要屏蔽的关键词(以知乎为例,可以扩展为多个)
const blockSites = ["-site:zhihu.com"];
// 检查并更新查询参数
if (q) {
// 确保屏蔽关键词未包含在查询中
const missingBlocks = blockSites.filter(site => !q.includes(site));
if (missingBlocks.length > 0) {
// 添加缺失的屏蔽关键词
params.set("q", q + " " + missingBlocks.join(" "));
location.search = "?" + params.toString(); // 更新 URL 并刷新页面
}
}
})();