From 38c23fd9f538105c5f4860d87071f8e86dd14328 Mon Sep 17 00:00:00 2001 From: Pijus Kamandulis Date: Sun, 19 Jan 2020 16:43:32 +0200 Subject: [PATCH] Added debug option --- client/getUserUploads.go | 2 +- main.go | 1 + models/config.go | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/client/getUserUploads.go b/client/getUserUploads.go index 901fcea..bdf67a1 100644 --- a/client/getUserUploads.go +++ b/client/getUserUploads.go @@ -23,7 +23,7 @@ func GetUserUploads(username string) []models.Upload { opts := append(chromedp.DefaultExecAllocatorOptions[:], chromedp.DisableGPU, chromedp.UserDataDir(dir), - chromedp.Flag("headless", false), + chromedp.Flag("headless", models.Config.UserName), ) allocCtx, cancel := chromedp.NewExecAllocator(context.Background(), opts...) diff --git a/main.go b/main.go index 09729fe..d5332ac 100644 --- a/main.go +++ b/main.go @@ -25,6 +25,7 @@ func main() { continue } + fmt.Println("Downloading upload item '" + uploadID + "' to " + downloadPath) utils.DownloadFile(downloadPath, upload.URL) } } diff --git a/models/config.go b/models/config.go index 7bcab99..e3c6075 100644 --- a/models/config.go +++ b/models/config.go @@ -10,11 +10,13 @@ import ( var Config struct { UserName string OutputPath string + Debug bool } // GetConfig - Returns Config object func GetConfig() { outputPath := flag.String("output", "./downloads", "Output path") + debug := flag.Bool("debug", false, "enables debug mode") flag.Parse() args := flag.Args() @@ -25,4 +27,5 @@ func GetConfig() { Config.UserName = flag.Args()[len(args)-1] Config.OutputPath = *outputPath + Config.Debug = *debug }