mirror of
https://github.com/pikami/tiktok-dl.git
synced 2026-04-22 22:38:46 +01:00
Added ability to download single videos
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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, "/")
|
||||
|
||||
Reference in New Issue
Block a user