Fetch and format RSS feeds
Go to file
filifa 3cfffb5c8f add readme 2024-06-20 22:02:43 -05:00
cmd write help text 2024-06-18 20:17:03 -05:00
.gitignore add .gitignore 2024-06-18 18:38:34 -05:00
COPYING initial commit 2024-06-10 23:50:29 -05:00
README.md add readme 2024-06-20 22:02:43 -05:00
go.mod initial commit 2024-06-10 23:50:29 -05:00
go.sum initial commit 2024-06-10 23:50:29 -05:00
main.go initial commit 2024-06-10 23:50:29 -05:00

README.md

rssfetch

rssfetch outputs items contained in RSS feeds. You can specify the output format with the -o flag. For instance, -o "{{.Title}}" will only output the title of each item.

Usage

Run rssfetch with

rssfetch <feeds> -o <format>

where <feeds> is a list of one or more RSS feeds, and <format> is a format string.

Output formatting

By default, rssfetch will output the title, description, and link of each RSS item. To change the output format, use the -o flag. The string uses the syntax of Go's text/template package.

For available fields, see the Item struct of gofeed. This includes, but is not limited to:

  • .Title
  • .Description
  • .Content
  • .Link
  • .Updated
  • .Published

As an example, running the program as

rssfetch https://lorem-rss.herokuapp.com/feed -o $'{{.Title}}\n\n\n{{.Link}}\n{{.Published}}\n'

would output items like the following:

Lorem ipsum 2024-04-26T03:33:34Z


http://example.com/test/1714102414
Fri, 26 Apr 2024 03:33:34 GMT

(i.e. the title followed by three new lines, then the link followed by a new line, then the publication date followed by a new line.)

Note that $'string' is a bash feature to replace escaped characters like \n, and is not POSIX standard. Other shells might need different tricks to use escaped characters.