API to get android google play reviews(Getting device name and app version)

前端 未结 6 1201
鱼传尺愫
鱼传尺愫 2020-12-08 05:00

I want to retrieve all the reviews for a specific app on google play and I need these informations from the reviews : rating, comment, device name and app version the review

6条回答
  •  鱼传尺愫
    2020-12-08 05:29

    An example in Python with new Reviews API using Service Account credentials.

    from httplib2 import Http
    from oauth2client.service_account import ServiceAccountCredentials
    from apiclient.discovery import build
    
    credentials = ServiceAccountCredentials.from_json_keyfile_name(
        '.json',
        scopes=['https://www.googleapis.com/auth/androidpublisher'])
    
    service = build('androidpublisher', 'v2', http=credentials.authorize(Http()))
    
    package_name = ""
    reviews_resource = service.reviews()
    reviews_page = reviews_resource.list(packageName=package_name, maxResults=100).execute()
    reviews_list = reviews_page["reviews"]
    
    infinite_loop_canary = 100
    while "tokenPagination" in reviews_page:
        reviews_page = reviews_resource.list(packageName=package_name,
                                   token=reviews_page["tokenPagination"]["nextPageToken"],
                                   maxResults=100).execute()
        reviews_list.extend(reviews_page["reviews"])
        infinite_loop_canary -= 1
        if infinite_loop_canary < 0:
            break
    

    Keep in mind - I found out, Reviews API only allow access to last two weeks comments-ratings. If you want to do some retroactive analysis it is better to get comments-ratings as csv files from where they are saved in your account's bucket on google-cloud.

提交回复
热议问题