Skip to content

Instantly share code, notes, and snippets.

@enigmaticape
Last active May 29, 2017 12:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enigmaticape/5564534 to your computer and use it in GitHub Desktop.
Save enigmaticape/5564534 to your computer and use it in GitHub Desktop.
Grab and parse iTunes App Store RSS feed and coiunt how many of the top grossing apps for a particular store are currently free
#!/usr/bin/env python
# topgrossingfreeapps.py [country code]
# us, gb, ch, etc
# quick and dirty python script to grab the percentage
# of top grossing aps in a given app store which are
# currently free
import feedparser
import sys
cc = sys.argv[1] if len(sys.argv) > 1 else "us"
feed = feedparser.parse( "https://itunes.apple.com/"
+ cc +
"/rss/topgrossingapplications/limit=400/xml" )
count = 0
free = 0
for entry in feed['entries']:
price = entry['im_price']['amount']
count += 1
if price == "0.00000":
free +=1
print "\nCountry Code : " + cc + \
"\nTotal : " + str(count) + \
"\nFree : " + str(free) + \
" ( " + str( (float(free)/count) * 100) + \
" % )\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment