Documentation ¶
Index ¶
- Constants
- Variables
- func Build(c *cli.Context, cmdBuilder runner.Builder, items []*VideoData, ...) error
- func CmdChannel(cmdBuilder runner.Builder) func(c *cli.Context) error
- func CmdPlaylist(cmdBuilder runner.Builder) func(c *cli.Context) error
- func Completion(c *cli.Context)
- func ContainsString(needle string, haystack []string) bool
- func RootCompletion(c *cli.Context)
- type ChannelInfo
- type ChannelScraper
- type DirectoryCleaner
- type Downloader
- type PlaylistScraper
- type VideoData
- type XMLBuilder
Constants ¶
const Name string = "feedTube"
Name is the name of this program
const Version string = "0.3.1"
Version is the current version
Variables ¶
var Commands = []cli.Command{ { Name: "channel", Aliases: []string{"c"}, Usage: "Builds your rss file from a youtube channel", Action: CmdChannel(runner.Real{}), BashComplete: Completion, Flags: append( flags, cli.StringFlag{ Name: "after, a", Usage: "Only process videos after a given date", }, ), }, { Name: "playlist", Aliases: []string{"p"}, Usage: "Builds your rss file from a youtube playlist", Action: CmdPlaylist(runner.Real{}), BashComplete: Completion, Flags: flags, }, }
Commands defines the commands that can be called on hostBuilder
var YoutubeAPIURLBase = "https://www.googleapis.com/youtube/v3/"
YoutubeAPIURLBase is the base url to use for the youtube API. This should only be changed for tests.
Functions ¶
func CmdChannel ¶
CmdChannel builds an rss feed from a youtube channel
func CmdPlaylist ¶
CmdPlaylist builds an rss feed from a youtube playlist
func Completion ¶
Completion handles bash completion for the commands
func ContainsString ¶ added in v0.3.1
ContainsString searches a string slice to see if it contains a given string
func RootCompletion ¶ added in v0.3.1
RootCompletion prints the list of root commands as the root completion method This is similar to the default method, but it excludes aliases
Types ¶
type ChannelInfo ¶ added in v0.3.1
ChannelInfo contains the metadata for a channel
type ChannelScraper ¶ added in v0.3.1
type ChannelScraper struct {
// contains filtered or unexported fields
}
ChannelScraper retrieves data about youtube videos
func NewChannelScraper ¶ added in v0.3.1
func NewChannelScraper(apiKey string) *ChannelScraper
NewChannelScraper returns a YoutubeScraper
func (ChannelScraper) GetVideosForChannel ¶ added in v0.3.1
func (scraper ChannelScraper) GetVideosForChannel(channelName, after string) ([]*VideoData, *ChannelInfo, error)
GetVideosForChannel returns an array of all the youtube video ids on a channel
type DirectoryCleaner ¶ added in v0.3.1
type DirectoryCleaner struct {
// contains filtered or unexported fields
}
DirectoryCleaner cleans up unrelated files
func NewDirectoryCleaner ¶ added in v0.3.1
func NewDirectoryCleaner(outputFolder string) *DirectoryCleaner
NewDirectoryCleaner returns a new directoryCleaner
func (DirectoryCleaner) CleanupUnrelatedFiles ¶ added in v0.3.1
func (cleaner DirectoryCleaner) CleanupUnrelatedFiles(relatedFiles []string, writer io.Writer) error
CleanupUnrelatedFiles searches the outputFolder for files that are not in relatedFiles and deletes them
type Downloader ¶ added in v0.3.1
type Downloader struct {
// contains filtered or unexported fields
}
Downloader downloads youtube videos
func NewDownloader ¶ added in v0.3.1
func NewDownloader(cmdBuilder runner.Builder, outputFolder string, quality string) *Downloader
NewDownloader returns a new Downloader
func (Downloader) DownloadVideos ¶ added in v0.3.1
func (downloader Downloader) DownloadVideos(items []*VideoData) error
DownloadVideos downloads any items that are not already in outputfolder
type PlaylistScraper ¶ added in v0.3.1
type PlaylistScraper struct {
// contains filtered or unexported fields
}
PlaylistScraper retrieves data about youtube videos
func NewPlaylistScraper ¶ added in v0.3.1
func NewPlaylistScraper(apiKey string) *PlaylistScraper
NewPlaylistScraper returns a YoutubeScraper
func (PlaylistScraper) GetVideosForPlaylist ¶ added in v0.3.1
func (scraper PlaylistScraper) GetVideosForPlaylist(playlistID string) ([]*VideoData, *ChannelInfo, error)
GetVideosForPlaylist returns an array of all the youtube video ids in a playlist
type VideoData ¶ added in v0.3.1
type VideoData struct { GUID string Link string Title string Description string FileName string Image string PubDate time.Time }
VideoData holds all the data that we scrape from YouTube
type XMLBuilder ¶ added in v0.3.1
type XMLBuilder struct {
// contains filtered or unexported fields
}
XMLBuilder handles building RSS XML
func NewXMLBuilder ¶ added in v0.3.1
func NewXMLBuilder(cmdBuilder runner.Builder, xmlFileName, outputFolder, baseURL, generator string, channelInfo *ChannelInfo) *XMLBuilder
NewXMLBuilder returns a new XMLBuilder
func (XMLBuilder) BuildRss ¶ added in v0.3.1
func (xmlBuilder XMLBuilder) BuildRss(items []*VideoData) error
BuildRss builds an RSS XML feed from an list of VideoData