summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2025-04-13 19:44:45 +0530
committerBobby <[email protected]>2025-04-13 19:44:45 +0530
commit3991efdfccc59fe59184f1c75d3d9bf72d2bccfa (patch)
tree94e160e2f1f0e043c393678d1c73645c8a4517e4
parent703eee6eb2802c126c529f8b74e7b740ca84831b (diff)
downloadai-3991efdfccc59fe59184f1c75d3d9bf72d2bccfa.tar.xz
ai-3991efdfccc59fe59184f1c75d3d9bf72d2bccfa.zip
added yt-dlp cookie logging
-rw-r--r--utils/music/voice.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/utils/music/voice.go b/utils/music/voice.go
index f5ac03a..8b4779e 100644
--- a/utils/music/voice.go
+++ b/utils/music/voice.go
@@ -193,9 +193,30 @@ func (v *VoiceInstance) PlayYouTube(videoURL, videoID string) error {
var downloadCmd *exec.Cmd
cookiesFile := "./cookies/cookies.txt"
if _, err := os.Stat(cookiesFile); err == nil {
+ logger.Log("Using cookies file: "+cookiesFile, types.LogOptions{
+ Prefix: "Music Player",
+ Level: types.Debug,
+ })
+ // log the cookies file data
+ cookiesData, err := os.ReadFile(cookiesFile)
+ if err != nil {
+ logger.Log("Error reading cookies file: "+err.Error(), types.LogOptions{
+ Prefix: "Music Player",
+ Level: types.Error,
+ })
+ }
+
+ logger.Log("Cookies file data: "+string(cookiesData), types.LogOptions{
+ Prefix: "Music Player",
+ Level: types.Debug,
+ })
downloadCmd = exec.Command("yt-dlp", "--no-warnings", "--quiet", "-x", "--audio-format", "mp3",
"--audio-quality", "0", "--no-playlist", "--cookies", cookiesFile, "--output", fileName, videoURL)
} else {
+ logger.Log("No cookies file found, downloading without cookies", types.LogOptions{
+ Prefix: "Music Player",
+ Level: types.Debug,
+ })
downloadCmd = exec.Command("yt-dlp", "--no-warnings", "--quiet", "-x", "--audio-format", "mp3",
"--audio-quality", "0", "--no-playlist", "--output", fileName, videoURL)
}