I think an easy way is to cross compile a simple fetch program.
Using rust:
main.rs
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut args = std::env::args().skip(1);
let file = args.next().ok_or("no file")?;
let name = args.next().ok_or("no name")?;
let mut resp = ureq::get(&file).call()?.into_reader();
std::io::copy(&mut resp, &mut std::fs::File::create(name)?)?;
Ok(())
}
Cargo.toml
[package]
name = "fetch"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
ureq = { version = "2.7.1"}
[profile.release]
strip = true # Automatically strip symbols from the binary.
To cross compile https://github.com/bbqsrc/cargo-ndk make things easier, you still need to download android ndk for example from here https://dl.google.com/android/repository/android-ndk-r25c-linux.zip
cargo ndk -t arm64-v8a build --release
adb push target/aarch64-linux-android/release/fetch /data/local/tmp
Now you can use it with
adb shell "/data/local/tmp/fetch target_url file_name"