Skip to content

Instantly share code, notes, and snippets.

@sajidrahman
Created June 11, 2019 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sajidrahman/8738edfcf766d2b9dfb1c4f75df62a27 to your computer and use it in GitHub Desktop.
Save sajidrahman/8738edfcf766d2b9dfb1c4f75df62a27 to your computer and use it in GitHub Desktop.
A sample code snippet to use google-play-scraper API with 'Promise' values.
/**
Author: Sajid
A sample code snippet to use google play scraper API
with Promise values.
Prerequisite: please install the following libraries first
before testing the code:
npm install franc
npm install google-play-scraper
**/
var gplay = require('google-play-scraper');
var franc = require('franc')
var appDetails;
function initialize() {
console.log("Initialized app details");
return gplay.app({appId: 'com.spotify.music'});
}
function main() {
var initializePromise = initialize();
initializePromise.then(function(result) {
appDetails = result;
// Use app details from here
var appDescription = appDetails.description;
console.log(appDetails.title);
console.log("Language detected as ", franc(appDescription));
console.log("Minimum no. of downloads ",appDetails.minInstalls);
console.log("App rating: ",appDetails.ratings);
}, function(err) {
console.log(err);
})
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment