将 URL 参数添加到 Firefox 的 DuckDuckGo 搜索插件

发布于 2024-10-07 10:18:59 字数 931 浏览 8 评论 0原文

以下是对 DuckDuckGo 进行基本 https 查询的 xml 文件:

<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>Duck Duck Go (SSL)</os:ShortName>
<os:Description>Search Duck Duck Go (SSL)</os:Description>
<os:InputEncoding>UTF-8</os:InputEncoding>
<os:Image width="16" height="16">data:image/x-icon;base64,[*redacted image code*]</os:Image>
<os:Url type="text/html" method="GET" template="https://duckduckgo.com/?q={searchTerms}">
</os:Url>
</SearchPlugin>

我想要某些参数(即 kb=-1 和 kg=p (链接)) 附加到通过 Firefox 搜索框执行的搜索。我尝试使用“”添加它,但这不起作用。

另外,虽然添加 kg=p 将使用 POST (而不是 GET)发出所有后续请求,但我如何使第一个请求成为 POST 请求。我尝试将 method="GET" 更改为 "POST",但这不起作用。

Here is the xml file for a basic https query to DuckDuckGo:

<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>Duck Duck Go (SSL)</os:ShortName>
<os:Description>Search Duck Duck Go (SSL)</os:Description>
<os:InputEncoding>UTF-8</os:InputEncoding>
<os:Image width="16" height="16">data:image/x-icon;base64,[*redacted image code*]</os:Image>
<os:Url type="text/html" method="GET" template="https://duckduckgo.com/?q={searchTerms}">
</os:Url>
</SearchPlugin>

I want to have certain parameters (namely, kb=-1 and kg=p (link)) append to a search that's performed through Firefox's search box. I've tried adding it using "<Param name="paramName1" value="paramValue1"/>" but that doesn't work.

Also, although adding kg=p will make all subsequent requests using POST (rather than GET), how can I make the initial one a POST request. I tried changing method="GET" to "POST", but that doesn't work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

∞梦里开花 2024-10-14 10:18:59

您可以使用:

<os:Url type="text/html" method="GET" template="https://duckduckgo.com/?paramName1=paramValue1&q={searchTerms}">

对所有出现的 & 使用 & 来分隔参数,并对其他字符进行 URL 编码。

You can use:

<os:Url type="text/html" method="GET" template="https://duckduckgo.com/?paramName1=paramValue1&q={searchTerms}">

Use & for all occurrences of & that would separate parameters, and URL-encode other characters.

醉殇 2024-10-14 10:18:59

我在最新版本的firefox中找到了一种方法:
Windows 10 和 Windows 10 Firefox 40.0.3

  • 关闭 Firefox 的所有会话。
  • 最终删除C:\Users\"¤¤"\Appdata\Roaming\Mozilla\Firefox\Profiles\"¤¤"\search.json(如果这样做,您必须重新启动并再次关闭 Firefox,然后继续重新创建干净的 search.json)

  • 编辑文件 search.json

  • 查找“https://duckduckgo.com/”(对我来说位于文件末尾)
  • 替换 https://duckduckgo。 com/ 通过您自己的 URL 参数,如下所示: https://duckduckgo.com/?kae=d&kak=-1&kf=fw

  • 在参数末尾添加字符“&”,如下所示:https://duckduckgo.com/?kae=d&kak=-1&kf=fw&

  • 保存文件
  • 重新启动 Firefox

I find a way in the latest version of firefox :
Windows 10 & Firefox 40.0.3

  • Close all sessions of firefox.
  • Eventually delete C:\Users\"¤¤"\Appdata\Roaming\Mozilla\Firefox\Profiles\"¤¤"\search.json (if you do this you have to restart and close again firefox before continue to recreate a clean search.json)

  • Edit the file search.json

  • Find "https://duckduckgo.com/" (for me at the End Of File)
  • Replace https://duckduckgo.com/ by your own URL parameters like this : https://duckduckgo.com/?kae=d&kak=-1&kf=fw

  • add the char "&" at then end of parameters like this : https://duckduckgo.com/?kae=d&kak=-1&kf=fw&

  • Save file
  • Restart Firefox
篱下浅笙歌 2024-10-14 10:18:59

我不知道从什么时候开始,但如果你想这样做,解决方案包括编辑文件 search.json。您可以在 Firefox 的个人资料文件夹中找到此文件。

在此文件中,查找以下内容:

"_urls":
    [{
        "template": "https://duckduckgo.com/?q={searchTerms}",
        "rels": [],
        "params": []
    },
    {
        "template": "https://ac.duckduckgo.com/ac/?q={searchTerms}&type=list",
        "rels": [],
        "type": "application/x-suggestions+json",
        "params": []
    }],

找到它后,通过编辑(第一个)模板来添加参数,如下所示:

"_urls":
    [{
        "template": "https://duckduckgo.com/?km=m&q={searchTerms}",
        "rels": [],
        "params": []
    },

在本示例中,我添加了 km=m。这个参数km改变了结果的处理方式。原来位于左侧,现在将位于居中。另外,不要忘记在您想要的每个参数之间添加&
完成后,保存文件 search.json 并重新启动 Firefox。

这适用于 Firefox 29 版本。

I didn't know since when but if you want to do this, the solution consist to edit the file search.json. You will find this one in your profile folder of Firefox.

Inside this file, look for this :

"_urls":
    [{
        "template": "https://duckduckgo.com/?q={searchTerms}",
        "rels": [],
        "params": []
    },
    {
        "template": "https://ac.duckduckgo.com/ac/?q={searchTerms}&type=list",
        "rels": [],
        "type": "application/x-suggestions+json",
        "params": []
    }],

Once you have find it, add your parameters by editing the (first one) template like that :

"_urls":
    [{
        "template": "https://duckduckgo.com/?km=m&q={searchTerms}",
        "rels": [],
        "params": []
    },

In this example, I have add km=m. This parameter kmchange the disposal of the result. Instead to be on the left, now there will be centered. Also, don't forget to add & between each parameters your want.
Once you have done, save the file search.json and reboot Firefox.

This work fine with the version 29 of Firefox.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文