Last active
May 29, 2017 12:49
-
-
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
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
#!/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