mirror of
https://github.com/srid/nixos-config.git
synced 2026-01-25 17:37:18 +08:00
23 lines
383 B
Nix
23 lines
383 B
Nix
{ writeShellApplication, curl, reader }:
|
|
|
|
writeShellApplication {
|
|
name = "article-extractor";
|
|
|
|
runtimeInputs = [ curl reader ];
|
|
|
|
text = ''
|
|
URL="$1"
|
|
|
|
# Create unique temp file
|
|
TEMP_HTML=$(mktemp)
|
|
|
|
# Download HTML
|
|
curl -s -L "$URL" > "$TEMP_HTML"
|
|
|
|
# Extract and output article to stdout
|
|
reader "$TEMP_HTML"
|
|
|
|
# Clean up
|
|
rm "$TEMP_HTML"
|
|
'';
|
|
}
|