blob: 9688a3f7b5f329e426e293e18f1840b7e9618070 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#!/usr/bin/env sh
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry|odysee)
# https://www.youtube.com/user/gotbletu
# DESC: w3m search engine alias (aka omnibar smart keywords search)
# DEMO: https://youtu.be/bWlPpacFPlI
# W3M Playlist https://www.youtube.com/playlist?list=PLqv94xWU9zZ35Yv0s6zMID5JoS8qu19Kh
# REFF: https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m/blob/master/cgi-bin/search_engines.cgi
# https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m/blob/master/documentation/search_engines.txt
# https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m/blob/master/urimethodmap
# frakswe search surfraw urimethodmap https://pastebin.com/raw/TUcRgu9y
# https://rubikitch.hatenadiary.org/entry/20070830/searchengine
# REQD: 1. touch ~/.w3m/urimethodmap
# 2. $EDITOR ~/.w3m/urimethodmap
# # search engine alias
# # note: no trailing space after %s
# 1x: file:/cgi-bin/search_engines.cgi?%s
# dd: file:/cgi-bin/search_engines.cgi?%s
# gg: file:/cgi-bin/search_engines.cgi?%s
# gs: file:/cgi-bin/search_engines.cgi?%s
# pb: file:/cgi-bin/search_engines.cgi?%s
# rd: file:/cgi-bin/search_engines.cgi?%s
# wi: file:/cgi-bin/search_engines.cgi?%s
# v2: file:/cgi-bin/search_engines.cgi?%s
# ya: file:/cgi-bin/search_engines.cgi?%s
# yt: file:/cgi-bin/search_engines.cgi?%s
# 3. chmod +x ~/.w3m/cgi-bin/search_engines.cgi
# 4. sed -i 's@cgi_bin.*@cgi_bin ~/.w3m/cgi-bin:/usr/lib/w3m/cgi-bin:/usr/local/libexec/w3m/cgi-bin@g' ~/.w3m/config
# 5. sed -i 's@urimethodmap.*@urimethodmap ~/.w3m/urimethodmap, /usr/etc/w3m/urimethodmap@g' ~/.w3m/config
# 6. sed -i 's@space_autocomplete.*@space_autocomplete 0@g' ~/.w3m/config
# USAGE: <SearchEngine>:<Keywords>
# 1. $ w3m -v
# 2. press Shift-u (the default GOTO key) to access the addressbar
# 3. press Ctrl-u to clear addressbar
# 4. to search duckduckgo type in dd:cool linux wallpapers
# 5. to search google type in gg:cool anime wallpapers
# CLI: $ w3m dd:archlinux
# $ w3m ya:debian,stable,iso
# $ w3m "gg:linux mint iso download"
# CLOG:
# 2021-07-28 add comma as space holder for cli (eg $ w3m ya:debian,stable,iso )
# 2021-07-24 remove semicolon requirements, use spaces instead by enabling (space_autocomplete 0)
# add optional direct cli usage info
# 2021-05-24 turn @felipesaa script into posix, use case statement looks prettier
# search engine alias
PREFIX=$(echo "$QUERY_STRING" | cut -d ':' -f1)
# user input keywords
INPUT=$(echo "$QUERY_STRING" | cut -d ':' -f2- | sed 's/,/%20/g')
# check if w3m version has native gopher support
GOPHER_PROTOCOL_ENABLE=$(w3m -version | grep -c "gopher")
case $PREFIX in
1x)
echo "W3m-control: GOTO https://1337x.to/search/$INPUT/1/"
;;
dd)
echo "W3m-control: GOTO https://lite.duckduckgo.com/lite/?q=$INPUT&kf=-1&kz=-1&kq=-1&kv=-1&k1=-1&kp=-2&kaf=1&kd=-1&kf=-1&kz=-1&kq=-1&kv=-1"
;;
gg)
echo "W3m-control: GOTO https://www.google.com/search?q=$INPUT"
;;
gs)
echo "W3m-control: GOTO https://portal.mozz.us/gemini/geminispace.info/search%3F$INPUT"
;;
pb)
echo "W3m-control: GOTO https://thepiratebay10.org/search/$INPUT"
;;
rd) # goto a subreddit by name
echo "W3m-control: GOTO https://www.reddit.com/r/$INPUT/.mobile"
;;
wi)
echo "W3m-control: GOTO https://en.wikipedia.org/w/index.php?search=$INPUT&title=Special%3ASearch&profile=default&fulltext=1&ns0=1"
;;
v2) # veronica-2 search gopherspace (use web proxy if no native support)
if [ "$GOPHER_PROTOCOL_ENABLE" = 0 ] ; then
echo "W3m-control: GOTO https://gopher.floodgap.com/gopher/gw?ss=gopher%3A%2F%2Fgopher.floodgap.com%2F7%2Fv2%2Fvs&sq=$INPUT"
else
echo "W3m-control: GOTO gopher://gopher.floodgap.com/7/v2/vs?$INPUT"
fi
;;
ya)
echo "W3m-control: GOTO https://search.yahoo.com/search?p=$INPUT"
;;
yt) # youtube via invidious (more instances @ https://redirect.invidious.io )
echo "W3m-control: GOTO https://yewtu.be/search?q=$INPUT"
;;
esac
# delete temp buffer
echo "W3m-control: DELETE_PREVBUF"
|