• Stars
    star
    2,944
  • Rank 15,384 (Top 0.4 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 9 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Download Youtube Video in Golang

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.18 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:

  • Get information of dotGo-2015-rob-pike video for downloading

    go get github.com/kkdai/youtube/v2/youtubedr

    Download video from dotGo 2015 - Rob Pike - Simplicity is Complicated

    youtubedr info https://www.youtube.com/watch?v=rFejpH_tAHM
    
    Title: dotGo 2015 - Rob Pike - Simplicity is Complicated
    Author: dotconferences
    -----available streams-----
    itag:  18 , quality: medium , type: video/mp4; codecs="avc1.42001E, mp4a.40.2"
    itag:  22 , quality:  hd720 , type: video/mp4; codecs="avc1.64001F, mp4a.40.2"
    itag: 137 , quality: hd1080 , type: video/mp4; codecs="avc1.640028"
    itag: 248 , quality: hd1080 , type: video/webm; codecs="vp9"
    ........
    
  • Download dotGo-2015-rob-pike-video

    go get github.com/kkdai/youtube/v2/youtubedr

    Download video from dotGo 2015 - Rob Pike - Simplicity is Complicated

    youtubedr download https://www.youtube.com/watch?v=rFejpH_tAHM
    
  • Download video to specific folder and name

    go get github.com/kkdai/youtube/v2/youtubedr

    Download video from dotGo 2015 - Rob Pike - Simplicity is Complicated to current directory and name the file to simplicity-is-complicated.mp4

    youtubedr download -d ./ -o simplicity-is-complicated.mp4 https://www.youtube.com/watch?v=rFejpH_tAHM
    
  • Download video with specific quality

    go get github.com/kkdai/youtube/v2/youtubedr

    Download video from dotGo 2015 - Rob Pike - Simplicity is Complicated with specific quality

    youtubedr download -q medium https://www.youtube.com/watch?v=rFejpH_tAHM
    

    Special case by quality hd1080:

    Installation of ffmpeg is necessary for hd1080

    ffmpeg   //check ffmpeg is installed, if not please download ffmpeg and set to your PATH.
    youtubedr download -q hd1080 https://www.youtube.com/watch?v=rFejpH_tAHM
    
  • Download video with specific itag

    go get github.com/kkdai/youtube/v2/youtubedr

    Download video from dotGo 2015 - Rob Pike - Simplicity is Complicated

    youtubedr download -q 18 https://www.youtube.com/watch?v=rFejpH_tAHM
    

How it works

  • Parse the video ID you input in URL
    • ex: https://www.youtube.com/watch?v=rFejpH_tAHM, the video id is rFejpH_tAHM
  • Get video information via video id.
    • Use URL: http://youtube.com/get_video_info?video_id=
  • Parse and decode video information.
    • Download URL in "url="
    • title in "title="
  • Download video from URL
    • Need the string combination of "url"

Inspired

Project52

It is one of my project 52.

License

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

More Repositories

1

project52

52 weeks, 52 Go projects
1,343
star
2

maglev

A Google Maglev Hashing Algorithm implement in Golang
Go
261
star
3

chatgpt

ChatGPT Console client in Golang
Go
240
star
4

LineBotTemplate

A simple Golang LINE bot Template and tutorial how to setup on Heroku for LINE bot API
Go
189
star
5

FBBotTemplate

A simple Golang Facebook Bot Template and tutorial
Go
80
star
6

happy-birthday-c9s

A repo to celebrate c9s birthday
HTML
58
star
7

LineBotPetNeedMe

Animal Adoption Platform on Line Bot (流浪動物需要你 LINE 聊天機器人)
Go
49
star
8

LINE-Bot-ChatSummarizer

Use ChatGPT to summarize your group chat as a chat summarizer with the LINE Bot Chat Summarizer.
Go
48
star
9

paxos

Go implement for Paxos algorithm
Go
45
star
10

bookmark-makerserver

A IFTTT MakerServer to help you post your tweet to github issue as a bookmark
Go
35
star
11

trigram

A trigram indexing implement in Go
Go
30
star
12

luis

Microsoft Luis.ai API Golang package
Go
29
star
13

line-account-link

LINE account link tutorial with sample code
Go
27
star
14

beacon

Beacon Simulator: A simple beacon simulator (iBeacon/Eddystone) in Golang
Go
27
star
15

goFBPages

臉書相簿小幫手 A Facebook Page Album download tool in Golang
Go
26
star
16

goInstagramDownloader

Instagram相簿下載小幫手: Download and backup your Instagram photos written by Golang
Go
25
star
17

AndroidRTSPPlayer

Sample Android + ffmpeg with RTSP player
C
23
star
18

line-login-go

LINE Login starter kit in Go
Go
23
star
19

line-login-sdk-go

LINE Login GO SDK (Original Social API SDK, It has been migrated into LINE login 2.1 after 2020/11/12)
Go
23
star
20

consistent

Consistent Hashing implement in Golang
Go
22
star
21

dfa

Deterministic Finite Automata function implement in Golang
Go
19
star
22

twitter

Twitter API SDK with OAuth in Golang
Go
19
star
23

linenotify

Template for LINE Notify service in Golang
Go
19
star
24

iloveptt

我愛批踢踢 A PTT Crawler and Photo downloader which written in Golang
Go
18
star
25

bloomfilter

A space-efficient probabilistic data structure Bloom Filter implement by Golang
Go
16
star
26

linebot-langchain

Utilizing a LINE Bot integrated with LangChain in Python to assist with stock price inquiries.
Python
16
star
27

LineBotBabyLuis

A baby NLU chatbot using LUIS, Chinese website https://www.evanlin.com/go-luis-linebot/
Go
15
star
28

radix

A simple radix tree implement by Golang
Go
15
star
29

githubrss

A github notification (starred, follower, followed) RSS feed in Golang
Go
14
star
30

kmp

KMP (Knuth–Morris–Pratt algorithm) implement and related string function `Strstr` and `Strchr` in Golang
Go
14
star
31

raftrpc

Simple RPC Key Value Server using etcd/Raft in Golang
Go
13
star
32

cyk

CYK algorithm in Golang
Go
13
star
33

coapmq

Publish-Subscribe Broker for the Constrained Application Protocol (CoAP) in Golang
Go
13
star
34

bookmarks

Repo to storage all my favorite links
13
star
35

iap

Golang In-App-Purchase Package for Apple iTune and Google Play
Go
13
star
36

mstranslator

mstranslator is a client to access Microsoft Translator marketplace API which written by Golang
Go
12
star
37

grpc-example

An example about learning grpc in go
Go
12
star
38

pubsub

A Redis Pub/Sub concept implement by Golang
Go
12
star
39

pd

(PUBSUB) Publish-Subscrbe message broker with Disk queue in Golang
Go
11
star
40

bstream

A Bit Stream helper in Golang
Go
11
star
41

kkdai.github.io

Website for my blog
CSS
11
star
42

line-bot-icon-switch

Sample code how to use Icon/Nick name switch in LINE Bot in Go
Go
11
star
43

ngram

A ngram indexing implement in Go
Go
11
star
44

oxford-face

Project Oxford Face API for Golang
Go
10
star
45

aca

Aho–Corasick algorithm automation implement in Golang
Go
10
star
46

raft

A simple Go app to understand the Raft Consensus Algorithm
Go
10
star
47

GoConference2016SpringSlides

A slides collection for Go Conference 2016 Spring
10
star
48

react-diff

React Diff binary tree in Golang
Go
10
star
49

iOS-MultipeerConnectivity

Project base on AppCoda http://www.appcoda.com/intro-multipeer-connectivity-framework-ios-programming/
Objective-C
10
star
50

EddystoneScanner

Eddystone Beacon Scanner in Golang
Go
9
star
51

rss-webserver

A simple Github Status RSS feeder server in Golang
Go
9
star
52

favdb

User Favorite DB handle in go (memory, GitHub issue, and PostgreSQL)
Go
9
star
53

BleConsoleWin

Simple BLE Central console for Windows
C++
8
star
54

LineBotAnimal

Line Bot Animal photo classification
Go
8
star
55

nfa

Nondeterministic finite automaton implement in Golang
Go
8
star
56

skiplist

A SkipList data structure implement in Go
Go
8
star
57

plurk-makerserver

Plurk post server for IFTTT Maker in Golang
Go
8
star
58

raftserver

A RPC Server implement base on Raft Paper in Golang
Go
8
star
59

trr

TRR: Time-Series of gorilla algorithm with Raft RPC Server/Client in Golang
Go
8
star
60

PhotoViewer

一個底層使用Golang的iOS 看圖與瀏覽並且下載圖片的小工具
Objective-C
7
star
61

linebot-group

LINE Bot Group Event Demo Code
Go
7
star
62

line-beacon-go

Line beacon library in Go
Go
7
star
63

photomgr

A photo download package for gomobile in Golang
Go
6
star
64

radomtix

Random Ticket inviting code generator in Go
Go
6
star
65

AMA

Ask me anything here!
6
star
66

rd

A simple RPC Message Queue Server/Client with DiskQueue
Go
6
star
67

webpic

網頁抓圖小幫手: A web pic/image downloader written in Golang
Go
6
star
68

kkdai

6
star
69

diskqueue

Diskqueue implement in Golang refer from NSQ diskqueue
Go
6
star
70

CoapPubsub

A PubSub client/server using CoAP protocol in Golang
Go
6
star
71

cuckoofilter

cuckoo filter go implement from paper
Go
6
star
72

slides

Try to summarized all my slides..
6
star
73

linebot-arxiv

Search arXiv paper article on LINE Bot with ChatGPT
Go
6
star
74

linebot-video-gcp

A LINE Bot with Google Cloud Storage and Speech-To-Text features written in Go. Full article https://www.evanlin.com/til-gcp-speech-video-flex/
Go
6
star
75

tm

Simple Turing Machine implement in Golang
Go
5
star
76

jsonop

A json operation library written in Golang
Go
5
star
77

goFbAlbum

A Facebook albums and photos access tool implement by Golang
Go
5
star
78

tf-go-inception

Golang Web API Server to serve Inception model with RESTful multipart POST
Go
5
star
79

FBBotPetneedme

Animal Adoption Platform on Facebook Messenger Platform Bot (流浪動物需要你 Messenger 機器人)
Go
5
star
80

GoPractice

Using Go to resolve some problems
Go
5
star
81

ptt-beauty-linebot

LINE 聊天機器人 for PTT Beauty版 with pgsql/github/memory DB
Go
5
star
82

ri

UDP client/server to get Public and Private IP and Port for hole punching
Go
4
star
83

basiclist

A sorted linked list implement in Golang
Go
4
star
84

re2epsnfa

A tranform function to translate RE to Epsilon-NFA in Golang
Go
4
star
85

slack-console

A simple slack message tool in console write in Golang
Go
4
star
86

ffmpeg-vs2013-samples

ffmpeg-vs2013-samples
C++
4
star
87

iloveck101

我愛卡提諾 GO 版本
Go
4
star
88

ck101-downloader

簡單的小程式來透過PhotoMgr來讀取CK101版面並且下載圖片
Go
4
star
89

e-nfa

ε-NFA: Epsilon-Nondeterministic finite automaton implement in Go
Go
4
star
90

LineBot-emoji

LINE Emoji echo Bot demo code using Go
Go
4
star
91

GolangTalks

Golang Talks Slide
Go
4
star
92

liff-template-go

LIFF Example hosted by Go
HTML
4
star
93

GoConference2017Autumn

Slides collection for GoCon 2017 Autumn
3
star
94

disqus-to-github-issues-go

disqus comment export XML import into github issues
Go
3
star
95

twitter-auth-web

A Website to demonstrate about Twitter Auth and list all your timeline
Go
3
star
96

langchain_tools

LangChain Tools Examples in Pythons
Jupyter Notebook
3
star
97

OpenRSTP_VS2013

It is base on liveMedia OpenRTSP and add VS2013 related project and solution for implement.
C++
3
star
98

iOS-HealthkitHelper

Objective-C
3
star
99

go-cli-template

Golang CLI Template with GoReleaser github action
Go
3
star
100

pypdf

PyPDF: Python-based PDF Analysis with LangChain
Python
3
star