Skip to content

Instantly share code, notes, and snippets.

@nkalvi
Created June 1, 2016 04:23
Show Gist options
  • Save nkalvi/7e277d3be15d4746733f7bf9d2e5f2d0 to your computer and use it in GitHub Desktop.
Save nkalvi/7e277d3be15d4746733f7bf9d2e5f2d0 to your computer and use it in GitHub Desktop.
Python3.5: List iOS app details in tabular form (by reading .ipa files under ~/Music/iTunes/iTunes Media/Mobile Applications/)
#!/usr/bin/env python3
import sys
import plistlib
import zipfile
import glob
import os
columns = ['Title', 'Seller', 'Category', 'version', 'Released', 'Purchased', 'AppleIdForPurchase']
print(*columns, sep = "\t")
for f in glob.glob(os.path.expanduser('~/Music/iTunes/iTunes Media/Mobile Applications/') + '*.ipa'):
with zipfile.ZipFile(f) as myzip:
fp = myzip.read('iTunesMetadata.plist')
pl = plistlib.loads(fp)
values = [ pl['itemName'], pl['artistName'], pl['genre'], pl.get('bundleShortVersionString', 'no version'), pl['releaseDate'],
pl['purchaseDate'], pl['com.apple.iTunesStore.downloadInfo']['accountInfo']['AppleID'] ]
print(*values, sep = "\t")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment