A thin wrapper over yt-dlp/ejs for deciphering YT signatures. Comes with Deno out of the box.
Project description
Red-YT-Cipher-Solver
A thin wrapper over yt-dlp/ejs for deciphering YT signatures. Aside from yt-dlp/ejs, this uses the official Deno PyPI package, meaning no additional setup is required beyond installing the package and then using it either as a library or as a Lavalink-compatible cipher server.
Using this project
This package only functions on systems supported by Deno JS runtime. At the time of writing, this includes:
- Windows x86_64
- macOS x86_64 & arm64
- Linux x86_64 & aarch64 with glibc 2.27 or higher
[!NOTE] If you intend to add this as a dependency to your project and want to support other platforms as well, ensure to specify appropriate environment markers for the dependency and guard your imports appropriately as the
denodependency of this project will not install on unsupported platforms:
pyproject.toml[project] # [...] dependencies = [ """\ Red-YT-Cipher-Solver; \ (sys_platform == 'win32' and platform_machine == 'AMD64') \ or (sys_platform == 'linux' and (platform_machine == 'x86_64' or platform_machine == 'aarch64')) \ or (sys_platform == 'darwin' and (platform_machine == 'x86_64' or platform_machine == 'arm64')) \ """, ] # [...]requirements.txtRed-YT-Cipher-Solver; (sys_platform == 'win32' and platform_machine == 'AMD64') or (sys_platform == 'linux' and (platform_machine == 'x86_64' or platform_machine == 'aarch64')) or (sys_platform == 'darwin' and (platform_machine == 'x86_64' or platform_machine == 'arm64')) # [...]
Installation
Install the package:
- Linux & macOS
python3.10 -m venv red_yt_cipher_solver . red_yt_cipher_solver/bin/activate python -m pip install -U Red-YT-Cipher-Solver
- Windows
py -3.10 -m venv red_yt_cipher_solver red_yt_cipher_solver\Scripts\Activate.ps1 python -m pip install -U Red-YT-Cipher-Solver
Running as a server
Run the server with the default configuration (listening on http://localhost:2334 with no authentication):
red-yt-cipher-solver serve
To specify custom hostname and port, use the positional arguments:
red-yt-cipher-solver 0.0.0.0 4242
You can require the clients to send an Authorization header with a token
by specifying one in the RED_YT_CIPHER_SERVER_TOKEN environment variable.
Using as a standalone solver
$ red-yt-cipher-solver solve --help
usage: red-yt-cipher-solver solve [-h] [--encrypted-signature ENCRYPTED_SIGNATURE]
[--n-param N_PARAM] [--signature-key SIGNATURE_KEY]
[--include-player-content]
player_url stream_url
Solve a JS challenge request using the yt-dlp/ejs solver:
red-yt-cipher-solver solve \
/s/player/00c52fa0/player_ias.vflset/de_DE/base.js \
"https://rr4---sn-4g5e6nzl.googlevideo.com/videoplayback?expire=1772476120&n=Fc9IL2b0xD7Lybd7&ei=..." \
--encrypted-signature "R=ANHkhNZInqwBBEsHpvykqHsygJje6J4T_Q-aL2VO7PkCQIC4ruoYYg2TeWFSfKXFTeQF=B_hR1UlnJw75Wfb24g6nQgIQRw4MNqEHA"
Using as a library
While this is mostly a thin wrapper over yt-dlp/ejs, it does come with Deno out of the box, so it might be of interest to some to use that wrapper directly.
The following functions are currently exposed in red_yt_cipher_solver
solve_js_challenges() / solve_js_challenges_sync()
Solve JS challenge requests using the yt-dlp/ejs solver.
The variant without the _sync suffix is an asynchronous function.
Arguments:
player_content(str) - The content of the player script.*requests(JsChallengeRequest) - The JS challenge requests to solve.
Returns:
SolveOutput - The parsed output from yt-dlp/ejs solver.
Raises:
SolveOutputError- Some or all of the challenge requests could not be solved.UnsupportedGLibCError- The glibc version used on this system is unsupported.subprocess.CalledProcessError- The yt-dlp/ejs script crashed/Deno failed to run.
get_sts()
Get timestamp from the player script.
Parameters:
player_content(str) - The content of the player script.
Returns:
str - The timestamp extracted from the player script. When this is an empty string, the timestamp could not be found.
normalize_player_url()
Normalize the provided player URL.
This will prepend the YT URL to a path-only URL in case of relative URLs and validate the URL and its hostname in case of absolute URLs.
Parameters:
player_url(str) - The player URL.
Returns:
str - The normalized player URL.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file red_yt_cipher_solver-0.1.0.tar.gz.
File metadata
- Download URL: red_yt_cipher_solver-0.1.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43009c0f10db0a4b6404fabd2853e413c5539e84235e866bcb06ba0b7d54ca2f
|
|
| MD5 |
ccc7c177c06784089ebc58b86638c6b3
|
|
| BLAKE2b-256 |
691843bf912b03d2259e3a5df05cc725533da4adce1c2e7ad82e786a0872778c
|
File details
Details for the file red_yt_cipher_solver-0.1.0-py3-none-any.whl.
File metadata
- Download URL: red_yt_cipher_solver-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
648fe444395d5401c5f2aaf293089a99d66ed5a966dde3cdb37c681d9eea24c3
|
|
| MD5 |
f01f3d6d05012a40c2dfb3ca4c8c978e
|
|
| BLAKE2b-256 |
909ffd1541ceb6ff45d0da9c327488dac816e623a4cc8ddf62d9fe301ec9e305
|