rss

package
v0.11.8 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: AGPL-3.0 Imports: 4 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
}

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"`
}

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        string    `xml:"guid"`
	Author      string    `xml:"author,itunes"`
	Episode     string    `xml:"episode,itunes"`
	Content     Content   `xml:"content,media"`
	Enclosure   Enclosure `xml:"enclosure"`
}

func (Item) ContentType

func (i Item) ContentType() 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