rss2

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package rss2 provides parsing functionality for RSS 2.0 feeds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	XMLName xml.Name `xml:"category"`
	Name    string   `xml:"text,attr"`
}

type Channel

type Channel struct {
	XMLName     xml.Name   `xml:"channel"`
	Title       string     `xml:"title"`
	Language    string     `xml:"language"`
	Author      string     `xml:"author"`
	Description string     `xml:"description"`
	Link        []Link     `xml:"link"`
	Image       *Image     `xml:"image"`
	Categories  []Category `xml:"category"`
	Items       []Item     `xml:"item"`
	MinsToLive  int        `xml:"ttl"`
	SkipHours   []int      `xml:"skipHours>hour"`
	SkipDays    []string   `xml:"skipDays>day"`
}

type Enclosure

type Enclosure struct {
	XMLName xml.Name `xml:"enclosure"`
	URL     string   `xml:"url,attr"`
	Type    string   `xml:"type,attr"`
	Length  uint     `xml:"length,attr"`
}

type Feed

type Feed struct {
	XMLName xml.Name `xml:"rss"`
	Channel *Channel `xml:"channel"`
}

func Parse

func Parse(r io.Reader) (*Feed, error)

Parse decodes data from r as an RSS 2.0 feed.

type Image

type Image struct {
	XMLName xml.Name `xml:"image"`
	Href    string   `xml:"href,attr"`
	Title   string   `xml:"title"`
	URL     string   `xml:"url"`
	Height  int      `xml:"height"`
	Width   int      `xml:"width"`
}

type Item

type Item struct {
	XMLName     xml.Name    `xml:"item"`
	Title       string      `xml:"title"`
	Description string      `xml:"description"`
	Content     string      `xml:"encoded"`
	Categories  []string    `xml:"category"`
	Link        string      `xml:"link"`
	PubDate     string      `xml:"pubDate"`
	Date        string      `xml:"date"`
	Image       *Image      `xml:"image"`
	ID          string      `xml:"guid"`
	Enclosures  []Enclosure `xml:"enclosure"`
}
type Link struct {
	Rel      string `xml:"rel,attr"`
	Href     string `xml:"href,attr"`
	Type     string `xml:"type,attr"`
	Chardata string `xml:",chardata"`
}

Jump to

Keyboard shortcuts

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