rss2

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2016 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	// Optional according to Dave Winer
	Title string `xml:"title" json:"title,omitempty"`
	// Required
	Link string `xml:"link" json:"link"`
	// Optional
	Description template.HTML `xml:"description" json:"description,omitempty"`
	Content     template.HTML `xml:"encoded" json:"encoded,omitempty"`
	PubDate     string        `xml:"pubDate" json:"pubDate,omitempty"`
	Comments    string        `xml:"comments" json:"comments,omitempty"`
}

type RSS2

type RSS2 struct {
	XMLName xml.Name `xml:"rss" json:"-"`
	Version string   `xml:"version,attr" json:"version"`
	// Required
	Title       string `xml:"channel>title" json:"title"`
	Link        string `xml:"channel>link" json:"link"`
	Description string `xml:"channel>description" json:"description"`
	// Optional
	PubDate  string `xml:"channel>pubDate" json:"pubDate,omitempty"`
	ItemList []Item `xml:"channel>item" json:"item,omitempty"`
}

func Parse

func Parse(buf []byte) (*RSS2, error)

Parse return an RSS2 document as a RSS2 structure.

func (*RSS2) Filter

func (r *RSS2) Filter(dataPath string) (map[string]interface{}, error)

Filter given an RSS2 document return all the entries matching so we can apply some sort of data path e.g. .version, .channel.title, .channel.link, .item[].link, .item[].guid, .item[].title, .item[].description

Jump to

Keyboard shortcuts

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