Created
June 11, 2019 17:04
-
-
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.
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
/** | |
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