article.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
---
article.cgi
---
1 #!/bin/sh
2
3 . ../common/config.sh
4 . ../common/html.sh
5
6 #
7 # Extract article content
8 #
9 extract_article()
10 {
11
12 awk '
13 /<article class="main-article/,/<\/article>/ {
14 if (($0 ~ /<aside class="tags-list">/) || ($0 ~ /<footer /)) {
15 exit
16 }
17
18 print
19 }
20 '
21 }
22
23
24 url="$2"
25 curl -Lgs -- "${url}" |
26 extract_article |
27 html_to_text
28
29 echo ""
30 echo "URL: <${url}>"