m15o.net/site/lib/feed

NAME

feed - go parser for RSS and Atom feeds

SYNOPSIS

import "hg.sr.ht/~m15o/feed"

type Feed struct {
	Title   string
	Entries []Entry
}
type Entry struct {
	Title       string
	URL         string
	PublishedAt time.Time
}

func Parse(data []byte) (Feed, error)
func (f Feed) UpdatedAt() time.Time

DESCRIPTION

The feed library parses RSS and Atom in a Feed, with a Title and its Entries. Entries are sorted newest first.

Parse takes the document as bytes and detects the format itself.

A document that is neither RSS nor Atom returns an error.

EXAMPLES

f, err := feed.Parse(data)
for _, e := range f.Entries {
	fmt.Println(e.PublishedAt.Format("2006-01-02"), e.Title)
}

SOURCE

https://git.sr.ht/~m15o/feed

REF

owl-report(srv)