Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get iOS icons. Thanks to Brett Terpstra.
# Adapted from Brett Terpstra script:
# Gets the 1024px version of an app icon and applies a rounded mask. The result is displayed in Pythonista's console, you can tap and hold to save or copy it.
# You may find odd result: try searching for both device categories.
# If you find any bug, you can find me @silouane20 on Twitter.
from PIL import Image
from StringIO import StringIO
import re
import requests
def find_icon(terms, platform):
if platform == "1":
search_url = ''+ terms +'&entity=software'
search_url = ''+ terms+'&entity=iPadSoftware'
res = requests.get(search_url)
m ='artworkUrl512":"(.+?)", ', res.text)
if m:
found =
return found
def main():
print "Select chosen platform \n"
print "[1] iPhone"
print "[2] iPad\n"
platform = raw_input("")
if platform == "x":
print "Exited"
terms = raw_input("Input app name: ")
icon_url = find_icon(terms, platform)
if icon_url:
file = requests.get(icon_url)
image =
(width,height) = image.size
if width == 512:
mask_url = ""
elif width == 1024:
mask_url = ""
file = requests.get(mask_url)
mask =
print "Failed to get iTunes url"
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.