Skip to content

crawling for reviews of google play #36

Description

@sangheestyle

Need to get reviews from google play for apps. Here is a basic code snippet. I worked.

var request = require('request');
var cheerio = require('cheerio');

// Set the headers
var headers = { 'User-Agent': 'Wild/0.0.1'
              , 'Content-Type': 'application/x-www-form-urlencoded'
              }

// Configure the request
var options = { url: 'https://play.google.com/store/getreviews'
              , method: 'POST'
              , headers: headers
              , form: { 'reviewType': 0
                      , 'pageNum': 1
                      , 'id': 'com.github.mobile'
                      , 'reviewSortOrder': 2
                      }
              }

// Start the request
request(options, function (error, response, body) {
    if (!error && response.statusCode == 200) {
        var htmlString = JSON.parse(body.slice(7, -1))[2];
        var reviews = [];
        $ = cheerio.load(htmlString);
        $('.single-review').each(function(i, elem) {
          reviews[i] = $(this).text();
        });
        console.log(reviews[0]);
    }
})

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions