rssreader

package
v0.0.0-...-cb0f7e9 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2019 License: MIT Imports: 10 Imported by: 0

README

RSS Reader package.

Allows to read multiple RSS feeds in parallel. Returns array of RssItem and error object. Keep in mind, as there are multiple RSS feeds possible, method Parse will not fail in case of errors. It will return all successfully parsed items and errors for the rest of feeds failed to read.

Supported RSS protocol versions:

  • RSS2.0

Usage example:

import (
    os

	"github.com/toorosan/rss/pkg/rssreader"
)

func main() {
	urls := []string{"https://www.feedforall.com/sample.xml", "https://www.feedforall.com/sample-feed.xml"}
	results, err := rssreader.Parse(urls)
	for _, item := range results {
		println(item.String())
	}
	if err != nil {
		println("following errors occured:\n", err.Error())
        os.exit(1)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RssItem

type RssItem struct {
	Title       string
	Source      string
	SourceURL   string
	Link        string
	PubishDate  time.Time
	Description string
}

RssItem describes single RSS item.

func Parse

func Parse(urls []string) ([]RssItem, error)

Parse holds main logic for parsing multiple urls. For now simply log all the errors, try to return anything.

func (RssItem) String

func (ri RssItem) String() string

Jump to

Keyboard shortcuts

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