rss

package
v0.0.0-...-46bc020 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package rss ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdatePodcast

func UpdatePodcast(ctx context.Context, p *store.Podcast, force bool) (int, error)

UpdatePodcast fetches the feed URL for the given podcast, parses it and updates all of the episodes we have stored for the podcast. This method updates the passed-in store.Podcast with the latest details.

To keep memory usage managable, we use the xml.Decoder interface to decode the XML file in a streaming fashion.

If force is false, then we assume the podcast only has the latest handful of episodes -- anything older than the oldest episode we have already stored is ignored (if there's no existing episode then we assume this is a new podcast and load everything).

If force is true, then we ignore existing episodes and re-store all episodes in the RSS file.

Types

type AtomLink struct {
	Href string `xml:"href,attr"`
	Rel  string `xml:"rel,attr"`
}

AtomLink ...

type Channel

type Channel struct {
	Title       string   `xml:"title"`
	Link        AtomLink `xml:"http://www.w3.org/2005/Atom link"`
	Language    string   `xml:"language"`
	Copyright   string   `xml:"copright"`
	Description string   `xml:"description"`
	Image       Image    `xml:"image"`
	Items       []Item   `xml:"item"`
}

Channel ...

type Feed

type Feed struct {
	Channel Channel `xml:"channel"`
}

Feed ...

type Image

type Image struct {
	URL   string `xml:"url"`
	Title string `xml:"title"`
	Link  string `xml:"link"`
}

Image ...

type Item

type Item struct {
	Title              string `xml:"title"`
	Description        string `xml:"description"`
	EncodedDescription string `xml:"http://purl.org/rss/1.0/modules/content/ encoded"`
	PubDate            string `xml:"pubDate"`
	GUID               string `xml:"guid"`
	Media              Media  `xml:"enclosure"`
}

Item ...

type Media

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

Media ...

Jump to

Keyboard shortcuts

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