Skip to content

Commit

Permalink
Add Qwant
Browse files Browse the repository at this point in the history
  • Loading branch information
drakeerv committed Oct 30, 2024
1 parent 70b9b29 commit e1078c1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/engines/google.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ add_engine('google', function(client, query, opts)

local url =
Url.from_template(
tostring('https://google.com/search?filter=0&asearch=arc&async=use_ac:true,_fmt:prog&start={start}&q={query}'),
tostring('https://google.com/search?filter=0&asearch=arc&oe=utf8&async=use_ac:true,_fmt:prog&start={start}&q={query}'),
{
query = query.query,
start = tostring(offset)
Expand Down
12 changes: 11 additions & 1 deletion plugins/engines/json_engine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@ local function get_key(data, key)

local value = data
for _, k in ipairs(keys) do
value = value[k]
if value[k] == nil then
local index = tonumber(k)
if index then
value = value[index]
else
value = nil
end
else
value = value[k]
end

if value == nil then
break
end
Expand Down
18 changes: 17 additions & 1 deletion plugins/providers.toml
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,20 @@ kinds = ["sear"]
results_key = "results"
url_key = "url"
title_key = "name"
snippet_key = "description"
snippet_key = "description"

[qwant]
engine = "json_engine"
name = "Qwant"
description = "A privacy-respecting search engine"
kinds = ["sear"]
[qwant.features]
pagination = "1"
safe_search = "multilevel"

[qwant.extra]
url = "https://api.qwant.com/v3/search/web?locale=en_us&count=10&p={page}&q={query}"
results_key = "data/result/items/mainline/2/items"
url_key = "url"
title_key = "title"
snippet_key = "desc"

0 comments on commit e1078c1

Please sign in to comment.