rss

package
v0.0.0-...-941fea7 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RSSFeed

type RSSFeed struct {
	Channel struct {
		Title       string    `xml:"title"`       // The title of the RSS feed
		Link        string    `xml:"link"`        // The URL link of the RSS feed
		Description string    `xml:"description"` // A brief description of the RSS feed
		Item        []RSSItem `xml:"item"`        // A list of items (posts) in the RSS feed
	} `xml:"channel"`
}

RSSFeed represents the structure of an RSS feed parsed from XML.

func FetchFeed

func FetchFeed(ctx context.Context, feedURL string) (*RSSFeed, error)

FetchFeed retrieves and parses an RSS feed from the provided URL.

Parameters: - ctx: A context for managing request cancellation and timeouts. - feedURL: The URL of the RSS feed to fetch.

Returns: - A pointer to the RSSFeed struct containing the parsed feed data. - An error if the feed cannot be retrieved or parsed.

type RSSItem

type RSSItem struct {
	Title       string `xml:"title"`       // The title of the RSS item
	Link        string `xml:"link"`        // The URL link to the RSS item
	Description string `xml:"description"` // A brief description of the RSS item
	PubDate     string `xml:"pubDate"`     // The publication date of the RSS item
}

RSSItem represents an individual item (post) in an RSS feed.

Jump to

Keyboard shortcuts

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