diff options
| author | Claude <noreply@anthropic.com> | 2026-09-21 08:38:50 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-09-21 08:38:50 +0000 |
| commit | 433866c912a5dc687c02bf597eff093e3b2615ef (patch) | |
| tree | 9729b0e0df8c7436e9f94563281d7913d23f362f /app/build.gradle.kts | |
| parent | 5876025559ba0ad287d3a7a4d9fa0246509e668e (diff) | |
Embed yt-dlp via Chaquopy instead of shelling out to Termux
Verified end to end on an emulator: the probe resolves a real video and the
download lands 54,006,240 bytes of m4a, matching the size the probe predicted.
Two traps found by running it rather than reasoning about it:
- Chaquopy defaults to CPython 3.8, which yt-dlp no longer supports, so pip
silently resolves 2024.10.22 -- the last release that did, nearly two years
stale, and YouTube extraction does not work with it. The build succeeds and
the feature is dead. Pinned to 3.12, which gets 2026.8.19, and
YouTubeAudioTest now fails on any pre-2025 yt-dlp so it cannot regress
quietly.
- Chaquopy 16.1.0 calls org.gradle.util.VersionNumber, removed in Gradle 9,
so Gradle is pinned to 8.14.3 here while FeeDreader stays on 9.5. AGP stays
at 8.13.2. Chaquopy 17 requires AGP 9.x, so moving off this means bumping
all three together.
yt-dlp's JSON is parsed through a separate, unit-tested mapping rather than
inline in the Chaquopy call. It is a separate project on its own release
cadence and is the boundary most likely to drift, so a field going missing or
changing type should fail a test rather than crash on the phone. Parsed with
kotlinx.serialization because org.json is an empty stub off device, which
would have made the mapping untestable.
Audio-only by design: separate streams need ffmpeg to merge, the documented
yt-dlp failure mode on Android, and a pre-muxed audio stream has nothing to
merge. No ffmpeg dependency at all.
No proof-of-origin token support, deliberately -- obtaining one means running
Google's attestation script in a WebView, a different act from downloading,
and it is not needed from an ordinary connection.
Known risk recorded in CLAUDE.md: yt-dlp has deprecated YouTube extraction
without a JavaScript runtime, and there is no deno or node on Android.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
Diffstat (limited to 'app/build.gradle.kts')
| -rw-r--r-- | app/build.gradle.kts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a1d1854..585cbc8 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -6,6 +6,7 @@ plugins { id("com.google.devtools.ksp") id("io.gitlab.arturbosch.detekt") id("jacoco") + id("com.chaquo.python") } android { @@ -22,6 +23,13 @@ android { versionCode = 1 versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + + ndk { + // CPython ships as native code, so every ABI included multiplies the APK size. + // arm64 is the phone; x86_64 is the emulator. + abiFilters += listOf("arm64-v8a", "x86_64") + } + } buildTypes { @@ -110,6 +118,21 @@ dependencies { debugImplementation("androidx.compose.ui:ui-test-manifest") } +chaquopy { + defaultConfig { + // Not the default 3.8. yt-dlp dropped Python 3.8 support, so pip silently resolves the + // last release that still supported it -- 2024.10.22 -- which is stale enough that + // YouTube extraction no longer works. The build succeeds and the feature doesn't. + version = "3.12" + // The extractor itself. yt-dlp is pure Python and updates independently of this app, + // which is the entire reason for embedding it rather than reimplementing YouTube's + // stream resolution against a target that changes without notice. + pip { + install("yt-dlp") + } + } +} + detekt { buildUponDefaultConfig = true config.setFrom(files("$rootDir/config/detekt/detekt.yml")) |
