kkdai / youtube

Download Youtube Video in Golang
MIT License
3.37k stars 433 forks source link
go youtube

Download Youtube Video in Golang

GitHub license Go Reference Build Status Coverage

This package is a Youtube video download package, for more detail refer https://github.com/ytdl-org/youtube-dl for more download options.

This tool is meant to be used to download CC0 licenced content, we do not support nor recommend using it for illegal activities.

Overview

Installation

Install via go get

Please ensure you have installed Go 1.21 or later.

go get github.com/kkdai/youtube/v2

From source code

git clone https://github.com/kkdai/youtube.git
cd youtube
go run ./cmd/youtubedr

Mac

brew install youtubedr

in Termux

pkg install youtubedr

You can also find this package in

Usage

Use the binary directly

It's really simple to use, just get the video id from youtube url - ex: https://www.youtube.com/watch?v=rFejpH_tAHM, the video id is rFejpH_tAHM

$ youtubedr download QAGDGja7kbs
$ youtubedr download https://www.youtube.com/watch?v=rFejpH_tAHM

Use this package in your golang program

Please check out the example_test.go for example code.

Example:

How it works

Inspired

Project52

It is one of my project 52.

License

This package is licensed under MIT license. See LICENSE for details.