No description
Find a file
2025-07-15 23:01:05 +01:00
src amend 2025-07-15 23:01:05 +01:00
tests explicit 2024-09-15 10:04:52 +01:00
.gitignore attempts to fix innertubes serverside change 2025-04-16 22:59:41 +01:00
license add 2024-09-15 10:16:01 +01:00
newt.nimble amend 2025-07-15 23:01:05 +01:00
readme.md add 2024-09-19 14:54:58 +01:00

Newt

YouTube downloader library and command-line interface (CLI) built on Nim.

Usage

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)

MediaFormat and VideoInfo types

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]

CLI Usage

Download YouTube Video

newt -v <yt-video-url>

Download YouTube Audio

newt -a <yt-video-url>

Get List of Available Formats

newt -f <yt-video-url>

Download by Specific Format

newt -df <yt-video-url> <format-id>

Get Video Details

newt -i <yt-video-url>