feedaggregator

package module
v0.0.0-...-250c91b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2021 License: MIT Imports: 16 Imported by: 0

README

hugofeed-aggregator

hugofeed-aggregator is a utility which aggregates RSS and Atom feeds and stores them in a JSON file which may be consumed by a static site generator like Hugo in order to generate HTML pages and RSS or Atom feeds.

Build Instructions

The hugofeed-aggregator utility can be built by running go build ./cmd/hugofeed-aggregator. See the Go documentation for details.

Source Code Repository

The current development version is available from the source code repository at https://gitlab.das-netzwerkteam.de/freiesoftwaregmbh/hugofeed-aggregator.

Bug Reports

Please direct any bug reports to the bug tracker at https://gitlab.das-netzwerkteam.de/freiesoftwaregmbh/hugofeed-aggregator.

When sending bug reports, please always mention the exact version of the hugofeed-aggregator package with which the issue occurs as well as the Go compiler and version and version of the operating system you are using and make sure that you provide sufficient information to reproduce the issue and include any input, output, any error messages.

In case of build issues, please also specify the implementations and versions of the tools used to build the package and/or program, in particular the Go compiler.

In case of crashes, please attach the full backtrace to the bug report.

Documentation

Index

Constants

View Source
const (
	DefaultNumWorkers = 5
)

Variables

View Source
var (
	ErrItemNonexistent = errors.New("cache item does not exist")
	ErrItemExpired     = errors.New("cache item has expired")
)

Functions

This section is empty.

Types

type AggregatedFeed

type AggregatedFeed []*FeedItem

func (*AggregatedFeed) Parse

func (f *AggregatedFeed) Parse(r io.Reader) error

func (*AggregatedFeed) Serialize

func (f *AggregatedFeed) Serialize(w io.Writer) error

type Cache

type Cache interface {
	Store(string, []byte) error
	Load(string) ([]byte, error)
}

type FeedAggregator

type FeedAggregator struct {
	NumWorkers int

	MaxItems int
	// contains filtered or unexported fields
}

func NewFeedAggregator

func NewFeedAggregator(logger *log.Logger, urls []string, filter string, cache Cache) *FeedAggregator

func (*FeedAggregator) Update

func (f *FeedAggregator) Update() (err error)

func (*FeedAggregator) WriteFeed

func (f *FeedAggregator) WriteFeed(w io.Writer) error

type FeedItem

type FeedItem struct {
	ID        string    `json:"id"`
	Title     string    `json:"title"`
	Updated   time.Time `json:"date_updated"`
	Published time.Time `json:"date_published"`
	Authors   []string  `json:"authors"`
	URL       string    `json:"url"`
	Content   string    `json:"content"`
}

type FeedUpdateError

type FeedUpdateError struct {
	Errors map[string]error
}

func (*FeedUpdateError) Error

func (e *FeedUpdateError) Error() string

type FileCache

type FileCache struct {
	// contains filtered or unexported fields
}

func NewFileCache

func NewFileCache(dir string, cacheExpiry time.Duration) (*FileCache, error)

func (*FileCache) Load

func (c *FileCache) Load(u string) ([]byte, error)

func (*FileCache) Store

func (c *FileCache) Store(u string, data []byte) (err error)

type MemoryCache

type MemoryCache map[string][]byte

func (MemoryCache) Load

func (c MemoryCache) Load(u string) ([]byte, error)

func (MemoryCache) Store

func (c MemoryCache) Store(u string, data []byte) (err error)

Directories

Path Synopsis
cmd
hugofeed-aggregator
The hugofeed-aggregator command is an aggregator for RSS and Atom feeds.
The hugofeed-aggregator command is an aggregator for RSS and Atom feeds.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL