Skip to content

kamilkabir9/youtube

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Download Youtube Video in Golang

GitHub license GoDoc Build Status

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

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="
    • Need sinature in "sig="
  • Download video from URL
    • Need the string combination of "url+sig"

Install

go get github.com/kkdai/youtube

Usage

package main

import (
	"flag"
	"log"
	"os"
	"path/filepath"

	. "github.com/kkdai/youtube"
)

func main() {
	currentDir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
	log.Println("download to dir=", currentDir)
	y := NewYoutube()
	y.DecodeURL("https://www.youtube.com/watch?v=rFejpH_tAHM")
	y.StartDownload(currentDir)
}

Use the binary directly

go get github.com/kkdai/youtube/youtubedr

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

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

Inspired

Project52

It is one of my project 52.

License

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

About

Download Youtube Video in Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%