Read, format and output an RSS stream.
feedo is inspired by rsstail and it's python copy rsstail.py
To fetch an RSS stream:
feedo http://lorem-rss.herokuapp.com/feed --format '{title}'
Add --follow
option to watch updates on feed.
Supported format arguments:
{id}
{link}
{title}
{author}
{content}
{enclosures[i].href}
{enclosures[i].length}
{enclosures[i].type}
{published}
{created}
{updated}
{expired}
(See feedparser Documentation for more available format arguments)
Values can be styled in python 3 string formatting syntax. For example, to format published
value in RFC 3339:
feedo http://lorem-rss.herokuapp.com/feed --format '{title:.11} ({link}) -- {published:%Y-%m-%dT%H:%MZ%z}'
(See strftime (3) for date format arguments)
feedo extends value conversion syntax and support following extra conversion flags:
!x
converts value to a SHA-1 checksum string!X
converts value to a SHA-256 checksum string!f
escapes value to make it safe for a file name!g
slugifys the value with python-slugify
For example, to get the sha1 hash of a link
value and get first 12 characters:
feedo http://lorem-rss.herokuapp.com/feed --format '{link} => {link!x} => {link!x:.12}'
feedo can be used in implementing some automatic job:
feedo "http://bt.byr.cn/torrentrss.php?rows=10&linktype=dl&passkey=XXXXXXXXXX" \
--format '[ ! -f /media/.abt/{id} ] && abt add --uri "{enclosures[0].href}" --dir="/media/Downloads/{title!f}" && touch /media/.abt/{id}' \
--follow | sh
This snippet watches an RSS stream of a RSS subscription and add new tasks to aria2 using abt.
WARNING take a trust-worthy source before pipe anything generated into a shell!!!
(The MIT License)