Last active
November 21, 2017 07:18
-
-
Save haje01/bcff41bc68d245f47c1c to your computer and use it in GitHub Desktop.
Google Play Review Scraper
This file contains 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
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you have any idea what the reviewType argument is for? I don't seem to be able to figure out.