Skip to content

nhomble/feed-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

feed-cli

CI Integration test Linter

simple utility for formatting (groups of) feeds

Usage

$ echo "https://your.feed.com/feed" | go run feed.go

Template Data

You can supply your own golang template with the -templateOverride parameter. When defining your own template, there are several template variables at your disposal:

Field Description

.Now

Get current time (machine dependent)

.NowIn (loc)

Get current time in desired location

.Org

The organization / blog name / title

.Feeds

An array of entries you can perform a range over

Within a feed object you have

Field Description

.Parent

A reference back to the feed group

.Article

Article name, title of the post

.Link

URL to the source

.Published

last touched time, latest time between published and updated time

Feed metadata

The goal has been to keep the feed file simple. At a minimum, you can just provide a list of feeds delimited by new-lines and you are done. To naturally give some more metadata per feed, the cli recognizes the following format

Then the grammar looks like:

<feedFile>    ::= <line> || <line>\n
<line>        ::= <feed> || <comment>> || ""
<comment>     ::= # <string>
<feed>        ::= <feedLink> <metadata>
<feedLink>    ::= <url>
<metadata>    ::= <key>=<value> <metadata> || ""
<key>         ::= <string>
<value>       ::= <string>

Feed Schemes

By default, urls passed as feedLinks are interpreted as typical xml feed (rss, atom).

Scheme Feature Additional Configuration

(default) http://

parse rss/atom feed

none

twitter://<handle>

parse twitter timeline

define environment variables: TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET

youtube_user://<@username>

parse youtube channel

none

For example

https://nullprogram.com/feed/ daysOld=30
https://xkcd.com/atom.xml
https://blog.codinghorror.com/rss/
twitter://@dev_humor

Feed metadata fields

Key Description

daysOld

positive number to indicate number of days old to respect this feed

limit

positive number to indicate a limit to the number of entries to pull for a feed

timeout

positive number to indicate number of seconds to use as timeout to fetch a feed

nameOverride

string to override the blog title variable in the template data

CLI Options

-templateOverride [relative path to go template]
    // point to your own go templates for formatting
    $ go run feed.go -templateOverride ./index.tpl

-numWorkers [natural number]
    // control the amount of parallelism in fetching feeds
    $ go run feed.go -numWorkers 5