Skip to content

Instantly share code, notes, and snippets.

@haje01
Last active November 21, 2017 07:18
Show Gist options
  • Save haje01/bcff41bc68d245f47c1c to your computer and use it in GitHub Desktop.
Save haje01/bcff41bc68d245f47c1c to your computer and use it in GitHub Desktop.
Google Play Review Scraper
import sys
import urllib
import urllib2
import json
import codecs
url = "https://play.google.com/store/getreviews"
values = {
"reviewType": "0", "pageNum": "2",
"id":
"com.com2us.soulcollector.normal.freefull.google.global.android.common",
"reviewSortOrder": "2", "xhr": "1"
}
def load_review(page):
values["pageNum"] = str(page)
data = urllib.urlencode(values)
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
jdata = response.read()
page = json.loads(jdata[6:])
try:
review = page[0][2]
return review
except IndexError:
return None
def main():
page = 0
sysenc = sys.stdout.encoding
while True:
review = load_review(page)
if review is None:
break
if sysenc == 'cp949':
review = codecs.encode(review, sysenc, 'ignore')
print review
page += 1
if __name__ == "__main__":
main()
@AngshumanGhosh
Copy link

Do you have any idea what the reviewType argument is for? I don't seem to be able to figure out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment