-1

请善待,我是 Fiddler 的新手

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

摘要

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

例如:

//www.google.com/search?q=cat+-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 Query 字符串的末尾添加文本。

有人建议我使用

静态函数 OnBeforeRequest(oSession: Session) {

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

回复前

这就是我的问题所在

我非常喜欢 HTML 响应,现在我只想在不更改搜索结果的情况下刮掉/隐藏搜索框中的单词。怎么办?有任何想法吗?

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

你们能不能把上面的信息给我解决一下

谢谢

4

1 回答 1

0

根据上面的目标定义,我相信您可以使用自己的免费 G​​oogle 自定义搜索引擎服务获得更好的结果。特别是,因为您可以控制由常规 Google 搜索返回的 GCSE 微调结果。

链接:

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

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

于 2014-09-07T07:00:03.253 回答