Documentation
¶
Overview ¶
Package jsonfeed parses JSON Feed 1.0 and 1.1 documents and adapts them to the canonical feed model.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMissingRequired = errors.New("missing required field")
ErrMissingRequired reports a member the JSON Feed specification requires. The caller maps it to the exported sentinel it classifies; the wrapping message names the member.
Functions ¶
Types ¶
type Attachment ¶
type Attachment struct {
URL string
MimeType string
Title string
SizeInBytes *int64
DurationInSeconds *int64
}
Attachment represents a JSON Feed attachment.
type Feed ¶
type Feed struct {
Version string
Title string
HomePageURL string
FeedURL string
Description string
UserComment string
NextURL string
Icon string
Favicon string
Author *Author
Authors []Author
Language string
Expired *bool
Hubs []Hub
Items []Item
// Extensions holds the members the document added to the feed object under
// its own underscore-prefixed names, verbatim and undecoded.
Extensions map[string]any
// Warnings lists what the document broke that did not cost it the parse:
// an item with no content, an item discarded for having no id, an "authors"
// array holding nothing usable. See the README's leniency policy.
Warnings warn.List
}
Feed represents the native JSON Feed structure.
type Item ¶
type Item struct {
ID string
URL string
ExternalURL string
Title string
ContentHTML string
ContentText string
Summary string
Image string
BannerImage string
DatePublished string
DateModified string
Author *Author
Authors []Author
Tags []string
Language string
Attachments []Attachment
// Extensions holds the members the document added to this item under its
// own underscore-prefixed names, verbatim and undecoded.
Extensions map[string]any
}
Item represents a JSON Feed item.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parses JSON Feed documents.
func (*Parser) Parse ¶
Parse parses the JSON Feed from the input stream.
The document as a whole is validated: a feed with no version, no title, no items array, or an unknown version is rejected. A single item is not the document — see [parseItem] — so nothing one item states or fails to state rejects the feed or costs a sibling item.