feed

package module
v0.0.0-...-ca199a2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2016 License: LGPL-3.0 Imports: 5 Imported by: 0

README

Build Status Code Climate GoDoc Built with Spacemacs

golibri/feed

Parse any RSS/Atom feed and get the relevant article URLs.

Requirements

go get -u github.com/golibri/fetch

go get -u github.com/PuerkitoBio/goquery

go get -u github.com/mmcdole/gofeed

installation

go get -u github.com/golibri/feed

usage

import "github.com/golibri/feed"

func main() {
    f := feed.FromURL("http://example.com/whatever")
    // OR:
    f := feed.Parse("feed-xml-string")
    // f is a Feed object, see below

    // to get all article URLs directly:
    links := f.Links() // []string
}

data fields

A Feed has the following data fields:

type Feed struct {
    URL   string
    Body  string
    Items []Item
}

type Item struct {
    Title string
    URL   string
    Text  string
    Image string
}

license

LGPLv3. (You can use it in commercial projects as you like, but improvements/bugfixes must flow back to this lib.)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Feed

type Feed struct {
	URL   string
	Body  string
	Items []Item
}

Feed represents an Atom/RSS feed's important data

func FromURL

func FromURL(URL string) (Feed, error)

FromURL parses a RSS/Atom feed directly from a given URL

func Parse

func Parse(XML string) (Feed, error)

Parse executes an XML string containing RSS/Atom Data and returns a Feed{}

func (f *Feed) Links() []string

Links collects all item URLs and returns them as an array

func (f *Feed) NewLinks(oldFeed *Feed) []string

NewLinks shows only URLs that are present in this Feed and not in the old one

type Item

type Item struct {
	Title string
	URL   string
	Text  string
	Image string
}

Item is a single entry within a Feed

Jump to

Keyboard shortcuts

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