google-play-scraper
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -32,3 +32,8 @@ var Promise = require('bluebird'); | ||
var developer = detailsInfo.find('span[itemprop="name"]').text(); | ||
var genre = detailsInfo.find('span[itemprop="genre"]').text(); | ||
var genre = []; | ||
detailsInfo.find('span[itemprop="genre"]').each(function(i){ | ||
genre[i] = $(this).text(); | ||
}); | ||
var price = detailsInfo.find('meta[itemprop=price]').attr('content'); | ||
@@ -38,2 +43,3 @@ var icon = detailsInfo.find('img.cover-image').attr('src'); | ||
var additionalInfo = $('.details-section-contents'); | ||
var description = additionalInfo.find('div[itemprop=description] div'); | ||
var version = additionalInfo.find('div.content[itemprop="softwareVersion"]').text().trim(); | ||
@@ -47,3 +53,6 @@ var updated = additionalInfo.find('div.content[itemprop="datePublished"]').text().trim(); | ||
var maxInstalls = cleanInt(installs.split(' - ')[1]) || undefined; | ||
var comments = []; | ||
$('.quoted-review').each(function(i){ | ||
comments[i] = $(this).text().trim(); | ||
}); | ||
var ratingBox = $('.rating-box'); | ||
@@ -54,7 +63,7 @@ var reviews = cleanInt(ratingBox.find('span.reviews-num').text()); | ||
var histogram = { | ||
5: Number(ratingHistogram.find('.five .bar-number').text()), | ||
4: Number(ratingHistogram.find('.four .bar-number').text()), | ||
3: Number(ratingHistogram.find('.three .bar-number').text()), | ||
2: Number(ratingHistogram.find('.two .bar-number').text()), | ||
1: Number(ratingHistogram.find('.one .bar-number').text()) | ||
5: cleanInt(ratingHistogram.find('.five .bar-number').text()), | ||
4: cleanInt(ratingHistogram.find('.four .bar-number').text()), | ||
3: cleanInt(ratingHistogram.find('.three .bar-number').text()), | ||
2: cleanInt(ratingHistogram.find('.two .bar-number').text()), | ||
1: cleanInt(ratingHistogram.find('.one .bar-number').text()) | ||
}; | ||
@@ -69,3 +78,6 @@ //for other languages | ||
var description = $('.description div.id-app-orig-desc'); | ||
var screenshots = []; | ||
$('.thumbnails').find('img').nextAll().each(function(i, elem){ | ||
screenshots[i] = elem.attribs.src; | ||
}); | ||
@@ -91,3 +103,5 @@ return { | ||
free: price === '0', | ||
video: video | ||
video: video, | ||
comments: comments, | ||
screenshots: screenshots | ||
}; | ||
@@ -94,0 +108,0 @@ } |
@@ -56,1 +56,7 @@ module.exports.category = { | ||
}; | ||
module.exports.sort = { | ||
0: 'newest', | ||
1: 'rating', | ||
4: 'helpfulness' | ||
}; |
@@ -11,1 +11,2 @@ var c = require('./constants'); | ||
module.exports.developer = require('./developer'); | ||
module.exports.reviews = require('./reviews'); |
{ | ||
"name": "google-play-scraper", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "scrapes app data from google play store", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -42,9 +42,17 @@ # google-play-scraper | ||
reviews: 2312, | ||
histogram: { '1': 12, '2': 7, '3': 16, '4': 40, '5': 231 }, | ||
description: 'Everyone in town has gone zombie.', | ||
descriptionHTML: 'Everyone in town has gone <b>zombie</b>.', | ||
developer: 'DxCo Games', | ||
genre: 'Action', | ||
updated: 'May 26, 2015', | ||
genre: ['Action'], | ||
version: '1.4', | ||
size: '34M', | ||
requiredAndroidVersion: '2.3 and up', | ||
contentRating: 'Mature 17+', | ||
price: '0', | ||
free: true, | ||
video: 'https://www.youtube.com/embed/PFGj-W8Pe5s' | ||
screenshots: ['https://lh3.ggpht.com/le0bhlp7RTGDytoXelnY65Cx4pjUgVjnLypDGGWGfF6SbDMTkU6fPncaAH8Ew9RQAeY=h310'] | ||
video: 'https://www.youtube.com/embed/PFGj-W8Pe5s', | ||
comments: ['Great! Its a great time waster'] | ||
} | ||
@@ -196,1 +204,43 @@ ``` | ||
``` | ||
### reviews(opts) | ||
Retrieves a page of reviews for a specific application. Options: | ||
* `id`: Unique application id for Google Play. (e.g. id=com.mojang.minecraftpe maps to Minecraft: Pocket Edition game). | ||
* `sort` (defaults to `'newest'`): The way the reviews are going to be sorted. Accepted values are: | ||
* `'newest'` | ||
* `'rating'` | ||
* `'helpfulness'` | ||
* `page` (optional, defaults to 0): Number of page that contains reviews. Every page has 40 reviews at most. | ||
Example: | ||
``` javascript | ||
var gplay = require('google-play-scraper'); | ||
gplay.reviews({ | ||
id: 'com.mojang.minecraftpe', | ||
page: 0, | ||
sort: 'rating' | ||
}).then(function(apps){ | ||
console.log('Retrieved ' + apps.length + ' reviews!'); | ||
}).catch(function(e){ | ||
console.log('There was an error fetching the reviews!'); | ||
}); | ||
``` | ||
Results: | ||
```javascript | ||
{ userId: '105245098829984360718', | ||
userName: 'Inga El-Ansary', | ||
date: 'June 7, 2015', | ||
score: 5, | ||
title: 'I LOVE IT', | ||
text: 'It has skins and snowballs everything I wanted its so cool I love it!!!!!!!!' }, | ||
{ userId: '113710523919870296648', | ||
userName: 'Millie Hawthorne', | ||
date: 'January 24, 2015', | ||
score: 5, | ||
title: 'CAN NEVER WAIT TILL NEW UPDATE', | ||
text: 'Love it but needs to pay more attention to pocket edition' }] | ||
``` |
27119
16
475
245