Last active
November 21, 2017 15:53
-
-
Save zaltoprofen/387d545efe8c46e2cdffd123c86631d1 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 | |
| # example | |
| # ./download_artwork.sh LIVE THE@TER PERFORMANCE 01 | |
| image_size=1600 | |
| download_artwork() { | |
| query=$(perl -MURI::Escape -e "print uri_escape('$*')") | |
| img_url=$(curl "https://itunes.apple.com/search?country=jp&media=music&entity=album&term=${query}"|jq -r '.results[0].artworkUrl100'|sed -e "s/100x100/${image_size}x${image_size}/") | |
| if [[ "null" != "$img_url" ]];then | |
| curl -o "$*.jpg" "$img_url" | |
| fi | |
| } | |
| download_artwork "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment