theta
theta

Reputation: 25631

RSSTail alternative with OPML support?

rsstail can't handle OPML list, but can only track single RSS feed, AFAIK

Is there any CLI alternative (tail like) that can do this task?

Or online service that can transform OPML to valid single URL RSS, which I can then pipe to rsstail?

Upvotes: 2

Views: 584

Answers (2)

Gilles Quénot
Gilles Quénot

Reputation: 185530

note Here a clean solution, the OPML file can have multiple feeds.

From the spec of OPML linked above:

Subscription lists
A subscription list is a possibly multiple-level list of subscriptions to feeds. Each sub-element of the body of the OPML document is a node of type rss or an outline element that contains nodes of type rss.

Using :

xidel -e '//outline[@xmlUrl and @type="rss"]/join(("-u", @xmlUrl))' -s file.opml |
    xargs rsstail

The file can be remote, using http or https:

xidel --input-format xml \
    -e '//outline[@xmlUrl and @type="rss"]/join(("-u", @xmlUrl))' \
    -s http://hosting.opml.org/dave/spec/subscriptionList.opml |
    xargs rsstail

If you need only the first match

xidel -e '(//outline[@xmlUrl and @type="rss"]/join(("-u", @xmlUrl)))[1]' \
    -s file.opml | xargs rsstail

To go further, you can join multiple sources, like:

{ 
    echo ' -u https://stackoverflow.com/feeds '
    xidel ..... file.opml
} | xargs rsstail

xidel: https://github.com/benibela/xidel
xidel download: https://sourceforge.net/projects/videlibri/files/Xidel/Xidel%20development/


If you are using , to prevent quotes issues, run this code as .

Upvotes: 2

theta
theta

Reputation: 25631

cat opml.xml | grep xmlUrl | sed 's/.*xmlUrl="/-u /;s/".*//' | xargs rsstail

Upvotes: 0

Related Questions