summaryrefslogtreecommitdiff
path: root/scripts/urbandictserch
diff options
context:
space:
mode:
authorjustsaumit <justsaumit@draconyan.xyz>2022-03-01 19:54:04 +0530
committerjustsaumit <justsaumit@draconyan.xyz>2022-03-01 19:54:04 +0530
commit98bbe7bd7fcec209e2408ff0b086858715ca89e0 (patch)
treed7597d75bbcc7d2b9621693c89058b77c8d504b2 /scripts/urbandictserch
parent588af889ea41d9dfeb7f2c47c1a7af4de65b4406 (diff)
updated
Diffstat (limited to 'scripts/urbandictserch')
-rwxr-xr-xscripts/urbandictserch15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/urbandictserch b/scripts/urbandictserch
new file mode 100755
index 0000000..c007d60
--- /dev/null
+++ b/scripts/urbandictserch
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+search=$(echo "" | dmenu -p 'Urban Dictionary:'|sed 's/ /%20/g')
+
+curl -s "https://api.urbandictionary.com/v0/define?term={$search}" | jq '.' | grep --color=always definition | awk 'BEGIN {RS="definition"; ORS=""} {print $0""++i}' > /tmp/urban-dic
+
+n=$(wc -l < /tmp/urban-dic)
+touch /tmp/urban-dic.txt && > /tmp/urban-dic.txt
+
+for i in $(eval echo {1..$n}p)
+do
+ sed -n $i /tmp/urban-dic|sed -r "s/\x1B\[[0-9;]*[a-zA-Z]//g" >> /tmp/urban-dic.txt
+done
+cat /tmp/urban-dic.txt | dmenu -l $n -p "$1"i
+