yt-dlp-sabr-googlevideo
A yt-dlp plugin that downloads YouTube formats served only through SABR (Server ABR streaming), using LuanRT's googlevideo, YouTube.js and BgUtils on Deno.
YouTube increasingly withholds the regular HTTPS URLs of its web clients and serves the video only over SABR, the streaming protocol of its own web player.
When that happens, yt-dlp can often fetch nothing better than format 18, a 360p file with muxed audio, even though the video exists in 1080p or higher.
This plugin adds the SABR tracks as additional formats such as 137-sabr, and downloads them by running a real web playback session.
How it works
The plugin has two parts: a yt-dlp extractor override written in Python and a download helper written in TypeScript that runs on Deno.
- Listing formats: The extractor reads the SABR tracks from the player responses that yt-dlp has already fetched, so listing them costs no extra request.
They are added with a lower protocol preference than HTTPS, so yt-dlp keeps choosing a regular format when one of the same quality exists, and picks a SABR format only when it is better. - Downloading: The helper builds the playback exactly like googlevideo's own downloader example:
- YouTube.js requests a fresh WEB player response
- BgUtils runs BotGuard and mints PO tokens bound to the video ID
- googlevideo's
SabrStreamstreams the tracks, asking for new PO tokens, reloaded player responses and heartbeats through its callbacks
- Retrying: YouTube sometimes rejects the PO token of a playback. The rejection arrives within the first response, so the helper aborts immediately and starts a completely new playback with a new visitor, BotGuard session and player response.
A video track and an audio track of the same video are downloaded in one SABR session, and yt-dlp merges them as usual.
The formats are listed from whichever player response yt-dlp fetched, but the download always uses a WEB player response. If the WEB player response does not offer the selected itag, the helper downloads the track with the same container, codec family, resolution and frame rate instead, and yt-dlp prints a warning.
YouTube.js parses the JavaScript player of YouTube to decipher the streaming URL. The parsed player is kept in sabr_googlevideo under yt-dlp's cache directory and reused until YouTube changes the player, so that later downloads skip the parsing (with --no-cache-dir, every download parses the player). The session data of YouTube.js, which contains the visitor ID, is never cached.
Deno runs the helper without network permission. Every HTTP request of the helper is relayed to yt-dlp over standard I/O and sent with YoutubeDL.urlopen, so --proxy, --source-address and the other network options of yt-dlp apply to all traffic, and nothing can bypass the proxy.
The relay only accepts HTTPS requests to YouTube, its media servers and the Google endpoints used by BotGuard, and fails a request whose redirects end at another host. The helper may write only to a temporary directory next to the output file and to its cache directory, may read only its cache directory, and may read only the few environment variables that its npm dependencies check.
The temporary directory is named after the output file (for example video.mp4.sabr-xxxxxxxx), like the .part files of yt-dlp, and is removed when the download ends.
Requirements
- Python 3.13 or later
- yt-dlp 2026.11.23 or later (installed with this plugin)
- Deno 2.8 or later (older releases lack Node.js APIs that the npm dependencies use)
- yt-dlp finds Deno in the same way as for its JavaScript challenge solver. Use
--js-runtimes deno:/path/to/denoif it is not inPATH. - On the first download, Deno downloads the npm packages pinned in
deno.lockfrom the npm registry. These requests are made by Deno itself, not through yt-dlp.
- yt-dlp finds Deno in the same way as for its JavaScript challenge solver. Use
- FFmpeg, to merge the video and audio tracks
- About 250 MB of memory for each SABR download in addition to yt-dlp. The first download after YouTube changes its player needs about 450 MB, because YouTube.js parses the new player.
Installation
Install the plugin into the same environment as yt-dlp:
pip install -U yt-dlp-sabr-googlevideo
With uv:
uv add yt-dlp-sabr-googlevideo
yt-dlp loads the plugin automatically. yt-dlp -v lists it as Extractor Plugins: sabr_googlevideo (YoutubeIE).
Usage
Nothing changes for videos whose regular formats are available. When YouTube serves a video only through SABR, the default format selection picks the SABR tracks:
yt-dlp "https://www.youtube.com/watch?v=XqZsoesa55w"
-F shows the SABR tracks with the -sabr suffix and the sabr_googlevideo protocol:
137-sabr mp4 1920x1080 30 | 38.81MiB 2393k sabr_googlevideo | avc1.640028 2393k video only 1080p, SABR
140-sabr m4a audio only | 2.08MiB 128k sabr_googlevideo | audio only mp4a.40.2 128k medium, SABR
To always download through SABR, filter by protocol:
yt-dlp -f "bv[protocol=sabr_googlevideo]+ba[protocol=sabr_googlevideo]" "https://www.youtube.com/watch?v=XqZsoesa55w"
A SABR video track can also be combined with a regular audio format, for example -f "399-sabr+140".
Extractor arguments
Pass these with --extractor-args "youtube:KEY=VALUE".
| Key | Description |
|---|---|
sabr=never |
Do not add SABR formats. |
sabr_attempts=N |
Start up to N playbacks when YouTube rejects the PO token (default: 4). |
Limitations
- Live streams are left to the regular formats. Videos that are still live are not offered through SABR.
- SABR formats cannot be written to standard output (
-o -). - Time-range downloads (
--download-sections) are not supported for SABR formats. --check-formatsdoes not test SABR formats, because a test would start a whole playback session. They are reported as available.- The plugin cannot help when YouTube refuses the player request itself (for example "Sign in to confirm you're not a bot" for every client). SABR only replaces the media transfer.
- Without an accepted PO token, YouTube stops a SABR playback after about the first minute of media. Whether a token is accepted varies between playbacks and network routes; the plugin retries with new playbacks, but cannot guarantee success.
Development
uv sync
uv run task lint
uv run task format
uv run task test
The Deno helper is linted with ESLint, which needs Node.js and Yarn:
yarn install
yarn lint
deno check --config yt_dlp_sabr_googlevideo/deno/deno.json yt_dlp_sabr_googlevideo/deno/main.ts
Most tests download real videos from YouTube and require Deno and FFmpeg. Set the DENO environment variable to use a Deno binary outside PATH. When the CI environment variable is true, only the tests that make no request to YouTube run.
License
yt-dlp-sabr-googlevideo is licensed under the MIT License.
The helper downloads and runs googlevideo, YouTube.js, BgUtils and jsdom, which are distributed under their own licenses (MIT) through npm.
Metadata
Release files for yt-dlp-sabr-googlevideo 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yt_dlp_sabr_googlevideo-0.1.0.tar.gz | 27.6 kB | Without provenance | Details for yt_dlp_sabr_googlevideo-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yt_dlp_sabr_googlevideo-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for yt_dlp_sabr_googlevideo-0.1.0-py3-none-any.whl |
Total release size: 56.8 kB
Release files / yt_dlp_sabr_googlevideo-0.1.0.tar.gz
| Download URL | yt_dlp_sabr_googlevideo-0.1.0.tar.gz |
|---|---|
| Size | 27.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d44123a5e601c3398f1d282d9dc0047b968b8456e354949bb14a162b272c53d6
|
|
BLAKE2b-256 checksum How to use checksums |
e960e50086d9aefaeba8fdcec3aec71350a5362198270e0934caa81e3ce4bf7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / yt_dlp_sabr_googlevideo-0.1.0-py3-none-any.whl
| Download URL | yt_dlp_sabr_googlevideo-0.1.0-py3-none-any.whl |
|---|---|
| Size | 29.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ac2caaef02e531cd39567c7f469fcaec83aec86461500e75389a0e0c705f084
|
|
BLAKE2b-256 checksum How to use checksums |
b6169b3ec0ea3287a87759e94bac795e3b93303a317790df2671ae56830d14fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for yt-dlp-sabr-googlevideo 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.