From 25377ebd48f0bbb4011ad89bdfcd4f2653483987 Mon Sep 17 00:00:00 2001 From: Eugen Eisler Date: Thu, 12 Sep 2024 18:25:14 +0200 Subject: [PATCH] feat: improve Youttube support. Print transcript and/or comments. Don't send them to AI if pattern is not defined. --- cli/cli.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cli/cli.go b/cli/cli.go index 1a5d4f4..ef2eec5 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -113,12 +113,14 @@ func Cli() (message string, err error) { return } - if currentFlags.YouTubeTranscript { + if !currentFlags.YouTubeComments || currentFlags.YouTubeTranscript { var transcript string if transcript, err = fabric.YouTube.GrabTranscript(videoId); err != nil { return } + fmt.Println(transcript) + if currentFlags.Message != "" { currentFlags.Message = currentFlags.Message + "\n" + transcript } else { @@ -134,12 +136,19 @@ func Cli() (message string, err error) { commentsString := strings.Join(comments, "\n") + fmt.Println(commentsString) + if currentFlags.Message != "" { currentFlags.Message = currentFlags.Message + "\n" + commentsString } else { currentFlags.Message = commentsString } } + + if currentFlags.Pattern == "" { + // if the pattern flag is not set, we wanted only to grab the transcript or comments + return + } } var chatter *core.Chatter