Update download.sh
All checks were successful
Scrape / scrape (push) Successful in 30s

This commit is contained in:
Henrik Lindhe 2026-05-31 12:17:26 +02:00
parent 8f1487d0f4
commit a26963e68a

View file

@ -58,7 +58,7 @@ curl -s -L "$URL" -o "$TEMP_FILE" || {
} }
# Get file extension based on MIME type # Get file extension based on MIME type
EXTENSION=$(get_file_extension "$TEMP_FILE") EXTENSION=.json
# Always construct filename from the URL, replacing slashes with hyphens # Always construct filename from the URL, replacing slashes with hyphens
FILENAME=$(echo "$URL" | sed -E 's|^https?://||' | sed -E 's|^www\.||' | sed 's|/$||' | sed 's|/|-|g') FILENAME=$(echo "$URL" | sed -E 's|^https?://||' | sed -E 's|^www\.||' | sed 's|/$||' | sed 's|/|-|g')
@ -81,7 +81,7 @@ if [ "$EXTENSION" = ".json" ]; then
PRETTY_TEMP=$(mktemp) PRETTY_TEMP=$(mktemp)
# Try to pretty-print with jq, but don't fail if jq fails # Try to pretty-print with jq, but don't fail if jq fails
if command -v jq &> /dev/null; then if command -v jq &> /dev/null; then
if jq . "$TEMP_FILE" > "$PRETTY_TEMP" 2>/dev/null; then if jq '.warnings.warning |= sort_by(.id)' "$TEMP_FILE" > "$PRETTY_TEMP" 2>/dev/null; then
mv "$PRETTY_TEMP" "$TEMP_FILE" mv "$PRETTY_TEMP" "$TEMP_FILE"
else else
rm -f "$PRETTY_TEMP" rm -f "$PRETTY_TEMP"