feed

package
v0.0.0-...-c8b2685 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package feed provides the basic data type and logic to represent and interact with RSS feeds.

Index

Constants

This section is empty.

Variables

View Source
var ErrInactive = errors.New("feed is not active")

ErrInactive indicates that a Feed is not active.

Functions

This section is empty.

Types

type Feed

type Feed struct {
	ID         int64
	Name       string
	URL        string
	Homepage   string
	Interval   time.Duration
	LastUpdate time.Time
	Active     bool
	// contains filtered or unexported fields
}

Feed represents an RSS feed.

func New

func New(id int64, name, url, homepage string, interval time.Duration, active bool) (*Feed, error)

New creates a new Feed.

func (*Feed) Fetch

func (f *Feed) Fetch() ([]Item, error)

Fetch fetches a Feed.

func (*Feed) FetchRaw

func (f *Feed) FetchRaw() (*rss.Feed, error)

FetchRaw fetches a Feed.

func (*Feed) IsDue

func (f *Feed) IsDue() bool

IsDue returns true if the Feed is due for a refresh.

func (*Feed) Next

func (f *Feed) Next() time.Time

Next returns the Timestamp when the Feed is next due for a refresh.

func (*Feed) String

func (f *Feed) String() string

type Item

type Item struct {
	ID            int64
	FeedID        int64
	URL           string
	Title         string
	Description   string
	Timestamp     time.Time
	Read          bool
	Rating        float64
	ManuallyRated bool
	Tags          []tag.Tag
	// contains filtered or unexported fields
}

Item represents a single news item from an RSS Feed.

func (*Item) HasTag

func (i *Item) HasTag(tagID int64) bool

HasTag returns true if the Tag with the given ID is attached to the receiver Item.

func (*Item) HasTagNamed

func (i *Item) HasTagNamed(name string) bool

HasTagNamed returns true if the receiver carries the Tag with the given name.

func (*Item) IsBoring

func (i *Item) IsBoring() bool

IsBoring returns true if the Item has been rated or classified as boring.

func (*Item) IsDownloaded

func (i *Item) IsDownloaded() (result bool)

IsDownloaded returns true if the Item's linked URL has been downloaded to the local archive.

func (*Item) IsRated

func (i *Item) IsRated() bool

IsRated returns true if the Item has a Rating.

func (*Item) Plaintext

func (i *Item) Plaintext() string

Plaintext returns the complete text of the Item, cleansed of any HTML.

func (*Item) RatingString

func (i *Item) RatingString() string

RatingString returns the Item's rating as a string.

func (*Item) String

func (i *Item) String() string

type ReadLater

type ReadLater struct {
	ID        int64
	Item      *Item
	ItemID    int64
	Note      string
	Timestamp time.Time
	Deadline  time.Time
	Read      bool
}

ReadLater is a note/reminder to read a particular news Item at a later time.

func (*ReadLater) IsDue

func (r *ReadLater) IsDue() bool

IsDue returns true if the receiver's deadline has passed.

Jump to

Keyboard shortcuts

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