Add a article.cgi for theatlantic.com articles - 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 28798a698908c8067a7f2f352f5764078d1ac645
 (DIR) parent 1190beed612e9034835feb498d889280e81aa407
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Mon, 27 Aug 2018 02:30:05 
       
       Add a article.cgi for theatlantic.com articles
       
       Diffstat:
        theatlantic/article.cgi |  26 ++++++++++++++++++++++++++
        1 files changed, 26 insertions(+), 0 deletions(-)
       ---
       diff -r 1190beed612e -r 28798a698908 theatlantic/article.cgi
       --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
       +++ b/theatlantic/article.cgi   Mon Aug 27 02:30:05 2018 +0200
       @@ -0,0 +1,26 @@
       +#!/bin/sh
       +
       +
       +#
       +# Render HTML as text
       +#
       +html_to_text()
       +{
       +       # Nonexistent proxy to block HTTP requests
       +       export http_proxy="http://localhost:31283128"
       +
       +       browser="/usr/pkg/bin/w3m"
       +
       +       browser_options="-dump -T text/html -no-cookie -cols 72"
       +       browser_options="${browser_options} -o display_link=false"
       +       browser_options="${browser_options} -o display_link_number=false"
       +       browser_options="${browser_options} -o display_image=false"
       +
       +       env LANG=en_US.UTF-8 ${browser} ${browser_options}
       +}
       +
       +
       +url=$2
       +/usr/pkg/bin/curl -sL "${url}" |
       +    { /usr/pkg/bin/xmllint --html --xpath '//article' - 2>/dev/null ; } |
       +    html_to_text