Created
March 23, 2025 13:18
-
-
Save elderica/c8d29373229099b78f176f30edd270bf to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
set -eu | |
API_URL='http://www.bing.com/HPImageArchive.aspx' | |
OUTPUT_FILE="$HOME/bing-photo-of-the-day.jpg" | |
URL=$(curl -sSLG -d 'format=js' -d "mkt=ja-JP" -d "idx=0" -d "n=1" "${API_URL}" | jq -r '.images[].url') | |
FULL_URL=$(printf 'https://www.bing.com%s' "${URL}") | |
curl -sSLo "${OUTPUT_FILE}" "${FULL_URL}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment