Fiddler:用程序将单词添加到查询字符串中



请注意,我是Fiddler 的新手

我的目的:我想使用Fiddler作为谷歌搜索过滤器

摘要

我厌倦了每次使用谷歌时手动添加"狗"。我不希望"狗"出现在我的搜索结果中。

例如:

//www.google.com/search?q=猫+-dog

//www.google.com/search?q=棒球+-dog

代码

dog替换为-torrent-watch-download

// ==UserScript==
// @name       Tamper with Google Results
// @namespace  http://superuser.com/users/145045/krowe
// @version    0.1
// @description  This just modifies google results to exclude certain things.
// @match      http://*.google.com
// @match      https://*.google.com
// @copyright  2014+, KRowe
// ==/UserScript==

function GM_main () {
    window.onload = function () {
      var targ = window.location;
      if(targ && targ.href && targ.href.match('https?://www.google.com/.+#q=.+') && targ.href.search("/+-torrent/+-watch/+-download")==-1) {
        targ.href = targ.href +"+-torrent+-watch+-download";
      }
    };
}
//-- This is a standard-ish utility function:
function addJS_Node(text, s_URL, funcToRun, runOnLoad) {
    var D=document, scriptNode = D.createElement('script');
    if(runOnLoad) scriptNode.addEventListener("load", runOnLoad, false);
    scriptNode.type = "text/javascript";
    if(text) scriptNode.textContent = text;
    if(s_URL) scriptNode.src = s_URL;
    if(funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()';
    var targ = D.getElementsByTagName('head')[0] || D.body || D.documentElement;
    targ.appendChild(scriptNode);
}
addJS_Node (null, null, GM_main);

起初我打算使用Tampermonkey用户脚本,因为我不知道Fiddler

=================================================

现在,让我们关注Fiddler

请求前

我希望Fiddler在Google查询字符串的末尾添加文本。

有人建议我使用

静态函数OnBeforeRequest(oSession:Session){

    if (oSession.uriContains("targetString")) {
          var sText = "Enter a string to append to a URL";
          oSession.fullUrl = oSession.fullUrl + sText;
    }
}

响应前

这就是我的问题所在

我非常喜欢HTML响应,现在我只想在不更改搜索结果的情况下在搜索框中抓取/隐藏单词。如何做到这一点?有什么想法吗?

https://i.stack.imgur.com/4mUSt.jpg

你们能接受以上信息并为我解决问题吗?

感谢

基于上述目标定义,我相信您可以使用自己的免费谷歌自定义搜索引擎服务获得更好的结果。特别是,因为你可以控制普通中等教育证书的微调结果,这些结果由谷歌常规搜索返回。

链接:

https://www.google.com/cse/all

https://developers.google.com/custom-search/docs/structured_search

最新更新