feed.dcgi - 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
       ---
       feed.dcgi
       ---
            1 #!/bin/sh
            2 
            3 . ../common/config.sh
            4 . ../common/feed.sh
            5 
            6 FEED_AUTHOR=yes
            7 FEED_DATE=yes
            8 ARTICLE_CGI="${CGI_BASEDIR}/theguardian/article.cgi"
            9 
           10 section_to_subtitle()
           11 {
           12         section="$1"
           13 
           14         case "${section}" in
           15                 # Main sections
           16                 international)          subtitle="World news"   ;;
           17                 uk/commentisfree)       subtitle="Opinion"      ;;
           18                 uk/sport)               subtitle="Sport"        ;;
           19                 uk/culture)             subtitle="Culture"      ;;
           20                 uk/lifeandstyle)        subtitle="Lifestyle"    ;;
           21 
           22                 # News
           23                 world)                  subtitle="World news"           ;;
           24                 uk-news)                subtitle="UK news"              ;;
           25                 science)                subtitle="Science"              ;;
           26                 cities)                 subtitle="Cities"               ;;
           27                 global-development)     subtitle="Global development"   ;;
           28                 football)               subtitle="Football"             ;;
           29                 uk/technology)          subtitle="Tech"                 ;;
           30                 uk/business)            subtitle="Business"             ;;
           31                 uk/environment)         subtitle="Environment"          ;;
           32 
           33                 # TODO:
           34                 # Opinion
           35                 # Sport
           36                 # Culture
           37                 # Lifestyle
           38 
           39                 *)              subtitle=""                     ;;
           40         esac
           41 
           42         echo "${subtitle}"
           43 }
           44 
           45 section="$2"
           46 subtitle=$(section_to_subtitle "${section}")
           47 if [ -z "${subtitle}" ]; then
           48         echo "[3|Invalid section|Err|server|port]"
           49         exit 1
           50 fi
           51 
           52 echo ""
           53 echo "The Guardian - ${subtitle}"
           54 echo ""
           55 
           56 url="https://www.theguardian.com/${section}/rss"
           57 curl -Lgs -- "${url}" |
           58 feed_to_gph