diff --git a/main.go b/main.go index bdbddc3..f2daed1 100755 --- a/main.go +++ b/main.go @@ -57,7 +57,7 @@ func do(client *youtubedl.Client) error { log.Printf("already exists: %s", target) continue } - if err := client.Download(result.Link, path.Join(config.Root, target)); err != nil { + if err := client.Download(result.Link, target); err != nil { errs += ", " + err.Error() } } diff --git a/youtubedl/client.go b/youtubedl/client.go index 737f640..bb03696 100755 --- a/youtubedl/client.go +++ b/youtubedl/client.go @@ -15,15 +15,41 @@ func New() (*Client, error) { } func (c *Client) Download(video, local string) error { - cmd := exec.Command("youtube-dl", "-f", "22", "-o", local, "--write-sub", "--write-auto-sub", "--sub-format", "srt", video) - log.Println(cmd.Path, cmd.Args) - out, err := cmd.CombinedOutput() - if err != nil { - err = fmt.Errorf("%v: %s", err, out) + errs := []error{} + for _, extras := range [][]string{ + []string{"--metadata-from-title", ".*[0-9]/[0-9][0-9] (?P