Add an initial implementation of a reddit.com CGI - gophercgis - Collection of gopher CGI/DCGI for geomyidae
 (HTM) hg clone https://bitbucket.org/iamleot/gophercgis
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) changeset b655e2a0f3bc6ebb86bbbf913266c1cc65a525b1
 (DIR) parent c63d3dc29ae4d280181f9cd20802ad2f9b912b57
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Wed,  8 Aug 2018 03:02:17 
       
       Add an initial implementation of a reddit.com CGI
       
       At least pagination and a comment CGI are missing ATM.
       
       XXX: Probably just passing an empty User-Agent: is not nice... Figure out if
       XXX: there is any suggestion about that in the API!
       
       Diffstat:
        reddit/r.dcgi |  21 +++++++++++++++++++++
        1 files changed, 21 insertions(+), 0 deletions(-)
       ---
       diff -r c63d3dc29ae4 -r b655e2a0f3bc reddit/r.dcgi
       --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
       +++ b/reddit/r.dcgi     Wed Aug 08 03:02:17 2018 +0200
       @@ -0,0 +1,21 @@
       +#!/bin/sh
       +
       +subreddit="$2"
       +ua=""
       +url="https://www.reddit.com/r/${subreddit}/.json"
       +
       +echo "t"
       +echo "tr/${subreddit}"
       +echo "t"
       +
       +/usr/pkg/bin/curl -A "${ua}" -s "${url}" |
       +/usr/pkg/bin/jq -r '
       +.data.children[] |
       +       .data |
       +               "[h|\(.title | gsub("\\|"; "\\|") )|" +
       +                   "URL:\(.url | gsub("\\|"; "\\|"))|server|port]",
       +               "t" + .author + "   " + ( .created_utc | strftime("%F %H:%M") ),
       +               "tScore:    \(.score)",
       +               "tComments: \(.num_comments)",
       +               "t"
       +'