about summary refs log tree commit diff
path: root/net.sh
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2021-02-22 20:08:36 -0500
committerZach DeCook <zachdecook@librem.one>2021-02-22 20:08:36 -0500
commitc3b3e59317d43a95c7d9593016d68b4dbb532a6d (patch)
treeab05b22d69c4e94e1832ba5c8da30a22aebb011a /net.sh
parentc4986b595cc9afe3c3453dcc4dc012cbd75797df (diff)
downloadcgi-bin-c3b3e59317d43a95c7d9593016d68b4dbb532a6d.tar.gz
Bible: Add NET bible API wrapper
Diffstat (limited to 'net.sh')
-rwxr-xr-xnet.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/net.sh b/net.sh
new file mode 100755
index 0000000..3ee4149
--- /dev/null
+++ b/net.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+if [ "$QUERY_STRING" = "" ]
+then
+	printf "10 Enter a scripture reference\r\n"
+	return
+fi
+
+printf "20 text/gemini\r\n"
+
+qs="$(echo "$QUERY_STRING" |sed 's/ /\+/g')"
+printf "=> https://labs.bible.org This content pulled from bible.org.\n"
+# TODO: use &type=xml&formatting=para
+req="$(printf 'https://labs.bible.org/api/?passage=%s&type=text' "$qs")"
+#echo "$req"
+echo "#$qs" | sed 's/+/ /g'
+curl "$req" | sed 's@<b>[0-9:]*</b>@@g'
+# end with a newline
+echo ''
+echo '(NET)'