Tuesday, June 14, 2016

Download Latest iTunes Reviews with a Quick Python Script

Ever wanted to be able to download the latest itunes reviews for your app to display on your website, understand & analyze user requests better, or just have a copy for yourself?

I was trying to do just that and was happy to find that itunes support RSS feeds for every app in iTunes using the app id.

It's super simple once you know the format to start fetching your reviews and doing whatever you want with them programmatically.

How to Download Latest iTunes Reviews


1.  Find your app's id by looking at the url to your app on itunes.

2.  Construct the url to your RSS feed by replacing the <id> with your id (just the number part).
https://itunes.apple.com/rss/customerreviews/id=<app-id-goes-here>/json

3.  Start writing code to do whatever you want with reviews

A Quick Python Demo


This sample is pretty simple but quickly shows what is possible by printing out the rating and review for the most recent reviews of the app.
import json
import requests

resp = requests.get('https://itunes.apple.com/rss/customerreviews/id=<app-id-goes-here>/json')
itunesrssjson = json.loads( resp.content)

for entry in itunesrssjson['feed']['entry']:
print "{1}".format( entry.get("im:rating").get("label"), \
entry.get('content').get('label'))

Let's say you only want to look at 5 star reviews.  Just add a quick little if statement in there.
for entry in itunesrssjson['feed']['entry']:
if entry.get('content') and entry.get("im:rating").get("label") in ["5"]:
print "{1}".format( entry.get("im:rating").get("label"), \
entry.get('content').get('label'))

 

That's it!  Use or learn some python skills to sort, filter, fetch additional reviews and more.  Or you can always use whatever language you're best at.

Have fun getting your reviews the quick and easy way.

No comments:

Post a Comment