Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nhomble/feed-cli

simple utility for formatting feeds
https://github.com/nhomble/feed-cli

atom cli feed golang rss

Last synced: 1 day ago
JSON representation

simple utility for formatting feeds

Awesome Lists containing this project

README

        

:toc: macro

= feed-cli

image:https://github.com/nhomble/feed-cli/workflows/CI/badge.svg[CI] image:https://github.com/nhomble/feed-cli/workflows/Integration%20test/badge.svg[Integration test] image:https://github.com/nhomble/feed-cli/workflows/Linter/badge.svg[Linter]

[.lead]
simple utility for formatting (groups of) feeds

toc::[]

== Usage

[source,bash]
----
$ 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
|===

https://github.com/nhomble/fdmi/blob/master/index.tpl[for example]

== 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:

[source,text]
----
::= || \n
::= || > || ""
::= #
::=
::=
::= = || ""
::=
::=
----

=== 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:// | parse twitter timeline | define environment variables: TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET
| youtube_user://<@username> | parse youtube channel | none
|===

=== For example

https://github.com/nhomble/fdmi/blob/master/feeds[My feeds]

[source,text]
----
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

[source,text]
----
-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
----