about summary refs log tree commit diff stats
path: root/res
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-09-30 22:08:43 +0200
committerbptato <nincsnevem662@gmail.com>2024-09-30 22:27:40 +0200
commit7277dd7c357cfa10838b1e694aaf32128082d088 (patch)
treedd62ac89a9f0c6e30385b5cbeed8611bf859ff7c /res
parent9eb459ad095aa3fb30d967359e0bc6846262f6ea (diff)
downloadchawan-7277dd7c357cfa10838b1e694aaf32128082d088.tar.gz
config.toml: switch to Google search
I'm not happy about this, but the alternatives are worse.

* DDG has degraded a lot lately:
	- (I think?) it appends my location to the Bing queries, which
	  might be useful for searching restaurants, but only increases
	  noise when looking for something technical.
	- Lately it also shoves LLM-generated summaries of websites in
	  my face - which I wouldn't even mind if the "summaries"
	  weren't in the typical overly verbose LLM style...
  Also, not a degradation per se, but DDG can't load images without JS
  (neither lite nor html), while Google can. Only relevant now that we
  have images.
* Other large search providers either don't load without JS, or give
  us a layout that we can't render.
* Smaller search providers (Mojeek, Marginalia) sadly don't have CJK
  support. (DDG performs quite poorly here, too.)
* Metasearch engines (Searx, etc.) require self-hosting to work
  consistently, which I lack resources for.

I'm sending ucbcb=1 and gbv=1, both of which are appended by Google
and apparently stand for "no cookies" and "no JS", respectively.
Also, I have added a siteconf entry to strip the click tracking.

The default ddg: omni-rule remains, so users who wish to switch back can
set in config.toml:

[page]
C-k = '() => pager.load("ddg:")'
Diffstat (limited to 'res')
-rw-r--r--res/config.toml18
1 files changed, 17 insertions, 1 deletions
diff --git a/res/config.toml b/res/config.toml
index 13210838..43a61072 100644
--- a/res/config.toml
+++ b/res/config.toml
@@ -56,7 +56,7 @@ toggleWrap = '''
 '''
 dupeBuffer = '() => pager.dupeBuffer()'
 load = '() => pager.load()'
-webSearch = '() => pager.load("ddg:")'
+webSearch = '() => pager.load("go:")'
 openBookmarks = '() => pager.loadSubmit("~/.w3m/bookmark.html")'
 reloadBuffer = '() => pager.reload()'
 lineInfo = '() => pager.lineInfo()'
@@ -319,6 +319,22 @@ force-pixels-per-line = false
 match = '^ddg:'
 substitute-url = 'x => "https://lite.duckduckgo.com/lite/?kp=-1&kd=-1&q=" + encodeURIComponent(x.split(":").slice(1).join(":"))'
 
+[[omnirule]]
+match = '^go:'
+substitute-url = 'x => `https://www.google.com/search?gbv=1&ucbcb=1&q=${x.split(":").slice(1).join(":")}`'
+
+# strip tracking
+[[siteconf]]
+url = '^https?://(www\.)?google\.com'
+rewrite-url = '''
+x => {
+	if (x.pathname == "/url")
+		return new URL(x.searchParams.get("q"));
+	for (const name of ["sca_esv", "sca_upv", "oq", "aqs", "ved", "sa", "source", "ei"])
+		x.searchParams.delete(name);
+}
+'''
+
 [page]
 # buffer commands
 h = 'cmd.buffer.cursorLeft'