rss

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownFeed = &FeedError{"unknown or unsupported RSS/Atom format"}

Functions

This section is empty.

Types

type Feed

type Feed struct {
	Title       string
	Description string
	Link        string
	Updated     time.Time
	Items       []Item
}

Feed represents a normalized RSS/Atom feed.

func Parse

func Parse(data []byte) (*Feed, error)

Parse parses raw XML into a unified Feed structure.

func (*Feed) Clean

func (f *Feed) Clean()

Clean trims and normalizes whitespace in feed fields.

type FeedError

type FeedError struct {
	Msg string
}

FeedError is an implementation of error for feed parsing.

func (*FeedError) Error

func (e *FeedError) Error() string

type FeedType

type FeedType string
const (
	FeedUnknown FeedType = "unknown"
	FeedRSS2    FeedType = "rss2"
	FeedRSS1    FeedType = "rss1" // RDF-based
	FeedAtom    FeedType = "atom"
)

func DetectFeedType

func DetectFeedType(data []byte) FeedType

DetectFeedType performs a lightweight sniff-test on raw bytes to determine the likely feed format (RSS 2.0, RSS 1.0, or Atom).

This does *not* perform any XML unmarshalling — it is strictly a string-based prefix and tag-name check.

type Item

type Item struct {
	Title       string
	Link        string
	Description string
	Content     string
	Author      string
	Published   time.Time
	Updated     time.Time
	GUID        string
}

Item represents a single feed entry.

Jump to

Keyboard shortcuts

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