MCPcopy
hub / github.com/kkdai/youtube

github.com/kkdai/youtube @v2.10.6 sqlite

repository ↗ · DeepWiki ↗ · release v2.10.6 ↗
216 symbols 605 edges 44 files 48 documented · 22%
README

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

Run Manually

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

Install via Go

Please ensure you have installed Go 1.26 or later.

go install github.com/kkdai/youtube/v2/cmd/youtubedr@latest

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 rFejpH_tAHM
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:

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

Download video from [dotGo 2015 - Rob Pike - Simplicity is Complicated](https://www.youtube.com/watch?v=rFejpH_tAHM)

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

    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

    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

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.

Extension points exported contracts — how you extend this code

DecipherOperation (FuncType)
(no doc)
decipher_operations.go

Core symbols most depended-on inside this repo

Get
called by 18
player_cache.go
GetVideo
called by 16
client.go
Error
called by 12
errors.go
Set
called by 11
player_cache.go
String
called by 11
playlist.go
exitOnError
called by 8
cmd/youtubedr/main.go
isValidJSON
called by 6
utils.go
Select
called by 6
format_list.go

Shape

Function 88
Method 85
Struct 33
TypeAlias 7
FuncType 2
Interface 1

Languages

Go100%

Modules by API surface

client.go39 symbols
transcript.go15 symbols
format_list.go11 symbols
client_test.go11 symbols
video.go9 symbols
playlist.go9 symbols
decipher.go9 symbols
utils.go8 symbols
protobuilder.go8 symbols
errors.go8 symbols
video_test.go7 symbols
downloader/downloader.go7 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

github.com/VividCortex/ewmav1.2.0 · 1×
github.com/acarl005/stripansiv0.0.0-2018011610285 · 1×
github.com/bitly/go-simplejsonv0.5.1 · 1×
github.com/clipperhouse/uax29/v2v2.7.0 · 1×
github.com/davecgh/go-spewv1.1.2-0.20180830191 · 1×
github.com/dlclark/regexp2v1.11.5 · 1×
github.com/dop251/gojav0.0.0-2026031113572 · 1×
github.com/fsnotify/fsnotifyv1.9.0 · 1×
github.com/go-sourcemap/sourcemapv2.1.4+incompatible · 1×
github.com/go-viper/mapstructure/v2v2.5.0 · 1×
github.com/google/pprofv0.0.0-2026030201104 · 1×
github.com/inconshreveable/mousetrapv1.1.0 · 1×

For agents

$ claude mcp add youtube \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact