parser

package
v0.0.0-...-95c851e Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RFC1123NoSecond      = "Mon, 02 Jan 2006 15:04 MST"
	HackerNewsTimeFormat = "Mon, _2 Jan 2006 15:04:05 -0700"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	Title       string
	Description string
	Link        string
	Guid        string
	Date        time.Time
}

type Feed

type Feed struct {
	Title       string
	Description string
	SiteLink    string
	HubLink     string
	Image       Image
	Articles    []Article
	TTL         time.Duration
	SkipHours   map[int]bool
	SkipDays    map[string]bool
}

func ParseAtom

func ParseAtom(b []byte) (Feed, error)

func ParseFeed

func ParseFeed(source []byte, funcs ...func([]byte) (Feed, error)) (Feed, error)

func ParseRss1

func ParseRss1(b []byte) (Feed, error)

func ParseRss2

func ParseRss2(b []byte) (Feed, error)

type Image

type Image struct {
	Title  string
	Url    string
	Width  int
	Height int
}

type Opml

type Opml struct {
	Feeds []OpmlFeed
}

func ParseOpml

func ParseOpml(content []byte) (Opml, error)

type OpmlBody

type OpmlBody struct {
	Outline []OpmlOutline `xml:"outline"`
}

type OpmlFeed

type OpmlFeed struct {
	Title string
	URL   string
	Tags  []string
}

type OpmlHead

type OpmlHead struct {
	Title string `xml:"title"`
}

type OpmlOutline

type OpmlOutline struct {
	Type     string        `xml:"type,attr,omitempty"`
	Text     string        `xml:"text,attr,omitempty"`
	Title    string        `xml:"title,attr,omitempty"`
	XmlUrl   string        `xml:"xmlUrl,attr,omitempty"`
	HtmlUrl  string        `xml:"htmlUrl,attr,omitempty"`
	URL      string        `xml:"url,attr,omitempty"`
	Category string        `xml:"category,attr,omitempty"`
	Outline  []OpmlOutline `xml:"outline"`
}

type OpmlXml

type OpmlXml struct {
	XMLName xml.Name `xml:"opml"`
	Version string   `xml:"version,attr"`
	Head    OpmlHead `xml:"head"`
	Body    OpmlBody `xml:"body"`
}

type RssItem

type RssItem struct {
	XMLName     xml.Name   `xml:"item"`
	Id          string     `xml:"guid"`
	Title       string     `xml:"title"`
	Link        string     `xml:"link"`
	Description rssContent `xml:"description"`
	Content     rssContent `xml:"http://purl.org/rss/1.0/modules/content/ encoded"`
	PubDate     string     `xml:"pubDate"`
	Date        string     `xml:"date"`
	TTL         int        `xml:"ttl"`
	SkipHours   []int      `xml:"skipHours>hour"`
	SkipDays    []string   `xml:"skipDays>day"`
}

RssItem is the base content for both rss1 and rss2 feeds. The only reason it's public is because of the refrect package

Jump to

Keyboard shortcuts

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