fix: restore playback via AllAnime client-crypto bootstrap - #1837
Closed
ssnake wants to merge 2 commits into
Closed
Conversation
The source site replaced its static key material (a 64-hex mask in the JS
bundle + "partB" in the landing HTML) with a runtime "client-crypto"
bootstrap handshake. Both scraped values are now empty, so fetch_keys'
XOR loop evaluated "0x" and aborted with "Illegal number: 0x".
The new key derivation only exists after the site's obfuscated,
self-rotating JavaScript executes, so it cannot be reproduced in POSIX
shell. fetch_keys now runs the site's own crypto in a JS runtime (deno
with --allow-net, preferred for its network-only sandbox; node >= 20 as
fallback) to obtain the AES-256 key, epoch, build id and content lane.
Also updates the request protocol the new backend requires:
- get_aa_req payload is now {v,ts,epoch,buildId,qh,k}; IV is
SHA-256(epoch:buildId:qh:ts:lane)[:12]
- get_episode_url extensions include "k":<lane> and the request sends
the x-build-id header
The persisted query hash is unchanged. Verified end-to-end: search,
key derivation, source decryption and link resolution all succeed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
works, tested with WSL Ubuntu 26.04 |
Closed
Collaborator
|
I will leave this open as a potential fix, despite it duplicating the more native implementation in #1829 |
CI runs shellcheck with -o all, which requires an explicit default *) case. Add a no-op default to the key-validation case. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
|
closing this since v5 is now released. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ani-cli <anything>fails at playback with:The source site (AllAnime / mkissa) replaced its static key material — a 64‑hex mask in the JS bundle plus
partBin the landing HTML — with a runtime client‑crypto bootstrap handshake. Both scraped values are now empty, so the XOR loop infetch_keysevaluated0xand aborted.Why the fix looks the way it does
The new key derivation only exists after the site's obfuscated, self‑rotating JavaScript runs (a runtime string‑array rotation defeats static grep/sed extraction, and the request‑signing proof
x-aa-bootis an HMAC chain over a build‑id‑derived mask). It cannot be reproduced in POSIX shell.fetch_keysnow runs the site's own crypto in a JS runtime to obtain the AES‑256 key, epoch, build id and content lane:--allow-net, which confines the executed site code to network access only (no filesystem/process/env).The embedded helper downloads the crypto chunk, neutralises its ESM imports, evaluates it in a stubbed browser‑like sandbox, and calls the site's own bootstrap entrypoint. It emits
KEY/EPOCH/BUILDID/LANE, andfetch_keysdies with a clear message if anything fails (no more cryptic crash).Protocol changes the new backend requires
get_aa_reqpayload is now{v,ts,epoch,buildId,qh,k}; IV =SHA‑256(epoch:buildId:qh:ts:lane)[:12].get_episode_urlrequest extensions include"k":<lane>and the request sends thex-build-idheader.New dependency (please review)
This adds a deno or node runtime requirement and executes the source site's JavaScript. That is a real departure from ani-cli's pure‑POSIX‑shell design, and I'm flagging it explicitly for discussion — but the site's key handshake is deliberately non‑reproducible in shell, so some form of JS execution is currently the only way to restore playback.
deno --allow-netkeeps the executed remote code sandboxed to the network.Verification
End‑to‑end against the live site: search → key derivation → source decryption → link resolution all succeed, and a real playable
.mp4URL is returned (tested viaANI_CLI_PLAYER=debug). Helper produces identical output under both node and deno.sh -nandbash -npass.