Skip to content

Instantly share code, notes, and snippets.

@jkap
Last active March 14, 2019 19:10
Show Gist options
  • Save jkap/69295da6fb2715566660762a164ee9de to your computer and use it in GitHub Desktop.
Save jkap/69295da6fb2715566660762a164ee9de to your computer and use it in GitHub Desktop.
fetch-park-maps.fish

fetch-park-maps.fish

What is it?

A simple fish shell script to download the current park map PDFs for all US Disney parks.

Why?

I found this endpoint while doing API research for Monorail Blue (coming soon) and wanted these PDFs for my own archive. Now you can have them too!

What do I need to run it?

  • fish shell
  • exiftool
  • jq

You can download them all on a mac with homebrew with:

brew install jq exiftool fish

License?

MIT

#!/usr/bin/env fish
set park_ids 330339 \
336894 \
80007823 \
80007944 \
80007998 \
80007838
set park_keys DisneylandResortMagicKingdom \
DisneylandResortCaliforniaAdventure \
WaltDisneyWorldAnimalKingdom \
WaltDisneyWorldMagicKingdom \
WaltDisneyWorldHollywoodStudios \
WaltDisneyWorldEpcot
set access_token (curl -X "POST" "https://authorization.go.com/token" \
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
--data-urlencode "assertion_type=public" \
--data-urlencode "client_id=WDPRO-MOBILE.MDX.WDW.ANDROID-PROD" \
--data-urlencode "grant_type=assertion" \
| jq --raw-output '.access_token')
set base_url "https://api.wdpro.disney.go.com/global-pool-override-B/facility-service/theme-parks"
set download_dir "maps"
for i in (seq 1 6)
set park_key $park_keys[$i]
set url "$base_url/$park_ids[$i]?region=us"
echo $url
set map_url (curl $url \
-H "Authorization: BEARER $access_token" | jq --raw-output '.media .pdfLink .url')
set map_dir "$download_dir/$park_key"
mkdir -p $map_dir
set map_file "$map_dir/tmp.pdf"
curl -o $map_file $map_url
set mod_date (exiftool -ModifyDate -d "%F" -s -s -s $map_file)
mv $map_file $map_dir/$mod_date.pdf
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment