Add a DCGI for internazionale.it (still very WIP) - 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 5f9e8c34c4ee8d65cf9ecbaa904a9f2086b6386a
(DIR) parent 2ab2d279d287c9f00d72369888942fc318f43513
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Sat, 25 Aug 2018 21:58:06
Add a DCGI for internazionale.it (still very WIP)
Diffstat:
internazionale/sections.dcgi | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
---
diff -r 2ab2d279d287 -r 5f9e8c34c4ee internazionale/sections.dcgi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/internazionale/sections.dcgi Sat Aug 25 21:58:06 2018 +0200
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+
+ARTICLE_CGI="/cgi/internazionale/article.cgi"
+
+
+section="$2"
+case "${section}" in
+ ultimi-articoli | i-piu-letti | reportage | opinioni | savagelove )
+ url="https://www.internazionale.it/${section}"
+ ;;
+ *)
+ exit 1
+ ;;
+esac
+
+echo ""
+echo "Internazionale"
+echo ""
+
+/usr/pkg/bin/curl -sgL "${url}" |
+awk '
+/class="box-article-title"/ {
+ if (!match($0, /href="[^"]*"/)) {
+ next
+ }
+ url = substr($0, RSTART + 6, RLENGTH - 7)
+ url = "https://www.internazionale.it" url
+
+ title = $0
+ sub(/^ *<a href="[^"]*" class="box-article-title">/, "", title)
+ sub(/<\/a>.*$/, "", title)
+
+ gsub("\\|", "\\|", url)
+ gsub("\\|", "\\|", title)
+
+ printf("[0|%s|'"${ARTICLE_CGI}?"'%s|server|port]\n", title, url)
+}
+'
+
+echo ""