YouTube downloader library and command-line interface (CLI) built on Nim.
import newt
# False by default
announceLogs(true)
# Get the info corresponding to the provided URL
let vidInf: VideoInfo = newt.getVideoInfo("https://www.youtube.com/watch?v=5ANuXhk9qWM")
# Get the highest bitrate audio format
let bestAudioFormat: MediaFormat = newt.getBestFormat(vidInf.formats, FormatType.audio)
# Download the stream specified in the bestAudioFormat value
downloadYtStreamByFormat(bestAudioFormat, vidInf.title)
type
MediaFormat* = object
itag*: int
url*: string
fps*: int
bitrate*: int64
averageBitrate*: int64
mimeType*: string
codec*: string
extension*: string
contentLength*: int64
audioSampleRate*: int64
audioChannels*: int
projectionType*: string
width*: int
height*: int
quality*: string
qualityLabel*: string
audioQuality*: string
lastModified*: Time
type
VideoInfo* = object
videoId*: string
title*: string
lengthSeconds*: int64
views*: int
description*: string
author*: string
liveContent*: bool
private*: bool
ratingsEnabled*: bool
channelId*: string
thumbnailUrls*: seq[string]
formats*: seq[MediaFormat]
newt -v <yt-video-url>
newt -a <yt-video-url>
newt -f <yt-video-url>
newt -df <yt-video-url> <format-id>
newt -i <yt-video-url>