Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ npm install google-play-scraper
## Usage
Available methods:
- [app](#app): Retrieves the full detail of an application.
- [list](#list): Retrieves a list of applications from one of the collections at Google Play.
- [search](#search): Retrieves a list of apps that results of searching by the given term.
- [developer](#developer): Returns the list of applications by the given developer name.
- [suggest](#suggest): Given a string returns up to five suggestion to complete a search query term.
- ~~[list](#list): Retrieves a list of applications from one of the collections at Google Play.~~
- ~~[search](#search): Retrieves a list of apps that results of searching by the given term.~~
- ~~[developer](#developer): Returns the list of applications by the given developer name.~~
- ~~[suggest](#suggest): Given a string returns up to five suggestion to complete a search query term.~~
- [reviews](#reviews): Retrieves a page of reviews for a specific application.
- [similar](#similar): Returns a list of similar apps to the one specified.
- ~~[similar](#similar): Returns a list of similar apps to the one specified.~~
- [permissions](#permissions): Returns the list of permissions an app has access to.
- [categories](#categories): Retrieve a full list of categories present from dropdown menu on Google Play.
- ~~[categories](#categories): Retrieve a full list of categories present from dropdown menu on Google Play.~~
> Crossed-out methods are temporarily disabled due to their incorrectness

### app

Expand Down
18 changes: 10 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,19 @@ function memoized (opts) {
// need to rebuild the methods so they all share the same memoized appMethod
const doMemoize = (fn) => memoizee(fn, cacheOpts);
const mAppMethod = memoizee(appMethod, cacheOpts);
const mParseList = R.partial(getParseList, [mAppMethod]);
// FIXME disabled since currently they don't work
// const mParseList = R.partial(getParseList, [mAppMethod]);

// FIXME disabled since currently they don't work
const otherMethods = {
list: require('./lib/list'),
search: R.partial(require('./lib/search'), [mParseList, mAppMethod]),
suggest: require('./lib/suggest'),
developer: require('./lib/developer'),
// list: require('./lib/list'),
// search: R.partial(require('./lib/search'), [mParseList, mAppMethod]),
// suggest: require('./lib/suggest'),
// developer: require('./lib/developer'),
reviews: require('./lib/reviews'),
similar: require('./lib/similar'),
permissions: require('./lib/permissions'),
categories: require('./lib/categories')
// similar: require('./lib/similar'),
permissions: require('./lib/permissions')
// categories: require('./lib/categories')
};

return Object.assign({ app: mAppMethod },
Expand Down
134 changes: 74 additions & 60 deletions lib/mappers/details.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,107 +6,120 @@ const cheerio = require('cheerio');

const MAPPINGS = {
// FIXME add appId
title: ['ds:5', 0, 0, 0],
title: ['ds:5', 1, 2, 0, 0],
description: {
path: ['ds:5', 0, 10, 0, 1],
path: ['ds:5', 1, 2, 72, 0, 1],
fun: descriptionText
},
descriptionHTML: ['ds:5', 0, 10, 0, 1],
summary: ['ds:5', 0, 10, 1, 1],
installs: ['ds:5', 0, 12, 9, 0],
minInstalls: ['ds:5', 0, 12, 9, 1],
maxInstalls: ['ds:5', 0, 12, 9, 2],
score: ['ds:6', 0, 6, 0, 1],
scoreText: ['ds:6', 0, 6, 0, 0],
ratings: ['ds:6', 0, 6, 2, 1],
reviews: ['ds:6', 0, 6, 3, 1],
descriptionHTML: ['ds:5', 1, 2, 72, 0, 1],
summary: ['ds:5', 1, 2, 73, 0, 1],
installs: ['ds:5', 1, 2, 13, 0],
minInstalls: ['ds:5', 1, 2, 13, 1],
maxInstalls: ['ds:5', 1, 2, 13, 2],
score: ['ds:5', 1, 2, 51, 0, 1],
scoreText: ['ds:5', 1, 2, 51, 0, 0],
ratings: ['ds:5', 1, 2, 51, 2, 1],
reviews: ['ds:5', 1, 2, 51, 3, 1],
histogram: {
path: ['ds:6', 0, 6, 1],
path: ['ds:5', 1, 2, 51, 1],
fun: buildHistogram
},

price: {
path: ['ds:3', 0, 2, 0, 0, 0, 1, 0, 0],
path: ['ds:5', 1, 2, 57, 0, 0, 0, 0, 1, 0, 0],
fun: (val) => val / 1000000 || 0
},
free: {
path: ['ds:3', 0, 2, 0, 0, 0, 1, 0, 0],
path: ['ds:5', 1, 2, 57, 0, 0, 0, 0, 1, 0, 0],
// considered free only if price is exactly zero
fun: (val) => val === 0
},
currency: ['ds:3', 0, 2, 0, 0, 0, 1, 0, 1],
currency: ['ds:5', 1, 2, 57, 0, 0, 0, 0, 1, 0, 1],
priceText: {
path: ['ds:3', 0, 2, 0, 0, 0, 1, 0, 2],
path: ['ds:5', 1, 2, 57, 0, 0, 0, 0, 1, 0, 2],
fun: priceText
},
available: {
path: ['ds:5', 0, 12, 11, 0],
path: ['ds:5', 1, 2, 18, 0],
fun: Boolean
},
offersIAP: {
path: ['ds:5', 0, 12, 12, 0],
path: ['ds:5', 1, 2, 19, 0],
fun: Boolean
},
IAPRange: ['ds:5', 0, 12, 12, 0],
size: ['ds:8', 0],
androidVersion: {
path: ['ds:8', 2],
fun: normalizeAndroidVersion
},
androidVersionText: ['ds:8', 2],
developer: ['ds:5', 0, 12, 5, 1],
IAPRange: ['ds:5', 1, 2, 19, 0],
// // TODO
// size: ['ds:8', 0],
// // TODO
// androidVersion: {
// path: ['ds:8', 2],
// fun: normalizeAndroidVersion
// },
// // TODO
// androidVersionText: ['ds:8', 2],
developer: ['ds:5', 1, 2, 68, 0],
developerId: {
path: ['ds:5', 0, 12, 5, 5, 4, 2],
path: ['ds:5', 1, 2, 68, 1, 4, 2],
fun: (devUrl) => devUrl.split('id=')[1]
},
developerEmail: ['ds:5', 0, 12, 5, 2, 0],
developerWebsite: ['ds:5', 0, 12, 5, 3, 5, 2],
developerAddress: ['ds:5', 0, 12, 5, 4, 0],
privacyPolicy: ['ds:5', 0, 12, 7, 2],
developerInternalID: ['ds:5', 0, 12, 5, 0, 0],
genre: ['ds:5', 0, 12, 13, 0, 0],
genreId: ['ds:5', 0, 12, 13, 0, 2],
familyGenre: ['ds:5', 0, 12, 13, 1, 0],
familyGenreId: ['ds:5', 0, 12, 13, 1, 2],
icon: ['ds:5', 0, 12, 1, 3, 2],
headerImage: ['ds:5', 0, 12, 2, 3, 2],
developerEmail: ['ds:5', 1, 2, 69, 1, 0],
developerWebsite: ['ds:5', 1, 2, 69, 0, 5, 2],
developerAddress: ['ds:5', 1, 2, 69, 2, 0],
privacyPolicy: ['ds:5', 1, 2, 99, 0, 5, 2],
// // TODO
// developerInternalID: ['ds:5', 0, 12, 5, 0, 0],
genre: ['ds:5', 1, 2, 79, 0, 0, 0],
genreId: ['ds:5', 1, 2, 79, 0, 0, 2],
// // TODO
// familyGenre: ['ds:5', 0, 12, 13, 1, 0],
// // TODO
// familyGenreId: ['ds:5', 0, 12, 13, 1, 2],
icon: ['ds:5', 1, 2, 95, 0, 3, 2],
headerImage: ['ds:5', 1, 2, 96, 0, 3, 2],
screenshots: {
path: ['ds:5', 0, 12, 0],
path: ['ds:5', 1, 2, 78, 0],
fun: (screenshots) => {
if (screenshots === null) return [];
return screenshots.map(R.path([3, 2]));
}
},
video: ['ds:5', 0, 12, 3, 0, 3, 2],
videoImage: ['ds:5', 0, 12, 3, 1, 3, 2],
contentRating: ['ds:5', 0, 12, 4, 0],
contentRatingDescription: ['ds:5', 0, 12, 4, 2, 1],
video: ['ds:5', 1, 2, 100, 0, 0, 3, 2],
videoImage: ['ds:5', 1, 2, 100, 1, 0, 3, 2],
contentRating: ['ds:5', 1, 2, 9, 0],
contentRatingDescription: ['ds:5', 1, 2, 9, 2, 1],
adSupported: {
path: ['ds:5', 0, 12, 14, 0],
path: ['ds:5', 1, 2, 48],
fun: Boolean
},
released: ['ds:5', 0, 12, 36],
released: ['ds:5', 1, 2, 10, 0],
updated: {
path: ['ds:5', 0, 12, 8, 0],
path: ['ds:5', 1, 2, 145, 0, 1, 0],
fun: (ts) => ts * 1000
},
version: ['ds:8', 1],
recentChanges: ['ds:5', 0, 12, 6, 1],
comments: {
useServiceRequestId: 'UsvDTd',
path: [0],
fun: extractComments
},
editorsChoice: {
path: ['ds:5', 0, 12, 15, 0],
fun: Boolean
version: {
path: ['ds:5', 1, 2, 140, 0, 0, 0],
fun: (val) => val || 'VARY'
},
features: {
path: ['ds:5', 0, 12, 16],
fun: extractFeatures
}
recentChanges: ['ds:5', 1, 2, 144, 1, 1],
// // TODO
// comments: {
// useServiceRequestId: 'UsvDTd',
// path: ['ds:8', 0],
// fun: extractComments
// }
// // TODO
// editorsChoice: {
// path: ['ds:5', 0, 12, 15, 0],
// fun: Boolean
// },
// // TODO
// features: {
// path: ['ds:5', 0, 12, 16],
// fun: extractFeatures
// }
};

// eslint-disable-next-line no-unused-vars
function extractFeatures (featuresArray) {
if (featuresArray === null) {
return [];
Expand All @@ -130,6 +143,7 @@ function priceText (priceText) {
return priceText || 'Free';
}

// eslint-disable-next-line no-unused-vars
function normalizeAndroidVersion (androidVersionText) {
const number = androidVersionText.split(' ')[0];
if (parseFloat(number)) {
Expand Down
Loading
Loading