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 (*FeedWatcher) NewLinks ¶
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 (*RemoteFeed) NewItemsLinks ¶
func (rf *RemoteFeed) NewItemsLinks(sinceDate time.Time, feedParserFunction FeedParser) ([]string, error)
NewItemsLinks returns the feed new items links since the given date
type RemoteFeedItem ¶
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 (*RemoteFeedItem) DownloadLink ¶
func (rfi *RemoteFeedItem) DownloadLink(extractor FeedExtractor) string
DownloadLink extracts the link from a RemoteFeedItem thanks to a given FeedExtractor