DEV Community

Marethyu12
Marethyu12

Posted on

My Graduation Project

What is my final project?

I build a CLI for downloading YouTube videos.

Link to repository

GitHub logo marethyu / gotube

A very simple command line tool for downloading YouTube videos.

GoTube

Build Status

Overview

This repository contains a single-file implementation of YouTube video downloader written in Go. It does not require any third-party packages, only built-in packages from the standard library. The code is compact and easily-readable.

Installation

You can fetch one of the executable binaries (preferably latest one) from Releases. The binaries only support Windows (32 and 64 bit) and Linux (32 and 64 bit) this time.

You can also install GoTube directly from command line. Simply just type a command below in your terminal:

go get github.com/marethyu/gotube

Building From Source

Run the following commands:

git clone https://github.com/marethyu/gotube.git
cd gotube
go get golang.org/x/sync/errgroup
go build gotube.go

How It Works?

When GoTube receives a YouTube video URL as an input, it will extract a video id portion of the URL. Then it sends a HTTP GET request to a server through URL https://www.youtube.com/get_video_info with the video id as a query string. The…

Why did I build it?

There are zillions of third-party tools available for downloading YouTube videos. Why did I build my own when there is an abundance of them? Well, the part of the reason is to improve my skills in Go programming and to learn more about HTTP protocol. I believe that the important reason I built it is to help others to understand the inner workings of other popular open-source YouTube video downloaders like youtube-dl for example.

How did I build it?

I used Go to build my project because it is an excellent programming language to build CLIs. I made sure my code is readable and compact. I tried my best to reduce any external dependencies which means I need to implement some features from scratch. I adhered to KISS principle so that my code can be read and understood in one sitting.

Additional thoughts?

I enjoyed building this project and I hope to inspire others to do a similar project. Also I would like to thank developers who helped me to refactor my code and add new features to my project.

Top comments (0)