Created
September 25, 2024 04:41
-
-
Save jugaldb/26995185d73a727addf2d33055fba233 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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