So, you're a command-line jocky. You've discovered newsbeuter and, outside of a mutt, it's the best way to read news (inside a mutt, of course, it's too dark to read).
But you'd also like to be able to get a quick "world at a glance" view of your newsfeed, or portions of it, scrolling by, Twitter-like.
There's a tool for that: Folkert van Heusden's "rsstail", which can follow and stream an RSS feed, displaying (pick one or all) title, link, and/or description ("content"). Which is handy in its own way, but if you could follow multiple feeds, and, say, color highlight them, offer scrollback and search, and other goodness, plus reformat things a tad, wouldn't that be even better?
Yes, it is. Folkert van Heusden's "multitail" does almost all of that.
But wait, you say, maintaining yet another set of RSS feeds (even with the awesome OPML export functionality of newsbeuter) is a PITA. I want to be able to do all of this straight from my newsbeuter URLs list without worrying about any of that. Oh, and while you're at it, you know those tags I've created? I want to be able to access those and just follow, say, a specific set of tagged feeds. And instead of printing out "Title:" for each feed title, give me the name of the bloody feed. And fix multitail's gawdawful color highlighting too.
No worries. Say, something like this?
http://i.imgur.com/0PKeNJY.png
Yeah, you say, but got source?
Yep.
Scripts presume ~/.newsbeuter/urls
and ~/.multitail.conf
The multitail launch script, 'multitail-newsbeuter'
#!/bin/sh
#
# multitail-rsstail-custom
# Edward Morbius <[email protected]>
# Sun Jan 5 20:55:05 2014
#
# multitail of rsstail of newsbeuter feeds, with custom header rewriting
# and color schemes implemented.
#
# Presumes a local multitail config file and newsbeuter url file.
tagopt=""
while [ $# -gt 0 ]
do
tags="$1"
tagopt="--tags $tags"
shift
done
eval multitail -F .multitail --no-load-global-config -CS rsstail $(
~/bin/newsbeuter2rsstail $tagopt ~/.newsbeuter/urls
)
newsbeuter2rsstail:
#!/usr/bin/gawk -f
#
# newsbeuter2rsstail
# Edward Morbius <[email protected]>
# Sun Jan 5 19:20:44 2014
#
# Parse a Newsbeuter feed and generate a set of rsstail commands
# suitable for inclusion into multitail
#
# Optional argument:
# --tags <taglist> Comma-separated list of tags to select
# Match is case insensitive
#
# ----------------------------------------------------------------------
BEGIN {
# Args parsing
tagset = 0
for( i=0; i<ARGC; i++ ) {
if( ARGV[i] == "--tags") {
delete ARGV[i]
taglist = tolower(ARGV[++i])
delete ARGV[i]
tagmax = split( taglist, tags, ",")
tagset = 1
}
}
}
# Find a feed and work with it.
/^http/ {
if ( NR > 40 ) exit # DEBUG
tagmatch = 0
# Are we filtering on tags?
# Match is on any tag (or substring thereof)
if( tagset == 1 ) {
feedtags = tolower(substr($0, length($1) + 1))
for( itag=0; itag <= tagmax; itag++ ) {
if( match( feedtags, tags[itag] ) > 1) {
tagmatch = 1
}
}
}
if( tagset == 1 && tagmatch != 1) {
next
}
i++ # Increment feed counter
if( i == 1 ) {
1==1
printf ("-l ") # multitail's first command arg
}
else {
1 == 1
printf( "-L " ) # Additional args, consolidated in first
}
# Feed is the first element
# Extract the feed title.
host = gensub("^https*://([^/]*)/.*", "\\1", "g", $1)
path = gensub("^https*://[^/]*/(.*$)", "\\1", "g", $1)
hostfields = split(host, hostpart, "\\.")
pathfields = split(path, pathpart, "/" )
# ----------------------------------------
# Site rules here
# If you're not happy with the pattern match / feed name, add a rule
# here according to the site's parameters.
# ----------------------------------------
# Blogging sites (more can go here)
if( match(host, "(dreamwidth|blogspot|blogger)")) {
feedtitle = hostpart[1]
}
# Reddit's subreddits
else if ( match($1, "reddit.com/r" )) {
feedtitle = "/" pathpart[1] "/" pathpart[2]
}
# Reddit user feeds
else if ( match($1, "reddit.com/user" )) {
feedtitle = "/" pathpart[1] "/" pathpart[2]
}
# Reddits messages
else if ( match($1, "reddit.com/message" )) {
feedtitle = hostpart[2] "-" pathpart[1]
}
# Guardian feeds
else if ( match(host, "theguardian.com" )) {
if (match(pathpart[1], "theguardian" )) {
feedtitle = hostpart[2] "-" pathpart[2]
}
else feedtitle = hostpart[2] "-" pathpart[1]
}
# Additional random sites, examples of matches...
else if ( match(host, "physics.ucsd.edu" )) {
feedtitle = pathpart[1]
}
else if ( match(host, "blogs.law.harvard.edu" )) {
feedtitle = pathpart[1]
}
# Don Marti
else if ( match(host, "zgp.org" )) {
feedtitle = pathpart[1]
}
else if(hostfields > 2) {
feedtitle = hostpart[2]
}
else {
feedtitle = hostpart[1];
}
printf ( "\x22rsstail -n 1 -Z \x27%s: \x27 -z -u \x27%s\x27 | sed \x27s/: Title:/:/; s/^ //\x27 \x22 ", feedtitle, $1 )
# Arguments:
# -n 1: initially load one item
# -a : Show author (not enabled)
# -Z <header>: Add header
# -u <feedurl>: Feed URL
#
# The sed bit strips the "Title: " header and cleans leading
# whitespace.
}
And a modified multitail.conf with betterer syntax highlighting:
# multitail config
# rsstail (http://www.vanheusden.com/rsstail/)
colorscheme:rsstail:RSSTail output (RSS feed reader)
cs_re:cyan::
cs_re:cyan:/
cs_re:blue:^.......... ..:..:..
cs_re:white:^Title:.*
cs_re:cyan:^Link:.*
cs_re:yellow:^Description:
cs_re:white:^Author:.*
cs_re:yellow:^[-a-z~/]*:
#
include:/etc/multitail.conf
More:
http://www.reddit.com/r/dredmorbius/comments/1udv6i/further_adventures_in_rss_chrome_reader_extension/
The scripts and some background:
http://www.reddit.com/r/dredmorbius/comments/1udv6i/further_adventures_in_rss_chrome_reader_extension/cek9441