-
-
Save jarrettbarnett/7813172 to your computer and use it in GitHub Desktop.
For exporting photos from Disney Photo Pass website
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 | |
# | |
# takes a url like this: | |
# http://www.disneyphotopass.com/api/photostore/getSharedImageList.ashx?ShareToken=[[token]] | |
# and saves all the pictures to ./disneypics | |
# | |
# url can be found by going to http://www.disneyphotopass.com/photoshare.aspx and sharing photos by email. | |
# the link will be in the email | |
[[ -n "$1" ]] || { echo "Please add the share url as a parameter"; exit 0; } | |
cnt=1 | |
regex='http://www.disneyphotopass.com/api/photostore/getSharedImageList.ashx\?ShareToken=([a-zA-Z0-9]+-){4}[a-zA-Z0-9]' | |
if [[ $1 =~ $regex ]] | |
then | |
token=`printf "%s" "$1"|cut -d= -f2` | |
url_xml="`wget -qO- $1`" | |
id_regex='id=' | |
for word in $url_xml | |
do | |
if [[ $word =~ $id_regex ]] | |
then | |
id=`printf "%s" "$word"|cut -d\" -f2` | |
img_url="http://www.disneyphotopass.com/api/photostore/previewEdits.pix?quality=100&ImageId=${id}"; | |
if [ ! -d ./disneypics ] | |
then | |
mkdir disneypics | |
fi | |
wget $img_url -O ./disneypics/disney_${cnt}.jpg | |
cnt=$(( $cnt + 1 )) | |
fi | |
done | |
else | |
echo "invalid link" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment