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

https://github.com/lmas/feedloggr

This repo has been migrated to https://code.larus.se/lmas/feedloggr
https://github.com/lmas/feedloggr

aggregator atom feed generator golang news reader rss

Last synced: 6 months ago
JSON representation

This repo has been migrated to https://code.larus.se/lmas/feedloggr

Awesome Lists containing this project

README

          

# Migrated

**This repo has been migrated to https://code.larus.se/lmas/feedloggr.**

,-.
( O )`~-~-~-~-~-~-~-~-~-,
|`-'| -- feedloggr -- |
| | v0.4.2 |
`-' `~-~-~-~-~-~-~-~-~-'

Collect news from your favourite Atom/RSS/JSON feeds and generate static web pages for easy browsing.

## Status

The project has successfully been running since June 2021 without any major issues on my own sites.
The only minor issues discovered so far has been with external feeds with poor behaviour.

## Installation

go install github.com/lmas/feedloggr@latest

## Usage

For a list of available flags and commands:

feedloggr help

You can create a new configuration file by running:

feedloggr example > .feedloggr.yml

You should then edit `.feedloggr.yml` and add your own feeds to it.

When you're done editing the configuration, you can test it and make sure there's no errors:

feedloggr test

If no errors are shown, you're good to go!

Now that you have a working configuration,
it's time to start collect news from your feeds and export them to a web page:

feedloggr

When it's done you should be able to browse the newly generated page,
found inside the output directory that was specified in the configuration file.

## Command line options

Usage of feedloggr:

Flags
-conf string
Path to conf file (default ".feedloggr.yml")
-verbose
Print debug messages while running

Commands
discover
Try discover feeds from
example
Print example config
help
Print this help message and exit
regexp
Try parsing items from using rule
run
Update feeds and output new page
test
Try loading config
version
Print version information

## Configuration

Configuration is by default loaded from the file `.feedloggr.yml` in the current directory,
but can be overridden with the `-conf` flag.

### settings

Global configuration settings.

*output*

Output directory where generated pages and link filter are stored.

*template*

Optional filepath to custom HTML template.

*maxdays*

Optional max amount of days to keep the generated pages for.

*maxitems*

Max amount of new items to fetch from each feed.

*timeout*

Max time (in seconds) to try download a feed, before timing out.

*jitter*

Max time (in seconds) to randomly apply, as a wait time, between each feed update.

*verbose*

Show verbose output when running.

### feeds

List of Atom/RSS/JSON feeds.

*title*

Custom title for a feed.

*url*

Source feed URL for fetching new updates.

*parser.rule*

Regexp rule for fetching items from a non-feed URL.
It must provide two capture groups called "title" and "url".
A third, optional capture group "content" allows for capturing any exra text
that can be used and displayed in the output template.

*parser.host*

Optional host prefix for feed item URLs, which can be used to replace a missing
value or redirect the URLs to another host.

### Example

settings:
output: ./feeds/
template: ""
maxdays: 30
maxitems: 20
timeout: 30
jitter: 2
verbose: true
feeds:
- title: Lemmy.link
url: https://lemmy.link/feeds/local.xml?sort=TopDay
- title: Hacker News
url: https://news.ycombinator.com/rss
parser:
rule: (?sU).*(?P[^<]+).*(?P[^<]+).*
host: https://news.ycombinator.com/rss

## Output Template

The `template` config value can be used to load a custom HTML template,
but if not set it will default to a built in template.

The templating system used is [html/template], found in Go's standard library.

[html/template]: https://pkg.go.dev/html/template

### Template Variables

*.Today*

Current time. Can be customised with the template functions available down below.

*.Generator.Name*

*.Generator.Version*

*.Generator.Source*

Basic information about this tool.

*.Feeds*

A list of feeds, as defined in the config file.
Can be iterated easily.

*.Feeds.Conf.Title*

*.Feeds.Conf.Url*

Basic information about current feed.

*.Feeds.Conf.Source*

In case the `parser.host` setting has been used in the config,
this variable will simple be the same value.
Otherwise it defaults to `.Feeds.Conf.Url`.

*.Feeds.Items*

A list of unique items for the feed.
Can be iterated easily.

*.Feeds.Items.Title*

*.Feeds.Items.Url*

*.Feeds.Items.Content*

Basic information about current item.

*.Feeds.Error*

In case an error was encountered while trying to update the feed,
this variable will contain the error message.

### Template Functions

*shortdate*

Can be used to shorten a long time value down to, for example: 2006-01-02.

*prevday*

Can be used to subtract a day from a time value.

*nextday*

Can be used to add a day to a time value.

### Example

Minimal example template, based on the built in default (without CSS styling):





News for {{.Today | shortdate}}





{{.Today | shortdate}}


Previous
Latest
Next

{{range .Feeds}}

{{.Conf.Title}}


{{if .Error}}

Error while updating feed:
{{.Error}}


{{else}}

{{end}}

{{else}}

Sorry, no news for today!


{{end}}

Generated with {{.Generator.Name}} {{.Generator.Version}}


## License

GPL, See the [LICENSE](LICENSE) file for details.