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 # Filter HTML content
8 #
9 filter_html()
10 {
11
12 awk '
13 {
14 if (match($0, /<div class="jsx-[0-9]+ storyFooter">/)) {
15 print substr($0, 1, RSTART - 1)
16 }
17 }
18 '
19
20 }
21
22
23 url=$2
24
25 curl -Lgs -- "${url}" |
26 { xmllint --html --format --xpath '//div[@id="content"]' - 2>/dev/null ; } |
27 filter_html |
28 html_to_text
29
30 echo ""
31 echo "URL: <${url}>"