app

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheGetChannelPrefix  = "youtube-channel-"
	CacheGetChannelTtl     = time.Hour * 24 * 31
	CacheListChannelPrefix = "youtube-channels-q-"
	CacheListChannelTtl    = time.Hour * 24
)
View Source
const (
	FormatsNotFound     = "no formats available that match criteria"
	YoutubeVideoBaseURL = "https://www.youtube.com/watch?v="
)
View Source
const (
	CacheTTL = time.Hour * 24
)
View Source
const (
	Generator = "YouTubeGoesPodcast/v2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheService

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

func NewCacheService

func NewCacheService(cache cacheRepository) CacheService

func (*CacheService) Get

func (c *CacheService) Get(key string, to interface{}) error

Get looks for object via key in cache

func (*CacheService) MarshalAndSet

func (c *CacheService) MarshalAndSet(key string, value interface{}) error

MarshalAndSetKey is the same as SetKey but before that it marshals value. Simple helper

func (*CacheService) Set

func (c *CacheService) Set(key string, value interface{}) error

Set is the same as SetKey but before that it marshals value. Simple helper

type Feed

type Feed struct {
	ChannelID string
	Content   podcast.Podcast
}

func (*Feed) Serialize

func (f *Feed) Serialize() ([]byte, error)

type FeedItem

type FeedItem struct {
	ID          string
	GUID        string
	Title       string
	Link        *url.URL
	Description string
	PubDate     time.Time
	FileURL     *url.URL
	FileLength  int64
	FileType    string
	Duration    time.Duration
	IsExplicit  bool
}

func (FeedItem) IsValid

func (item FeedItem) IsValid() bool

type FeedService

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

func NewFeedService

func NewFeedService(
	youtubeService YouTubeDependency,
	ytdlService YTDLDependencies,
) FeedService

func (FeedService) Create

func (f FeedService) Create(channelID string) (Feed, error)

func (FeedService) CreateItems

func (f FeedService) CreateItems(items []YouTubeFeedEntry) ([]FeedItem, error)

func (*FeedService) Enrich

func (f *FeedService) Enrich(item FeedItem) (FeedItem, error)

func (*FeedService) GetFeedInformation added in v1.2.1

func (f *FeedService) GetFeedInformation(channelID string) (podcast.Podcast, error)

type YTDLDependencies

type YTDLDependencies interface {
	GetFileURL(info *ytdl.VideoInfo) (url.URL, error)
	GetFileInformation(videoId string) (YTDLVideo, error)
}

type YTDLService

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

func NewYTDLService

func NewYTDLService(ytdl ytdlRepository) YTDLService

func (YTDLService) GetFileInformation

func (y YTDLService) GetFileInformation(videoId string) (YTDLVideo, error)

func (YTDLService) GetFileURL

func (y YTDLService) GetFileURL(info *ytdl.VideoInfo) (url.URL, error)

type YTDLVideo

type YTDLVideo struct {
	ID            string
	URL           *url.URL
	FileUrl       *url.URL
	Description   string
	Title         string
	DatePublished time.Time
	Keywords      []string
	Author        string
	Duration      time.Duration
	ContentType   string
	ContentLength int64
	// contains filtered or unexported fields
}

type YouTubeChannel

type YouTubeChannel struct {
	Author      string
	AuthorEmail string
	ChannelId   string
	Country     string
	Description string
	PublishedAt time.Time
	Thumbnail   YouTubeThumbnail
	Title       string
	Url         string
	Category    string
}

YouTubeChannel holds metadata about channel

type YouTubeDependency

type YouTubeDependency interface {
	ListEntry(string) ([]YouTubeFeedEntry, error)
	GetChannelCache(string) (YouTubeChannel, error)
}

type YouTubeFeedEntry

type YouTubeFeedEntry struct {
	ID          string
	Title       string
	Description string
	Published   time.Time
	URL         url.URL
	Thumbnail   YouTubeThumbnail
}

type YouTubeService

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

func NewYouTubeService

func NewYouTubeService(ytRepo youTubeRepository, ytApiRepo youTubeApiRepository, cache CacheService) YouTubeService

func (YouTubeService) GetChannel

func (y YouTubeService) GetChannel(channelId string) (YouTubeChannel, error)

func (YouTubeService) GetChannelCache

func (y YouTubeService) GetChannelCache(channelId string) (YouTubeChannel, error)

func (YouTubeService) ListChannel

func (y YouTubeService) ListChannel(query string) ([]YouTubeChannel, error)

func (YouTubeService) ListChannelCache

func (y YouTubeService) ListChannelCache(query string) ([]YouTubeChannel, error)

func (YouTubeService) ListEntry

func (y YouTubeService) ListEntry(channelId string) ([]YouTubeFeedEntry, error)

type YouTubeThumbnail added in v1.2.1

type YouTubeThumbnail struct {
	Height int
	Width  int
	Url    url.URL
}

Jump to

Keyboard shortcuts

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