rss

package
v0.0.0-...-d2c7ade Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FeedWatcher

type FeedWatcher struct {
	URL     string
	Client  http.Client
	Handler ItemHandler
	// contains filtered or unexported fields
}

FeedWatcher implements a small service to watch an RSS feed and discover new activity

func NewFeedWatcher

func NewFeedWatcher(url string, handler ItemHandler) FeedWatcher

func (*FeedWatcher) AddKnown

func (c *FeedWatcher) AddKnown(item Item)

func (*FeedWatcher) Check

func (c *FeedWatcher) Check(ctx context.Context) error

Check remote RSS feed for changes

func (*FeedWatcher) Watch

func (c *FeedWatcher) Watch(ctx context.Context, period time.Duration)

type Item

type Item struct {
	ID        string
	Title     string
	Published time.Time
	Updated   time.Time
	Content   string
	URL       string
	Hashtags  []string
}

Item is our internal, minimalist representation of a blog post

type ItemHandler

type ItemHandler interface {
	StatusCode(code int) // called after any fetch, normally either 200 (OK) or 304 (NotModified)
	NewItem(item Item)   // a new feed item is discovered
}

ItemHandler is an interface that defines what to do when new RSS items are discovered

type ItemParser

type ItemParser interface {
	Parse(r io.Reader) ([]Item, error)
}

Jump to

Keyboard shortcuts

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