sfeed_content (936B)
1 #!/bin/sh 2 # RSS/Atom content viewer. 3 # 4 # Dependencies: 5 # - awk, sh, etc. 6 # - lynx or webdump for converting HTML to plain-text. 7 8 # content() 9 content() { 10 awk -F '\t' ' 11 function unescape(s) { 12 gsub("\\\\t", "\t", s); 13 gsub("\\\\n", "\n", s); 14 gsub("\\\\\\\\", "\\", s); 15 return s; 16 } 17 { 18 print unescape($4); 19 exit; 20 }' 21 } 22 23 tmp=$(mktemp 'sfeed_curses_XXXXXXXXXX') 24 trap "rm $tmp" EXIT 25 cat > "$tmp" 26 27 (awk -F '\t' ' 28 { 29 print "Title: " $2; 30 if (length($7)) 31 print "Author: " $7; 32 if (length($3)) 33 print "Link: " $3; 34 if (length($8)) 35 print "Enclosure: " $8; 36 print ""; 37 exit; 38 }' < "$tmp" 39 40 contenttype=$(awk -F '\t' '{ print $5; exit }' < "$tmp") 41 if test x"$contenttype" = x"plain"; then 42 content < "$tmp" 43 else 44 (echo "<span>"; content < "$tmp";echo "</span>") | \ 45 lynx -stdin -dump -underline_links -image_links 46 # lynx -stdin -dump -underline_links -list_inline -image_links 47 # webdump -a -l -r -w 79 48 fi 49 ) | \ 50 ${PAGER:-less -R}