34 lines
704 B
Go
34 lines
704 B
Go
package video
|
|
|
|
import (
|
|
"github.com/eat-pray-ai/yutu/pkg/yutuber/video"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var rateCmd = &cobra.Command{
|
|
Use: "rate",
|
|
Short: "rate a video on YouTube",
|
|
Long: "rate a video on YouTube, with the specified rating",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
v := video.NewVideo(
|
|
video.WithId(id),
|
|
video.WithRating(rating),
|
|
video.WithService(),
|
|
)
|
|
v.Rate()
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
videoCmd.AddCommand(rateCmd)
|
|
|
|
rateCmd.Flags().StringVarP(&id, "id", "i", "", "ID of the video")
|
|
rateCmd.Flags().StringVarP(
|
|
&rating, "rating", "r", "", "Rating of the video: like, dislike or none",
|
|
)
|
|
|
|
rateCmd.MarkFlagRequired("id")
|
|
rateCmd.MarkFlagRequired("rating")
|
|
}
|