package ytdl import ( "bytes" "encoding/json" "os/exec" "github.com/spf13/viper" ) func GetMetadata(url string) (Metadata, error) { cmd := exec.Command( viper.GetString("ytdlp_path"), "-J", "--cookies-from-browser", "firefox", url, ) var out bytes.Buffer cmd.Stdout = &out if err := cmd.Run(); err != nil { return Metadata{}, err } var meta Metadata if err := json.Unmarshal(out.Bytes(), &meta); err != nil { return Metadata{}, err } return meta, nil }