opml

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package opml implements parsing support for Outline Processor Markup Language - an XML format for creating outlines. It has since been adopted for other uses, the most common being to exchange lists of web feeds between web feed aggregators. Baleen uses this format to read a list of web feeds from a file on disk and to exchange lists of feeds between feed aggregation tools and sites.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct {
	XMLName  xml.Name  `xml:"body" json:"-"`
	Outlines []Outline `xml:"outline" json:"outline"`
}

The Body of the OPML data.

type Head struct {
	XMLName xml.Name `xml:"head" json:"-"`
	Title   string   `xml:"title" json:"title"`
}

The Head of the OPML data.

type OPML

type OPML struct {
	XMLName xml.Name `xml:"opml" json:"-"`
	Version string   `xml:"version,attr" json:"_version"`
	Head    Head     `xml:"head" json:"head"`
	Body    Body     `xml:"body" json:"body"`
}

An OPML struct can be loaded from an OPML file using an XML processor.

func Load

func Load(path string) (outline *OPML, err error)

Load an outline from an XML file stored on disk.

func (*OPML) URLs

func (o *OPML) URLs(types ...string) []string

URLs implements Baleen's most common use for OPML: extracting all of the feed URLs from the outline documents and returning it as a slice of URL strings. This method can optionally filter by type. E.g. to specify only RSS use `o.URLs("rss")`, if no types are specified, all types are returned.

When processing the outline URLs, this method will take the XMLURL first, and if it is empty it will return the HTMLURL. If neither URL contains data it will be skipped.

type Outline

type Outline struct {
	Text    string `xml:"text,attr" json:"_text"`
	Title   string `xml:"title,attr" json:"_title"`
	Type    string `xml:"type,attr" json:"_type"`
	XMLURL  string `xml:"xmlUrl,attr" json:"_xmlUrl"`
	HTMLURL string `xml:"htmlUrl,attr" json:"_htmlUrl"`
	Favicon string `xml:"rssfr-favicon,attr" json:"-"`
}

The Outline of the OPML data - this contains the primary content for the web feed.

Jump to

Keyboard shortcuts

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