A tiny Go library + client for downloading Youtube videos. The library is capable of fetching Youtube video metadata, in addition to downloading videos.

Overview

go-get-youtube v 0.2

A tiny Go library + client (command line Youtube video downloader) for downloading Youtube videos. The library is capable of fetching Youtube video metadata, in addition to downloading videos. If ffmpeg is available, client can extract MP3 audio from downloaded video files.

Client

Once you have compiled or downloaded the binary, simply run the following on your terminal:

ytdownload -id=youtube_video_id

Building

$ export GOPATH=$PWD/go-get-youtube
$ go get github.com/Kunal-Diwan/go-get-youtube
$ cd go-get-youtube/bin
$ ./go-get-youtube -id=cN_DpYBzKso -itag 18 -rename -mp3

Extracted audio: cN_DpYBzKso-rob-pike-concurrency-is-not-parallelis.mp3
Download duration: 5s
Average speed: 16.1MB/s
Downloaded video: cN_DpYBzKso-rob-pike-concurrency-is-not-parallelism.mp4

Library

Methods

youtube.Get(youtube_video_id)

video, err = youtube.Get(youtube_video_id)

Initializes a Video object by fetching its metdata from Youtube. Video is a struct with the following structure

{
	Id, Title, Author, Keywords, Thumbnail_url string
	Avg_rating float32
	View_count,	Length_seconds int
	Formats []Format
}

Video.Formats is an array of the Format struct, which looks like this:

type Format struct {
	Itag int
	Video_type, Quality, Url string
}

type Option struct {
	Resume bool // resume failed or cancelled download
	Rename bool // rename output file using video title
	Mp3    bool // extract audio using ffmpeg
}

youtube.Download(format_index, output_file, option)

format_index is the index of the format listed in the Video.Formats array. Youtube offers a number of video formats (mp4, webm, 3gp etc.)

youtube.GetExtension(format_index)

Guesses the file extension (avi, 3gp, mp4, webm) based on the format chosen

Example

import (
	youtube "github.com/Kunal-Diwan/go-get-youtube/youtube"
)

func main() {
	// get the video object (with metdata)
	video, err := youtube.Get("FTl0tl9BGdc")

	// download the video and write to file
	option := &youtube.Option{
		Rename: true,  // rename file using video title
		Resume: true,  // resume cancelled download
		Mp3:    true,  // extract audio to MP3
	}
	video.Download(0, "video.mp4", option)
}
You might also like...
CLI to support with downloading and compiling terraform providers for Mac with M1 chip

m1-terraform-provider-helper A CLI to help with managing the installation and compilation of terraform providers when running a new M1 Mac. Motivation

"steal" NFTs by downloading them via OpenSea api ;)

go-NFThief "steal" NFTs by downloading them via OpenSea api. now you don't have to manually screenshot them ;) Options to: download a collection via c

YouTube client on your terminal

MeowTube YouTube client on your terminal Table of Contents About Getting Started Usage Contributing About MeowTube is a CLI (Command Line Interface) t

VIP video downloader, such as: iqiyi, youku, qq, ...etc.

vip-video-downloader VIP Video Downloader, such as: iqiyi, youku, qq, ...etc. usage Download vip-video-downloader download URL [flags] Merge vip-video

Watch your favourite anime using the video player of your choice directly from the command line

anime-cli Watch your favourite anime using the video player of your choice direc

πŸ“₯ Command-line tool to download videos from hanime.tv

hanime Command-line tool to download videos from hanime.tv Requirements Installation Install via go get Install from source Install from release Usage

An easy to use go program to download videos from Reddit

Gedditsave Download videos from reddit from the command line. Use guide geddit -

An easy to use go program to download videos from Reddit.
An easy to use go program to download videos from Reddit.

Gettit Download videos from reddit from the command line. Use guide gettit -u post_url Example : gettit -u https://www.reddit.com/r/programminghorror/

SkillcappedRippr - Rips (downloads) videos from skilcapped without the need to be logged in to the website

skillcappedRippr Rips (downloads) videos from skilcapped without the need to be

Owner
Kunal Diwan
Hello I am Kunal . I am a Pre-Final year student in Computer Engineering . Building few things on web πŸš€ and Developing Bots on TG .
Kunal Diwan
A very simple command line tool for downloading YouTube videos.

GoTube Overview This repository contains a single-file implementation of YouTube video downloader written in Go. It does not require any third-party p

Jimmy Yang 188 Dec 20, 2022
Command-line program to download videos from YouTube.com and other video sites

youtube-dl - download videos from youtube.com or other video platforms INSTALLATION DESCRIPTION OPTIONS CONFIGURATION OUTPUT TEMPLATE FORMAT SELECTION

youtube-dl 116.4k Jan 9, 2023
πŸ“±πŸ₯΄ TikTok terminal client for browsing & downloading videos

tiktik ?? ?? - TikTok Terminal Client Name inspiration - this yt vid Huge Thanks to Egor who wrote the parsing part Installation ?? go get -u github.c

Ilya Revenko 77 Dec 3, 2022
Golang-video-screensaver - A work in progress Microsoft Windows video screensaver implemented in Go

golang-video-screensaver A work in progress Microsoft Windows video screensaver

null 1 Sep 5, 2022
Build an interactive CLI application with Go, Cobra and promptui. Video tutorial available on the Div Rhino YouTube channel.

Build an interactive CLI app with Go, Cobra and promptui Text tutorial: https://divrhino.com/articles/build-interactive-cli-app-with-go-cobra-promptui

Div Rhino Dev 16 Dec 8, 2022
Little golang app that allows you to download a youtube video as mp3, and optionally embed ID3 tags -Cover Art, Artist ...-

yt2mp3 Little golang app that allows you to download a youtube video as mp3, and optionally embed ID3 tags -Cover Art, Artist ...- Instructions At the

null 0 Dec 25, 2021
Video downloader, from youtube using golang

Video Downloader for Youtube This is a command line project which downloads videos from youtube using golang. Usage : Get your favourite music video f

Yiğit Γ‡ilce 0 Jan 10, 2022
You-Get is a tiny command-line utility to download media contents (videos, audios, images) from the Web,

You-Get NOTICE: Read this if you are looking for the conventional "Issues" tab. You-Get is a tiny command-line utility to download media contents (vid

Mort Yao 46.4k Jan 2, 2023
🐘 Cross-platform, neofetch alternative for fetching system info.

elefetch ?? Cross-platform, neofetch alternative for fetching system info. Installation go get: go get -u github.com/burntcarrot/elefetch Binaries Bin

Aadhav Vignesh 1 Jan 23, 2022
An easy-to-use cli tool for downloading manga

mangodl Download and search manga right from the terminal! Report Bug || Request Feature Table of Contents About the Project Built With Getting Starte

null 152 Nov 26, 2022