rss

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package rss provide support for parsing RSS files as used in podcast feeds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	XMLName       xml.Name `xml:"channel"`
	Title         string   `xml:"title"`
	Links         []string `xml:"link"` // want <link> not <atom:link>
	Description   string   `xml:"description"`
	Author        string   `xml:"author,itunes"`
	Language      string   `xml:"language"`
	Copyright     string   `xml:"copyright"`
	LastBuildDate string   `xml:"lastBuildDate"`
	Image         Image    `xml:"image"`
	TTL           int      `xml:"ttl"`
	Items         []Item   `xml:"item"`
}

func (*Channel) LastBuildTime

func (c *Channel) LastBuildTime() time.Time
func (c *Channel) Link() string

type Content

type Content struct {
	Title     string   `xml:"title,media"`
	Thumbnail string   `xml:"thumbnail,media"`
	URL       string   `xml:"url,attr"`
	FileSize  int64    `xml:"fileSize,attr"`
	Type      string   `xml:"type,attr"`
	Medium    string   `xml:"medium,attr"`
	Credits   []string `xml:"credit,media"`
}

type Enclosure

type Enclosure struct {
	Length int64  `xml:"length,attr"`
	Type   string `xml:"type,attr"`
	URL    string `xml:"url,attr"`
}

type Episode

type Episode struct {
	Title       string
	Link        string
	Author      string
	Description string
	ContentType string
	Size        int64
	URL         string
	PublishTime time.Time
	GUID        string
	Image       string
}

type GUID added in v0.12.1

type GUID struct {
	PermaLink bool   `xml:"isPermaLink,attr"`
	Value     string `xml:",chardata"`
}

type Image

type Image struct {
	Title     string `xml:"title"`
	URL       string `xml:"url"`
	Link      string `xml:"link"`
	Width     int    `xml:"width"`
	Height    int    `xml:"height"`
	Reference string `xml:"href,attr"`
}

type Item

type Item struct {
	XMLName     xml.Name  `xml:"item"`
	Title       string    `xml:"title"`
	Link        string    `xml:"link"`
	PubDate     string    `xml:"pubDate"`
	Description string    `xml:"description"`
	Categories  []string  `xml:"category"`
	GUID        GUID      `xml:"guid"`
	Author      string    `xml:"author,itunes"`
	Episode     string    `xml:"episode,itunes"`
	Image       Image     `xml:"image,itunes"`
	Duration    string    `xml:"duration,itunes"`
	Content     Content   `xml:"content,media"`
	Enclosure   Enclosure `xml:"enclosure"`
	Comments    string    `xml:"comments"`
}

func (*Item) ContentType

func (i *Item) ContentType() string

func (*Item) ItemGUID added in v0.12.1

func (i *Item) ItemGUID() string

func (*Item) ItemImage added in v0.12.1

func (i *Item) ItemImage() string

func (*Item) ItemTitle

func (i *Item) ItemTitle() string

func (*Item) PublishTime

func (i *Item) PublishTime() time.Time

func (*Item) Size

func (i *Item) Size() int64

func (*Item) URL

func (i *Item) URL() string

type Podcast

type Podcast struct {
	Title         string
	Description   string
	Author        string
	Link          string
	Image         string
	Copyright     string
	LastBuildTime time.Time
	TTL           int
	Episodes      []Episode
}

type RSS

type RSS struct {
	// contains filtered or unexported fields
}

func NewRSS

func NewRSS(client client.Getter) *RSS

func (*RSS) Fetch

func (rss *RSS) Fetch(url string) (Channel, error)

func (*RSS) FetchPodcast

func (rss *RSS) FetchPodcast(url string) (Podcast, error)

type Rss

type Rss struct {
	XMLName xml.Name `xml:"rss"`
	Version string   `xml:"version,attr"`
	Channel Channel  `xml:"channel"`
}

Jump to

Keyboard shortcuts

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