feedwatcher

package
v1.0.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirectDownload

type DirectDownload struct {
	// contains filtered or unexported fields
}

DirectDownload is an extractor for directdownload.tv

func (*DirectDownload) Extract

func (dd *DirectDownload) Extract(feedItem *RemoteFeedItem) string

Extract extracts links from DirectDownload feed items

func (*DirectDownload) Init

func (dd *DirectDownload) Init() error

Init sets up various extractor's internals

func (*DirectDownload) SetOptions

func (dd *DirectDownload) SetOptions(options interface{}) error

SetOptions validates and defines the options for DirectDownload

func (*DirectDownload) SourceURL

func (dd *DirectDownload) SourceURL() string

SourceURL returns DirectDownload host

type FeedExtractor

type FeedExtractor interface {
	Init() error
	SetOptions(options interface{}) error
	SourceURL() string
	Extract(feedItem *RemoteFeedItem) string
}

FeedExtractor takes feed items and return urls to download

func NewFeedExtractor

func NewFeedExtractor(name string, options interface{}) (FeedExtractor, error)

NewFeedExtractor returns an extractor with some options

type FeedParser

type FeedParser func(feedURL string) ([]*RemoteFeedItem, error)

FeedParser abstracts a basic parser function

type FeedWatcher

type FeedWatcher struct {
	Feeds     []RemoteFeed
	Parser    FeedParser
	SinceDate time.Time
	Scenario  *dispatcher.Scenario
	// contains filtered or unexported fields
}

FeedWatcher is the main process struct

func NewFeedWatcher

func NewFeedWatcher(interval time.Duration) (*FeedWatcher, error)

NewFeedWatcher returns a FeedWatcher for a given time interval

func (fw *FeedWatcher) NewLinks(sinceDate time.Time) ([]string, error)

NewLinks returns new links across all feeds

func (*FeedWatcher) Run

func (fw *FeedWatcher) Run(maxRunCount int) (string, error)

Run starts the FeedWatcher cycle.

It gets new links every tick based on FeedWatcher's interval.

If you want it to stop after a certain number of iteration, use maxRunCount, otherwise, it will run forever.

If run is stopped (maxRunCount > 0), then it return a summary of the run

func (*FeedWatcher) SetTeller

func (fw *FeedWatcher) SetTeller(teller *teller.Teller) *FeedWatcher

SetTeller defines the teller used to report the feed watcher adventures

type RemoteFeed

type RemoteFeed struct {
	Title           string                 // Remote feed title
	URL             string                 // URL to the feed
	Provider        string                 // The feed provider
	ProviderOptions config.ProviderOptions // The feed provider options
	// contains filtered or unexported fields
}

RemoteFeed is the access informations of a feed on the Internet

func (*RemoteFeed) NewItems

func (rf *RemoteFeed) NewItems(sinceDate time.Time, feedParserFunction FeedParser) ([]*RemoteFeedItem, error)

NewItems returns the feed new items since the given date

func (rf *RemoteFeed) NewItemsLinks(sinceDate time.Time, feedParserFunction FeedParser) ([]string, error)

NewItemsLinks returns the feed new items links since the given date

type RemoteFeedItem

type RemoteFeedItem struct {
	Title       string
	Link        string
	Description string
	PublishedAt time.Time
}

RemoteFeedItem represents a simplified RSS item Here we only includes relevant infos for future download

func GofeedParser

func GofeedParser(feedURL string) ([]*RemoteFeedItem, error)

GofeedParser is a an abstraction of the gofeed library returning feed items

func (rfi *RemoteFeedItem) DownloadLink(extractor FeedExtractor) string

DownloadLink extracts the link from a RemoteFeedItem thanks to a given FeedExtractor

Jump to

Keyboard shortcuts

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