Skip to content

Instantly share code, notes, and snippets.

@jugaldb
Created September 25, 2024 04:41
Show Gist options
  • Save jugaldb/26995185d73a727addf2d33055fba233 to your computer and use it in GitHub Desktop.
Save jugaldb/26995185d73a727addf2d33055fba233 to your computer and use it in GitHub Desktop.
#!/bin/bash
# URL of the JSON data
JSON_URL="https://storage.googleapis.com/panels-api/data/20240916/media-1a-i$
# Function to download a file
download_file() {
local url="$1"
local filename="$2"
curl -s -o "$filename" "$url"
if [ $? -eq 0 ]; then
echo "Downloaded: $filename"
else
echo "Failed to download: $filename"
rm -f "$filename"
fi
}
# Create a directory to store the downloaded files
mkdir -p dhd_files
# Fetch the JSON data and parse it to download "dhd" files
curl -s "$JSON_URL" | jq -r '.data | to_entries[] | select(.value.dhd != nul$
while read -r url filename; do
download_file "$url" "dhd_files/$filename"
done
echo "Download process completed."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment