rss

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllFeedsName = "All Feeds"

AllFeedsName is the name of the all feeds category

View Source
var Default = Rss{
	Categories: []Category{{
		Name:        AllFeedsName,
		Description: "All feeds",
		Subscriptions: []Feed{{
			Name:        "BBC",
			Description: "News from the BBC",
			URL:         "http://feeds.bbci.co.uk/news/rss.xml",
		}},
	}, {
		Name:        "News",
		Description: "News from around the world",
		Subscriptions: []Feed{{
			Name:        "Wired",
			Description: "News from the wired team",
			URL:         "https://www.wired.com/feed/rss",
		}},
	}, {
		Name:        "Tech",
		Description: "Tech news",
		Subscriptions: []Feed{{
			Name:        "Chris Titus Tech (virtualization)",
			Description: "Chris Titus Tech on virtualization",
			URL:         "https://christitus.com/categories/virtualization/index.xml",
		}},
	}},
}

Default is the default rss structure

View Source
var DefaultCategoryDescription = "News from around the world"

DefaultCategoryDescription is the description of the default category

View Source
var DefaultCategoryName = "News"

DefaultCategoryName is the name of the default category

View Source
var DownloadedFeedsName = "Saved"

DownloadedFeedsName is the name of the downloaded feeds category

View Source
var ErrAlreadyExists = errors.New("already exists")
View Source
var ErrEmptyName = errors.New("empty name")
View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned when a feed or category is not found

View Source
var ErrReservedName = errors.New("reserved name")
View Source
var ErrTooManyItems = errors.New("too many items")

Functions

func HTMLToMarkdown

func HTMLToMarkdown(content string) (string, error)

HTMLToMarkdown converts html to markdown using the html-to-markdown library

func HTMLToText

func HTMLToText(content string) (string, error)

HTMLToText converts html to text using the goquery library

func YassifyItem

func YassifyItem(item *gofeed.Item) string

YassifyItem will return a yassified string which is used in the viewport to view a single item

Types

type Category

type Category struct {
	Name          string `yaml:"name"`
	Description   string `yaml:"desc"`
	Subscriptions []Feed `yaml:"subscriptions"`
}

Category will be used to structurize the rss feeds

type Feed

type Feed struct {
	Name        string `yaml:"name"`
	Description string `yaml:"desc"`
	URL         string `yaml:"url"`
}

Feed is a single rss feed

type Rss

type Rss struct {
	Categories []Category `yaml:"categories"`
	// contains filtered or unexported fields
}

Rss will be used to structurize the rss feeds and categories

func New

func New(path string) (*Rss, error)

New will create a new Rss structure

func (*Rss) AddCategory

func (rss *Rss) AddCategory(name string, description string) error

AddCategory will add a category to the Rss structure

func (*Rss) AddFeed

func (rss *Rss) AddFeed(category string, name string, url string) error

AddFeed will add a feed to the Rss structure

func (*Rss) ExportOPML added in v1.5.1

func (rss *Rss) ExportOPML(path string) error

ExportOPML will export the urls to an opml file.

func (Rss) GetAllURLs

func (rss Rss) GetAllURLs() []string

GetAllURLs will return a list of all the urls

func (Rss) GetFeedURL

func (rss Rss) GetFeedURL(feedName string) (string, error)

GetFeedURL will return the url of a feed denoted by the name

func (Rss) GetFeeds

func (rss Rss) GetFeeds(categoryName string) ([]Feed, error)

GetFeeds will return a list of all subscriptions in a category

func (*Rss) Load

func (rss *Rss) Load() error

Load will try to load the Rss structure from a file

func (*Rss) LoadOPML added in v1.5.1

func (rss *Rss) LoadOPML(path string) error

LoadOPML will load the urls from an opml file.

func (*Rss) RemoveCategory

func (rss *Rss) RemoveCategory(name string) error

RemoveCategory will remove a category from the Rss structure

func (*Rss) RemoveFeed

func (rss *Rss) RemoveFeed(category string, name string) error

RemoveFeed will remove a feed from the Rss structure

func (Rss) Save

func (rss Rss) Save() error

Save will write the Rss structure to a file

func (*Rss) UpdateCategory

func (rss *Rss) UpdateCategory(key, name, desc string) error

UpdateCategory will change the name/description of a category by a string key

func (*Rss) UpdateFeed

func (rss *Rss) UpdateFeed(category, key, name, url string) error

UpdateFeed will change the name/url of a feed by a string key and a category

Jump to

Keyboard shortcuts

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