app-store-scraper
Advanced tools
Comparing version 0.16.3 to 0.17.0
@@ -12,2 +12,3 @@ 'use strict'; | ||
developer: require('./lib/developer'), | ||
privacy: require('./lib/privacy'), | ||
suggest: require('./lib/suggest'), | ||
@@ -14,0 +15,0 @@ similar: require('./lib/similar'), |
@@ -13,3 +13,3 @@ 'use strict'; | ||
const idValue = opts.id || opts.appId; | ||
resolve(common.lookup([idValue], idField, opts.country, opts.requestOptions)); | ||
resolve(common.lookup([idValue], idField, opts.country, opts.lang, opts.requestOptions)); | ||
}) | ||
@@ -16,0 +16,0 @@ .then((results) => { |
@@ -66,7 +66,8 @@ 'use strict'; | ||
function lookup (ids, idField, country, requestOptions) { | ||
function lookup (ids, idField, country, lang, requestOptions) { | ||
idField = idField || 'id'; | ||
country = country || 'us'; | ||
const langParam = lang ? `&lang=${lang}` : ''; | ||
const joinedIds = ids.join(','); | ||
const url = `${LOOKUP_URL}?${idField}=${joinedIds}&country=${country}&entity=software`; | ||
const url = `${LOOKUP_URL}?${idField}=${joinedIds}&country=${country}&entity=software${langParam}`; | ||
return doRequest(url, {}, requestOptions) | ||
@@ -73,0 +74,0 @@ .then(JSON.parse) |
@@ -10,3 +10,3 @@ 'use strict'; | ||
} | ||
resolve(common.lookup([opts.devId], 'id', opts.country, opts.requestOptions)); | ||
resolve(common.lookup([opts.devId], 'id', opts.country, opts.lang, opts.requestOptions)); | ||
}) | ||
@@ -13,0 +13,0 @@ .then((results) => { |
@@ -54,3 +54,3 @@ 'use strict'; | ||
const ids = apps.map((app) => app.id.attributes['im:id']); | ||
return common.lookup(ids, 'id', opts.country, opts.requestOptions); | ||
return common.lookup(ids, 'id', opts.country, opts.lang, opts.requestOptions); | ||
} | ||
@@ -57,0 +57,0 @@ |
@@ -19,3 +19,3 @@ 'use strict'; | ||
'X-Apple-Store-Front': `${storeFront},12` | ||
})); | ||
}, opts.requestOptions)); | ||
}) | ||
@@ -22,0 +22,0 @@ .then((html) => { |
@@ -41,3 +41,3 @@ 'use strict'; | ||
if (!opts.idsOnly) { | ||
return common.lookup(ids, 'id', opts.country, opts.requestOptions); | ||
return common.lookup(ids, 'id', opts.country, opts.lang, opts.requestOptions); | ||
} | ||
@@ -44,0 +44,0 @@ return ids; |
@@ -33,3 +33,3 @@ 'use strict'; | ||
return common.lookup(ids, 'id', opts.country, opts.requestOptions); | ||
return common.lookup(ids, 'id', opts.country, opts.lang, opts.requestOptions); | ||
}); | ||
@@ -36,0 +36,0 @@ } |
{ | ||
"name": "app-store-scraper", | ||
"version": "0.16.3", | ||
"version": "0.17.0", | ||
"description": "scrape data from the itunes app store", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -17,2 +17,3 @@ # app-store-scraper [![Build Status](https://secure.travis-ci.org/facundoolano/app-store-scraper.png)](http://travis-ci.org/facundoolano/app-store-scraper) | ||
- [developer](#developer): Retrieves a list of apps by the given developer id. | ||
- [privacy](#privacy): Display the privacy details for the app. | ||
- [suggest](#suggest): Given a string returns up to 50 suggestions to complete a search query term. | ||
@@ -29,2 +30,3 @@ - [similar](#similar): Returns the list of "customers also bought" apps shown in the app's detail page. | ||
* `country`: the two letter country code to get the app details from. Defaults to `us`. Note this also affects the language of the data. | ||
* `lang`: language code for the result text. Defaults to undefined, so country specific language should be used automatically. | ||
+ `ratings`: load additional ratings information like `ratings` number and `histogram` | ||
@@ -119,2 +121,3 @@ | ||
* `country`: the two letter country code to get the list from. Defaults to `us`. | ||
* `lang`: language code for the result text. Defaults to undefined, so country specific language should be used automatically. | ||
* `num`: the amount of elements to retrieve. Defaults to `50`, maximum | ||
@@ -226,2 +229,3 @@ allowed is `200`. | ||
* `country`: the two letter country code to get the app details from. Defaults to `us`. Note this also affects the language of the data. | ||
* `lang`: language code for the result text. Defaults to undefined, so country specific language should be used automatically. | ||
@@ -254,2 +258,48 @@ Example: | ||
### privacy | ||
Retrieves the ratings for the app. Currently only for US App Store. Options: | ||
* `id`: the iTunes "trackId" of the app, for example `553834731` for Candy Crush Saga. | ||
Example: | ||
```js | ||
var store = require('app-store-scraper'); | ||
store.privacy({ | ||
id: 324684580, | ||
}) | ||
.then(console.log) | ||
.catch(console.log); | ||
``` | ||
Returns: | ||
```js | ||
{ | ||
"managePrivacyChoicesUrl": null, | ||
"privacyTypes": [ | ||
{ | ||
"privacyType": "Data Used to Track You", | ||
"identifier": "DATA_USED_TO_TRACK_YOU", | ||
"description": "The following data may be used to track you across apps and websites owned by other companies:", | ||
"dataCategories": [ | ||
{ | ||
"dataCategory": "Contact Info", | ||
"identifier": "CONTACT_INFO", | ||
"dataTypes": [ | ||
"Email Address", | ||
"Phone Number" | ||
] | ||
}, | ||
... | ||
], | ||
"purposes": [] | ||
}, | ||
... | ||
] | ||
} | ||
``` | ||
### suggest | ||
@@ -256,0 +306,0 @@ |
53272
28
1182
462