app

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	YoutubeVideoBaseURL   = "https://www.youtube.com/watch?v="
	DialTimeout           = 30
	DialKeepAlive         = 30
	IdleConnTimeout       = 60
	TLSHandshakeTimeout   = 10
	ExpectContinueTimeout = 1
)
View Source
const (
	CacheGetChannelPrefix  = "youtube-channel-"
	CacheListChannelPrefix = "youtube-channels-q-"
)
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(ctx context.Context, key string, to interface{}) error

Get looks for object via key in cache

func (*CacheService) MarshalAndSet

func (c *CacheService) MarshalAndSet(ctx context.Context, key string, value interface{})

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

func (*CacheService) Set

func (c *CacheService) Set(ctx context.Context, key string, value interface{}) error

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

type Details added in v1.8.1

type Details struct {
	URL     url.URL
	Quality string
}

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,
	fileService YTDLDependencies,
) FeedService

func (FeedService) Create

func (f FeedService) Create(ctx context.Context, channelID string) (Feed, error)

func (FeedService) CreateItems

func (f FeedService) CreateItems(ctx context.Context, items []YouTubeFeedEntry) ([]FeedItem, error)

func (*FeedService) Enrich

func (f *FeedService) Enrich(ctx context.Context, item FeedItem) (FeedItem, error)

func (*FeedService) GetFeedInformation added in v1.2.1

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

type FileService added in v1.8.1

type FileService struct{}

func NewFileService added in v1.8.1

func NewFileService() FileService

func (FileService) GetDetails added in v1.8.1

func (f FileService) GetDetails(ctx context.Context, videoID string) (Details, error)

type YTDLDependencies

type YTDLDependencies interface {
	GetDetails(ctx context.Context, videoID string) (Details, error)
}

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(context.Context, string) ([]YouTubeFeedEntry, error)
	GetChannelCache(context.Context, 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(ctx context.Context, channelID string) (YouTubeChannel, error)

func (YouTubeService) GetChannelCache

func (y YouTubeService) GetChannelCache(ctx context.Context, channelID string) (YouTubeChannel, error)

func (YouTubeService) ListChannel

func (y YouTubeService) ListChannel(ctx context.Context, query string) ([]YouTubeChannel, error)

func (YouTubeService) ListChannelCache

func (y YouTubeService) ListChannelCache(ctx context.Context, query string) ([]YouTubeChannel, error)

func (YouTubeService) ListEntry

func (y YouTubeService) ListEntry(ctx context.Context, 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