rss

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package rss provides a RSS parser

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Get(url string) (resp *http.Response, err error)
}

Client is a http client to crawl the feed from (#)

type Image

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

Image contains the URL and title of the podcast logo

type Item

type Item struct {
	Title       string          `xml:"title"`
	Link        string          `xml:"link"`
	Comments    string          `xml:"comments"`
	PubDate     string          `xml:"pubDate"`
	GUID        string          `xml:"guid"`
	Category    []string        `xml:"category"`
	Enclosure   []ItemEnclosure `xml:"enclosure"`
	Description string          `xml:"description"`
	Content     string          `xml:"content"`
}

Item represents an episode with all of its content

func (*Item) Time

func (episode *Item) Time() time.Time

Time returns the specified publication date as time.Time

type ItemEnclosure

type ItemEnclosure struct {
	URL  string `xml:"url,attr"`
	Type string `xml:"type,attr"`
}

ItemEnclosure contains an URL and its MIME-Type of an episode file

type Main

type Main struct {
	Title         string `xml:"title"`
	Link          string `xml:"link"`
	Copyright     string `xml:"copyright"`
	Description   string `xml:"description"`
	Generator     string `xml:"generator"`
	Language      string `xml:"language"`
	LastBuildDate string `xml:"lastBuildDate"`
	Items         []Item `xml:"item"`
	Image         Image  `xml:"image"`
}

Main struct represents the root of the RSS feed

func Read

func Read(url string) (*Main, error)

Read reads from an URL with the Golang default http client and returns rss.Main

func ReadCustomClient

func ReadCustomClient(url string, client Client) (*Main, error)

ReadCustomClient allows to read with an custom http client

func (*Main) Len

func (rss *Main) Len() int

Len returns the episode count

func (*Main) Time

func (rss *Main) Time() time.Time

Time returns the specified last build date as time.Time

Jump to

Keyboard shortcuts

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