diff --git a/pkg/yutuber/channel.go b/pkg/yutuber/channel.go index 7bc1f31..d9bfe6d 100644 --- a/pkg/yutuber/channel.go +++ b/pkg/yutuber/channel.go @@ -12,10 +12,10 @@ import ( ) var ( - service *youtube.Service = auth.NewY2BService() - part []string = []string{"snippet", "statistics"} - errGetChannel error = errors.New("failed to get channel") - errUpdateChannel error = errors.New("failed to update channel") + service *youtube.Service + part []string = []string{"snippet", "statistics"} + errGetChannel error = errors.New("failed to get channel") + errUpdateChannel error = errors.New("failed to update channel") ) type Channel struct { @@ -35,6 +35,7 @@ type ChannelOption func(*Channel) func NewChannel(opts ...ChannelOption) *Channel { c := &Channel{} + service = auth.NewY2BService() for _, opt := range opts { opt(c) diff --git a/pkg/yutuber/playlist.go b/pkg/yutuber/playlist.go index 399c24a..6689ba8 100644 --- a/pkg/yutuber/playlist.go +++ b/pkg/yutuber/playlist.go @@ -5,6 +5,7 @@ import ( "fmt" "log" + "github.com/eat-pray-ai/yutu/pkg/auth" "github.com/eat-pray-ai/yutu/pkg/utils" "google.golang.org/api/youtube/v3" @@ -37,6 +38,7 @@ type PlaylistOption func(*Playlist) func NewPlaylist(opts ...PlaylistOption) *Playlist { p := &Playlist{} + service = auth.NewY2BService() for _, opt := range opts { opt(p) diff --git a/pkg/yutuber/playlistItem.go b/pkg/yutuber/playlistItem.go index 48562d7..172c87d 100644 --- a/pkg/yutuber/playlistItem.go +++ b/pkg/yutuber/playlistItem.go @@ -5,6 +5,7 @@ import ( "fmt" "log" + "github.com/eat-pray-ai/yutu/pkg/auth" "github.com/eat-pray-ai/yutu/pkg/utils" "google.golang.org/api/youtube/v3" ) @@ -36,6 +37,7 @@ type PlaylistItemOption func(*PlaylistItem) func NewPlaylistItem(opts ...PlaylistItemOption) *PlaylistItem { p := &PlaylistItem{} + service = auth.NewY2BService() for _, opt := range opts { opt(p) diff --git a/pkg/yutuber/video.go b/pkg/yutuber/video.go index e0a9393..73155ea 100644 --- a/pkg/yutuber/video.go +++ b/pkg/yutuber/video.go @@ -6,6 +6,7 @@ import ( "log" "os" + "github.com/eat-pray-ai/yutu/pkg/auth" "github.com/eat-pray-ai/yutu/pkg/utils" "google.golang.org/api/youtube/v3" ) @@ -48,6 +49,8 @@ type VideoOption func(*Video) func NewVideo(opts ...VideoOption) *Video { v := &Video{} + service = auth.NewY2BService() + for _, opt := range opts { opt(v) }