Skip to content

4.0.0

Latest

Choose a tag to compare

@sealedtx sealedtx released this 20 Nov 11:15
· 1 commit to master since this release
d796008

Refactoring 4.0 by @sealedtx in #155
Full Changelog: 3.3.1...4.0.0

What's Changed

  • Video info: takes an id or any YouTube video URL. It tries the clients visionos, then
    android_vr, then tv_samsung. If some clients fail, you still get a partial result with warnings.
  • Downloads: to a file or to a stream. Each download goes in chunks, resumes after a broken
    connection, and publishes the file atomically, so a failed download leaves no partial file.
    There is a progress callback, and async downloads can be cancelled.
  • Playlists and channel uploads: pages load lazily as you read them.
  • Search: filters, sort order, and pages via nextPage().
  • Subtitles: VTT, SRT, TTML, JSON3 and SRV1–3.
  • JS challenges: a new ChallengeSolver interface. The included EjsSolver runs yt-dlp's EJS
    scripts in Node.js; their SHA3-512 hashes are checked. With it, the tv_samsung client works,
    and so do videos made for kids.
  • Account cookies: read from a Netscape cookies.txt file, with SAPISIDHASH authorization.
    Cookies are sent only to youtube.com. With cookies, age-restricted videos work.
  • HTTP: a pluggable HttpTransport, so you can use your own client, for example OkHttp. Also
    timeouts, gzip, retries with backoff, and a proxy with or without a password.
  • Errors: YoutubeException and its subclasses are unchecked. Each error includes
    attempts(), the log of what was tried.
  • Thread safety: one YoutubeDownloader instance can be shared by all your threads.

Breaking changes

  • All of the 3.x API is gone, including the Request* classes, callbacks, Config and the old
    models.
  • The fastjson dependency is gone. The library now has its own JSON parser.
  • The minimum Java version is now 11.
  • download(format, OutputStream, options) no longer closes the stream. Closing it is up to you.

Known limitations

  • Translated subtitles: YouTube answers HTTP 429.
  • Formats delivered only over SABR (YouTube's server-side adaptive bitrate streaming) are
    skipped.
  • On networks where Restricted Mode is enforced through DNS, 18+ videos are not available.
  • The library does not mux video and audio into one file. Use ffmpeg for that.