fdm_parse_feeds.sh - dotfiles - These are my dotfiles. There are many like it, but these are mine.
(HTM) git clone git://jay.scot/dotfiles
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
fdm_parse_feeds.sh (622B)
---
1 #!/bin/sh
2 #
3 # reads text from stdin containing a url. The url is then parsed
4 # by rdrview, https://github.com/eafer/rdrview, and the url content
5 # returned appending to the end of the original text.
6 #
7 # I use this with sfeed and fdm to download feed contents without the
8 # need of a browser.
9
10 data=$(cat)
11
12 url=$(echo "$data" | grep -o -E 'https?://[^"]+|gemini://[^"]+')
13 uri_lower="$(printf "%s" "$url" | tr '[:upper:]' '[:lower:]')"
14
15 case "$uri_lower" in
16 'gemini:'*)
17 content=$(gemget -o - "$url")
18 ;;
19 'http'*)
20 content=$(rdrview -H "$url" | lynx -stdin --dump -force_html)
21 ;;
22 esac
23
24 printf "%s\n\n%s" "$data" "$content"