Added ability to download single videos

This commit is contained in:
Pijus Kamandulis
2020-01-19 17:54:16 +02:00
parent 38c23fd9f5
commit 39cfeb40fb
8 changed files with 150 additions and 20 deletions

View File

@@ -8,7 +8,7 @@ import (
// Config - Runtime configuration
var Config struct {
UserName string
URL string
OutputPath string
Debug bool
}
@@ -21,11 +21,11 @@ func GetConfig() {
args := flag.Args()
if len(args) < 1 {
fmt.Println("Usage: tiktok-dl [OPTIONS] TIKTOK_USERNAME")
fmt.Println("Usage: tiktok-dl [OPTIONS] TIKTOK_USERNAME|TIKTOK_URL")
os.Exit(2)
}
Config.UserName = flag.Args()[len(args)-1]
Config.URL = flag.Args()[len(args)-1]
Config.OutputPath = *outputPath
Config.Debug = *debug
}

View File

@@ -18,6 +18,13 @@ func ParseUploads(str string) []Upload {
return uploads
}
// ParseUpload - Parses json uploads array
func ParseUpload(str string) Upload {
var upload Upload
json.Unmarshal([]byte(str), &upload)
return upload
}
// GetUploadID - Returns upload id
func (u Upload) GetUploadID() string {
parts := strings.Split(u.ShareLink, "/")