Skip to content

Instantly share code, notes, and snippets.

@ddnomad
Created October 29, 2020 16:35
Show Gist options
  • Save ddnomad/5061ce035e7d6d99f6235bdda05b06e0 to your computer and use it in GitHub Desktop.
Save ddnomad/5061ce035e7d6d99f6235bdda05b06e0 to your computer and use it in GitHub Desktop.
Download official Ghibli wallpapers from their website without clicking things till the end of days
#!/usr/bin/env bash
# Download official Ghibli wallpapers for a given movie from their website.
# https://soranews24.com/2020/09/20/studio-ghibli-releases-400-images-from-eight-movies-free-to-download-online/
#
# Movie names:
# - marnie (When Marnie Was There)
# - kaguyahime (The Tale of The Princess Kaguya)
# - kazetachinu (The Wind Rises)
# - kokurikozaka (From Up on Poppy Hill)
# - karigurashi (Arrietty)
# - ponyo (Ponyo on the Cliff by the Sea)
# - ged (Tales from Earthsea)
# - chihiro (Spirited Away)
set -euo pipefail
readonly BASE_URL=http://www.ghibli.jp/works
function main {
if test "$#" -ne 2; then
>&2 echo "Usage: $0 MOVIE_NAME OUTPUT_DIR"
exit 1
fi
local movie
local output_dir
movie="$1"
output_dir="$2"
if ! test -d "${output_dir}"; then
>&2 echo "Error: Output directory does not exist: ${output_dir}"
exit 1
fi
cd "${output_dir}"
curl -s "${BASE_URL}/${movie}/" | \
sed -ne 's@.*\(http://.*/gallery/'"${movie}"'[0-9][0-9][0-9].jpg\).*@\1@p' | \
xargs -L1 wget
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment