2020-01-19 04:11:53 +02:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Config - Runtime configuration
|
|
|
|
var Config struct {
|
2020-01-19 17:54:16 +02:00
|
|
|
URL string
|
2020-01-19 04:11:53 +02:00
|
|
|
OutputPath string
|
2020-01-19 16:43:32 +02:00
|
|
|
Debug bool
|
2020-01-19 04:11:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetConfig - Returns Config object
|
|
|
|
func GetConfig() {
|
|
|
|
outputPath := flag.String("output", "./downloads", "Output path")
|
2020-01-19 16:43:32 +02:00
|
|
|
debug := flag.Bool("debug", false, "enables debug mode")
|
2020-01-19 04:11:53 +02:00
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
args := flag.Args()
|
|
|
|
if len(args) < 1 {
|
2020-01-19 17:54:16 +02:00
|
|
|
fmt.Println("Usage: tiktok-dl [OPTIONS] TIKTOK_USERNAME|TIKTOK_URL")
|
2020-01-19 04:11:53 +02:00
|
|
|
os.Exit(2)
|
|
|
|
}
|
|
|
|
|
2020-01-19 17:54:16 +02:00
|
|
|
Config.URL = flag.Args()[len(args)-1]
|
2020-01-19 04:11:53 +02:00
|
|
|
Config.OutputPath = *outputPath
|
2020-01-19 16:43:32 +02:00
|
|
|
Config.Debug = *debug
|
2020-01-19 04:11:53 +02:00
|
|
|
}
|