app-store-scraper
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -7,2 +7,4 @@ 'use strict'; | ||
module.exports.collection = c.collection; | ||
module.exports.device = c.device; | ||
module.exports.sort = c.sort; | ||
@@ -14,1 +16,2 @@ module.exports.app = require('./lib/app'); | ||
module.exports.similar = require('./lib/similar'); | ||
module.exports.reviews = require('./lib/reviews'); |
@@ -47,2 +47,3 @@ 'use strict'; | ||
return new Promise(function (resolve, reject) { | ||
console.log('Making request: %s %j', url, headers); | ||
debug('Making request: %s %j', url, headers); | ||
@@ -49,0 +50,0 @@ const req = superagent.get(url); |
@@ -91,5 +91,16 @@ 'use strict'; | ||
UTILITIES: 6002, | ||
WEATHER: 6001, | ||
WEATHER: 6001 | ||
}; | ||
module.exports = {collection, category}; | ||
const device = { | ||
IPAD: 'iPadSoftware', | ||
MAC: 'macSoftware', | ||
ALL: 'software' | ||
}; | ||
const sort = { | ||
RECENT: 'mostRecent', | ||
HELPFUL: 'mostHelpful' | ||
}; | ||
module.exports = {collection, category, device, sort}; |
@@ -5,7 +5,4 @@ 'use strict'; | ||
const BASE_URL = 'https://itunes.apple.com/search'; | ||
const c = require('./constants'); | ||
search.IPAD = 'iPadSoftware'; | ||
search.MAC = 'macSoftware'; | ||
search.ALL = 'software'; | ||
// TODO allow override country & language | ||
@@ -20,3 +17,3 @@ // TODO handle not found | ||
const entity = opts.device || search.ALL; | ||
const entity = opts.device || c.device.ALL; | ||
const num = opts.num || 50; | ||
@@ -23,0 +20,0 @@ return resolve(`${BASE_URL}?media=software&entity=${entity}&term=${opts.term}&limit=${num}`); |
{ | ||
"name": "app-store-scraper", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "scrape data from the itunes app store", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -140,3 +140,3 @@ # app-store-scraper | ||
* `term`: the term to search for (required). | ||
* `device`: the device to filter for. Defaults to `search.ALL`, available options are `search.ALL`, `search.MAC`, `search.IOS`. | ||
* `device`: the device to filter for. Defaults to `store.device.ALL`, available options are `store.device.ALL`, `store.dvice.MAC`, `store.device.IOS`. | ||
* `num`: the amount of elements to retrieve. Defaults to `50`, maximum allowed is `200`. | ||
@@ -152,3 +152,3 @@ | ||
num: 2, | ||
device: store.search.IOS | ||
device: store.device.IOS | ||
}) | ||
@@ -238,1 +238,46 @@ .then(console.log) | ||
``` | ||
### reviews | ||
Retrieves a page of reviews for the app. Options: | ||
* `id`: the iTunes "trackId" of the app, for example `553834731` for Candy Crush Saga. Either this or the `appId` should be provided. | ||
* `appId`: the iTunes "bundleId" of the app, for example `com.midasplayer.apps.candycrushsaga` for Candy Crush Saga. Either this or the `id` should be provided. | ||
* `country`: the two letter country code to get the reviews from. Defaults to `us`. | ||
* `page`: the review page number to retrieve. Defaults to `1`, maximum allowed is `10`. | ||
* `sort`: the review sort order. Defaults to `store.sort.RECENT`, available options are `store.sort.RECENT` and `store.sort.HELPFUL`. | ||
Example: | ||
```js | ||
var store = require('app-store-scraper'); | ||
store.reviews({ | ||
appId: 'com.midasplayer.apps.candycrushsaga', | ||
sort: itunes.sort.HELPFUL, | ||
page: 2 | ||
}) | ||
.then(console.log) | ||
.catch(console.log); | ||
``` | ||
Returns: | ||
```js | ||
[ { userName: 'Linda D. Lopez', | ||
userUrl: 'https://itunes.apple.com/us/reviews/id324568166', | ||
version: '1.80.1', | ||
score: 5, | ||
title: 'Great way to pass time or unwind', | ||
text: 'I was a fan of Bejeweled many moons ago...', | ||
url: 'https://itunes.apple.com/us/review?id=553834731&type=Purple%20Software' },, | ||
{ userName: 'Jennamaxkidd', | ||
userUrl: 'https://itunes.apple.com/us/reviews/id223990784', | ||
version: '1.80.1', | ||
score: 1, | ||
title: 'Help! THE PROBLEM IS NOT FIXED!', | ||
text: 'STILL HAVING THE SAME ISSUE. It\'s happening again...', | ||
url: 'https://itunes.apple.com/us/review?id=553834731&type=Purple%20Software' }, | ||
(...) | ||
] | ||
``` |
21578
13
364
281