Run youtubedr manually from source
masterIf you want to run the tool without installing it globally, you can clone the repository and use go run.
git clone https://github.com/kkdai/youtube.git && cd youtube
go run ./cmd/youtubedrrepository·master·Indexed 26 days ago
https://github.com/kkdai/youtubeA Go-based package and CLI tool (youtubedr) for downloading YouTube videos. It supports retrieving video and playlist metadata, downloading specific qualities/itags, and provides a Go library for integration into other projects. The tool includes features for filtering video formats by quality, mime-type, and language, and supports multiple client profiles (Web, Android, iOS, Embedded, AndroidVR) to mimic different devices.
If you want to run the tool without installing it globally, you can clone the repository and use go run.
git clone https://github.com/kkdai/youtube.git && cd youtube
go run ./cmd/youtubedryoutubedr binary allows you to download YouTube videos using either the video ID or the full URL. You can also specify the output directory, filename, and quality.github.com/kkdai/youtube/v2 package to use its functionality directly within your Go applications. Refer to example_test.go in the repository for implementation details.You can install the youtubedr binary using several methods depending on your environment. Ensure you have Go 1.26 or later installed if using go install.
# Install via Go
go install github.com/kkdai/youtube/v2/cmd/youtubedr@latest
# Mac (Homebrew)
brew install youtubedr
# Termux
pkg install youtubedrUse the info command to retrieve metadata about a video, including available streams, their itag, quality, and codec information.
youtubedr info https://www.youtube.com/watch?v=rFejpH_tAHMhd1080 quality, you must have ffmpeg installed and available in your system's PATH.Logger using the LOGLEVEL environment variable. If LOGLEVEL is set, the logger will use that level; otherwise, it defaults to the standard slog default level.To download the actual video/audio data, use GetStream(video *Video, format *Format). This returns an io.ReadCloser and the total size in bytes.
For context-aware downloads, use GetStreamContext(ctx context.Context, video *Video, format *Format). The client will automatically use chunked downloading if the format's ContentLength is known to improve speed.
Use GetVideo(url string) to fetch metadata for a specific YouTube video. This method uses context.Background() internally.
For better control over request lifecycles, use GetVideoContext(ctx context.Context, url string) which allows you to pass a custom context.
GetTranscriptCtx which accepts a context.Context.Use GetTranscript to fetch the transcript for a specific video in a given language. Note that not all videos have transcripts available (typically only newer videos). If transcripts are disabled or unavailable, the method returns ErrTranscriptDisabled.
Alternatively, use GetTranscriptCtx to provide a custom context.Context for request cancellation or timeouts.
The *Video type provides a convenience method FilterQuality(quality string) to reduce the available formats to those matching a specific quality string and then sort them automatically.
This method updates the Formats field on the Video object in-place.