Created
April 19, 2021 01:04
-
-
Save mrtrkmn/e953cf6679a2c834629e84d6a9dcdfdc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package client | |
type YoutubeDL struct { | |
c *Client | |
} | |
// exec executes an ExecFunc using 'youtube-dl'. | |
func (ytdl *YoutubeDL) exec(args ...string) ([]byte, error) { | |
return ytdl.c.exec("youtube-dl", args...) | |
} | |
// DownloadWithOutputName generates Folder named with Playlist name | |
// downloads videos under given playlist url to Folder | |
func (ytdl *YoutubeDL) DownloadWithOutputName(folderName, url string) error { | |
cmds := []string{"-o", folderName + "/%(playlist_index)s - %(title)s.%(ext)s", url} | |
_, err := ytdl.exec(cmds...) | |
return err | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment