Mattias Wadman a5ac9d8d1c Merge pull request #17 from wader/bump-youtube-dl-2020.03.08
Update youtube-dl to 2020.03.08
2020-03-08 17:59:43 +01:00
2020-01-11 11:34:32 +01:00
2020-01-26 19:42:48 +01:00
2020-03-08 16:03:48 +00:00
2019-07-23 21:39:07 +02:00
2019-07-23 21:39:07 +02:00
2019-11-05 00:46:54 +01:00
2019-07-23 21:39:07 +02:00
2020-01-26 19:42:48 +01:00

goutubedl

Go wrapper for youtube-dl. API documentation can be found at godoc.org.

See youtube-dl documentation for how to install and what is recommended to install in addition to youtube-dl.

goutubedl default uses PATH to find youtube-dl but it can be configured with the goutubedl.Path variable.

Due to the nature and frequent updates of youtube-dl only the latest version is tested. But it seems to work well with older versions also.

Usage

From cmd/example/main.go

package main

import (
	"context"
	"io"
	"log"
	"os"

	"github.com/wader/goutubedl"
)

func main() {
	result, err := goutubedl.New(context.Background(), "https://www.youtube.com/watch?v=jgVhBThJdXc", goutubedl.Options{})
	if err != nil {
		log.Fatal(err)
	}
	downloadResult, err := result.Download(context.Background(), "best")
	if err != nil {
		log.Fatal(err)
	}
	defer downloadResult.Close()
	f, err := os.Create("output")
	if err != nil {
		log.Fatal(err)
	}
	defer f.Close()
	io.Copy(f, downloadResult)
}

See goutubedl cmd tool or ydls for usage examples.

Development

docker build -t goutubedl-dev .
docker run --rm -ti -v "$PWD:$PWD" -w "$PWD" goutubedl-dev
go test -v -race -cover
Description
Go wrapper for youtube-dl and yt-dlp
Readme MIT 478 KiB
Languages
Go 98.1%
Dockerfile 1.9%