Skip to content

Releases

ytgrab v0.2.1

Choose a tag to compare

@fitzypopper fitzypopper released this 22 Nov 11:16

What changed since v0.2.0

Channel URLs

ytgrab now understands YouTube channels. All the usual URL shapes work:

ytgrab --playlist "https://www.youtube.com/@YouTube"
ytgrab --playlist "https://www.youtube.com/@YouTube/playlists"
ytgrab --playlist "https://www.youtube.com/c/YouTube"
ytgrab --playlist "https://www.youtube.com/user/Google"
ytgrab --playlist "https://www.youtube.com/channel/UCBR8-60-B28hp2BmDPdntcQ"

The channel is resolved with the navigation/resolve_url endpoint. Its videos
are the "uploads" playlist — the channel id with UC swapped for UU — which
comes back in exactly the same shape as a normal playlist, so the playlist
code is reused.

Browsing a channel page through the API now needs a PO token and answers
400 INVALID_ARGUMENT for every client, so the /playlists tab is read from
the page's ytInitialData instead. Found 30 playlists on @YouTube.

Smaller

Three dependencies that were never used (anyhow, quick-xml, tempfile)
are gone.

Verified

  • @YouTube → 877 videos, /c/YouTube → 348, /channel/UC… → 236
  • /user/Google and /@YouTube/playlists list correctly
  • A real channel download worked; the only failures were scheduled live events
    and YouTube's bot check on the busiest channel on the platform
  • 78 tests pass, clippy clean under -D warnings
  • CI green on Linux, macOS and Windows

Independent implementation, not affiliated with yt-dlp. ytgrab is YouTube only; yt-dlp supports roughly 1755 sites.

ytgrab v0.2.0

Choose a tag to compare

@fitzypopper fitzypopper released this 15 Nov 09:48

What this release adds

v0.1.0 could only download what YouTube's Android client handed over, and it fell back to 360p whenever that client refused a format. v0.2.0 fixes that, and adds the options people actually reach for.

High quality on every video

Some videos are only served to the TV app, and its download links carry a
throttling puzzle (n=) that has to be solved by running YouTube's player
JavaScript. yt-dlp does that by asking you to install deno, node or bun.

ytgrab embeds QuickJS instead, and vendors the
solver from yt-dlp/ejs (Unlicense), so
nothing extra needs to be installed.

$ ytgrab -f 137 "https://youtu.be/JBoUwElRFVM"
googlevideo refused format 137 (HTTP 403); retrying through the TV client
Saved ytgrab.mp4                     # 944 MB, 1920x1080

Speed

Measured on the same machine, same videos, back to back:

yt-dlp ytgrab
1080p (77 MB) 14.7 s 3.2 s
1080p (944 MB) 51.8 s 32.5 s
4K (342 MB) 25.1 s 15.9 s

Two things make the difference:

  • Parallel byte ranges. YouTube throttles a single connection to about
    250 kB/s but serves parallel Range requests at full speed.
  • 8 MiB requests. The server shapes the bandwidth of a long request:
    8 MiB chunks ran at 18.8 MB/s while 15 MiB chunks collapsed to 3.2 MB/s.
    The chunk size and the connection count were measured against each other.

Interrupted downloads

Downloads resume, and the result is byte identical to a clean download:

$ ytgrab -f 137 "https://youtu.be/JBoUwElRFVM"   # killed halfway
$ ytgrab -f 137 "https://youtu.be/JBoUwElRFVM"   # picks up where it stopped
$ sha256sum clean.mp4 resumed.mp4

A connection that dies mid-transfer is retried with the next range, and a
403 makes the chunk size smaller rather than giving up. Two instances cannot
corrupt each other: a lock file holds the pid of the process that owns the
download. All of this is covered by tests/resume.rs, which uses a local
server that drops every third connection on purpose.

New options

  • --exec / --exec-before-download — run a command per video
  • --playlist-start / --playlist-end / --playlist-items / --playlist-reverse / --playlist-random / --max-downloads / --break-on-existing
  • --download-archive — skip what you already have
  • --print and --get-title / --get-id / --get-duration / --get-uploader / --print-to-file / --skip-download
  • --match-filter, --dateafter, --datebefore, --max-filesize, --min-filesize
  • --proxy, --socket-timeout, --no-part, --sleep-requests
  • --list-subs, --write-description, --write-comments
  • --trim-filenames, --restrict-filenames, --windows-filenames
  • --config — keep your options in a file
  • --chunk-size, --fragments — tune the download
  • --no-cache-dir — ignore the session cache

Also

  • The session (watch page, player script, challenge solver) is cached in
    ~/.cache/ytgrab/, which saves about six seconds and 3.9 MB of traffic on
    every run after the first.
  • The video and audio streams are fetched at the same time.
  • A download that stops early is reported instead of being muxed into a
    broken file.

Installing

cargo install --git https://github.com/fitzypopper/ytgrab-rs

or grab the Linux binary from the assets below. ffmpeg is needed for
muxing and audio extraction.


This is an independent implementation. It is not affiliated with, endorsed by,
or a port of yt-dlp, which stays the more
feature complete tool — it supports roughly 1755 sites against ytgrab's one.

ytgrab v0.1.0

Choose a tag to compare

@fitzypopper fitzypopper released this 11 Nov 15:17