Skip to content

feat(ytmusic): native VISIONOS + rquickjs (.qbc) cipher and quickjs-ng fallback (remove Deno) - #1

Merged
ajisth69 merged 1 commit into
Clash-Projects:mainfrom
ajisth69:feat/native-stream-rquickjs
Nov 29, 2026
Merged

ajisth69 merged 1 commit into
Clash-Projects:mainfrom
ajisth69:feat/native-stream-rquickjs

Conversation

@ajisth69

Copy link
Copy Markdown
Member

Problem & Resulting Behavior

Previously, lastwave-ytmusic spawned yt-dlp + deno for every YouTube Music track, requiring a ~94 MB external Deno runtime and ~3–5s per track lookup.

This PR shifts primary stream resolution to native InnerTube (VISIONOS → ANDROID_VR → WEB_REMIX with an embedded rquickjs .qbc bytecode cipher adapted from Clash-Projects/firebird), removes the deno requirement completely, and updates yt-dlp fallback to --js-runtimes quickjs,node (quickjs-ng / qjs ~1.8 MB):

  • Native InnerTube waterfall (crates/lastwave-ytmusic/src/player/stream.rs): Fetches/caches visitorData via InnerTube::ensure_visitor_data, resolves unciphered streams via VISIONOS / ANDROID_VR (~250–750 ms), and uses signed-in WEB_REMIX + .qbc bytecode when needed.
  • In-process QuickJS .qbc cipher (crates/lastwave-ytmusic/src/player/cipher.rs): Validates community player recipes (ZemerTeam/zemer-cipher, MetrolistGroup/faraday), splices _result.sig/_result.n into base.js, compiles stripped .qbc bytecode cached on disk, and deciphers signatureCipher + n challenges in-process.
  • Header-aware mpv loading (crates/lastwave-audio/src/lib.rs, player/mod.rs): Adds Mpv::load_with_headers so stream-bound User-Agent, Origin, Referer, and X-Goog-Visitor-Id reach mpv cleanly.
  • quickjs-ng fallback & doctor (stream.rs, doctor.rs, docs): Removes deno checks/requirements, marks yt-dlp and qjs as optional fallback/cookie tools, and passes --js-runtimes quickjs,node.

Validation (Windows 11 x86_64, LASTWAVE_REQUIRE_MPV=1 with mpv v0.42.0)

  • cargo fmt --all --check — passed
  • cargo clippy --workspace --all-targets --locked -- -D warnings — passed (0 errors)
  • cargo test --workspace --locked -- --test-threads=1 — passed across all crates (lastwave: 7, lastwave-audio: 11 unit + 2 real-mpv fixtures, lastwave-core: 20, lastwave-os: 2, lastwave-sources: 15, lastwave-tui: 161, lastwave-ytmusic: 101)
  • cargo check -p lastwave --no-default-features --locked — passed
  • Online live checks (--ignored):
    • player::cipher::tests::compiles_and_solves_live_youtube_player_qbc — passed against live YouTube (sts=20779, 3,015 KB .qbc, warm disk load ~156 ms, solve ~93 ms)
    • player::stream::tests::yt_dlp_finds_a_stream — passed in 0.96s via VISIONOS, verified HTTP 206 at both bytes=0-1023 and bytes=1100000-1101023
    • lastwave doctor & lastwave play ytmusic:track:plnfIj7dkJE (--ao=null) with only mpv on PATH (no yt-dlp, deno, or qjs) — passed (10 available · no problems, live playback progressed 0:00 → 0:01 / 3:51)

@ajisth69
ajisth69 force-pushed the feat/native-stream-rquickjs branch from 0fd4436 to 72c93de Compare November 29, 2026 05:37
@ajisth69
ajisth69 merged commit 13ca601 into Clash-Projects:main Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant