scripts for my gemini capsule
gcc.sh: Cache the hymn pages
Some crawlers hit them a lot... this should make it a lot faster
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | gcc.cache/.gitkeep | 0 | ||||
| -rwxr-xr-x | gcc.sh | 8 |
3 files changed, 8 insertions, 1 deletions
@@ -4,3 +4,4 @@ lsv.txt bsb tcgnt hboWLC +gcc.cache/* diff --git a/gcc.cache/.gitkeep b/gcc.cache/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gcc.cache/.gitkeep @@ -25,6 +25,12 @@ fi printf "20 text/gemini\r\n" printf "=>/cgi-bin/gcc.sh$PATH_INFO?.mp3 Listen to this!\n" + +if test -e "gcc.cache$PATH_INFO"; then + cat "gcc.cache$PATH_INFO" + exit 0 +fi + wget -q -O - https://gccsatx.com/hymns$PATH_INFO/ \ | grep -o '\(<strong>\|<p>\|\)[^<>]*\(</strong>\|</p>\|<br />\)' \ | sed 's@<br />@@g'| sed 's@^<strong>@\n## @g' | sed 's@</strong>@@g' | sed 's@</p>@@g' | sed 's@<p>@@g' \ @@ -33,5 +39,5 @@ wget -q -O - https://gccsatx.com/hymns$PATH_INFO/ \ | grep -v '!important' | grep -v '}\|{\|wp-smiley' \ | sed 's/‘/‘/g' |sed 's/’/’/g' | sed 's/”/”/g' | sed 's/“/“/g'\ | grep -v 'this website' \ -| sed -r '/^\s*$/d' +| sed -r '/^\s*$/d' | tee "gcc.cache$PATH_INFO" exit 0 |