Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

searchitunes

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

searchitunes - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

4

package.json

@@ -9,3 +9,3 @@ {

"description": "Light module to search the Apple iTunes Store and App Store",
"version": "2.0.0",
"version": "2.0.1",
"repository": {

@@ -25,3 +25,3 @@ "type": "git",

},
"keywords": ["itunes", "apps", "appstore", "apple", "api"],
"keywords": ["itunes", "apps", "music", "appstore", "apple", "api"],
"license": {

@@ -28,0 +28,0 @@ "type": "Public Domain",

@@ -41,6 +41,6 @@ searchitunes

```js
var searchitunes = require('searchitunes')
var searchitunes = require ('searchitunes');
// Find free Github app for iPhone in Dutch App Store
searchitunes(
searchitunes (
{

@@ -53,7 +53,7 @@ entity: 'software',

},
function( err, data ) {
if( err ) {
function (err, data) {
if (err) {
// Error
console.log( 'Search failed: '+ err.message )
console.log ('Search failed: %s', err.message);

@@ -63,7 +63,7 @@ } else {

// All good
console.log( app )
console.log (data);
}
}
)
);
```

@@ -75,41 +75,84 @@

```js
{ resultCount: 1,
results:
[ { kind: 'software',
features: [],
supportedDevices: [Object],
isGameCenterEnabled: false,
artistViewUrl: 'http://itunes.apple.com/nl/artist/github/id429758986?uo=4',
artworkUrl60: 'http://a4.mzstatic.com/us/r1000/069/Purple/v4/95/79/4c/95794ce7-4fc0-c7c6-ac3c-5d2ede6b59ce/Icon.png',
screenshotUrls: [Object],
ipadScreenshotUrls: [],
artworkUrl512: 'http://a2.mzstatic.com/us/r1000/072/Purple/v4/3e/a9/e7/3ea9e7d5-cea6-be41-d4fc-665f93d6227a/mzl.eefstvnr.png',
artistId: 429758986,
artistName: 'GitHub',
price: 0,
version: '1.0.5',
description: '[..]',
genreIds: [Object],
releaseDate: '2011-08-09T09:49:17Z',
sellerName: 'GitHub',
currency: 'EUR',
genres: [Object],
bundleId: 'com.github.iceberg',
trackId: 453833494,
trackName: 'GitHub Issues',
primaryGenreName: 'Utilities',
primaryGenreId: 6002,
releaseNotes: '- Bug fixes',
wrapperType: 'software',
trackCensoredName: 'GitHub Issues',
trackViewUrl: 'http://itunes.apple.com/nl/app/github-issues/id453833494?mt=8&uo=4',
contentAdvisoryRating: '4+',
artworkUrl100: 'http://a2.mzstatic.com/us/r1000/072/Purple/v4/3e/a9/e7/3ea9e7d5-cea6-be41-d4fc-665f93d6227a/mzl.eefstvnr.png',
languageCodesISO2A: [Object],
fileSizeBytes: '1448076',
sellerUrl: 'http://mobile.github.com',
formattedPrice: 'Gratis',
trackContentRating: '4+',
averageUserRating: 4.5,
userRatingCount: 3 } ] }
{
resultCount: 1,
results: [
{
kind: 'software',
features: [
'iosUniversal'
],
supportedDevices: [
'iPad23G',
'iPhone5',
'iPadMini4G',
'iPhone5s',
'iPad2Wifi',
'iPadFourthGen4G',
'iPadThirdGen4G',
'iPhone4S',
'iPadFourthGen',
'iPodTouchFifthGen',
'iPadThirdGen',
'iPhone4',
'iPhone5c',
'iPadMini'
],
advisories: [],
isGameCenterEnabled: false,
screenshotUrls: [
'http://a5.mzstatic.com/eu/r30/Purple/v4/89/22/af/8922afb3-2977-112d-9a6c-517195e90923/screen1136x1136.jpeg',
'http://a5.mzstatic.com/eu/r30/Purple6/v4/72/e2/ef/72e2efff-81fe-2072-2e79-159ab412f39a/screen1136x1136.jpeg',
'http://a4.mzstatic.com/eu/r30/Purple/v4/e2/9a/69/e29a69d2-7fbe-e4bb-0b96-656789a0fcd8/screen1136x1136.jpeg',
'http://a2.mzstatic.com/eu/r30/Purple6/v4/a2/ec/f2/a2ecf2b9-8880-55ea-e51f-77a14a4b1e38/screen1136x1136.jpeg',
'http://a1.mzstatic.com/eu/r30/Purple/v4/3b/70/e4/3b70e426-3d06-cca4-388c-23ca0754c878/screen1136x1136.jpeg'
],
ipadScreenshotUrls: [
'http://a1.mzstatic.com/eu/r30/Purple4/v4/34/49/b4/3449b49d-9159-aa13-bd7f-650d5d61fae7/screen480x480.jpeg',
'http://a3.mzstatic.com/eu/r30/Purple6/v4/48/9f/76/489f7624-6748-a7f9-33f7-4989b1ea9be8/screen480x480.jpeg',
'http://a3.mzstatic.com/eu/r30/Purple6/v4/b4/6d/50/b46d5066-4bf0-b74a-ee56-23a2901f49e2/screen480x480.jpeg',
'http://a2.mzstatic.com/eu/r30/Purple/v4/4b/76/78/4b7678b7-93bf-dd9e-22bc-7992a7c30ebd/screen480x480.jpeg',
'http://a3.mzstatic.com/eu/r30/Purple4/v4/95/79/61/95796168-cad7-322f-cb42-a189997084cb/screen480x480.jpeg'
],
artworkUrl60: 'http://a1453.phobos.apple.com/us/r30/Purple2/v4/7c/f3/10/7cf31092-9315-6d88-8a8f-f7654fc3c477/Icon.png',
artworkUrl512: 'http://a1363.phobos.apple.com/us/r30/Purple4/v4/47/96/97/479697ad-2032-3cb6-af4c-1ed00afe6848/mzl.sdsxxvxi.png',
artistViewUrl: 'https://itunes.apple.com/nl/artist/dillon-buchanan/id551531425?uo=4',
artistId: 551531425,
artistName: 'Dillon Buchanan',
price: 0,
version: '2.3.3',
description: '...',
currency: 'EUR',
genres: [
'Productiviteit', 'Sociaal netwerken'
],
genreIds: [
'6007', '6005'
],
releaseDate: '2013-10-01T01:00:56Z',
sellerName: 'Dillon Buchanan',
bundleId: 'com.dillonbuchanan.codehub',
trackId: 707173885,
trackName: 'CodeHub - GitHub for iOS',
primaryGenreName: 'Productivity',
primaryGenreId: 6007,
releaseNotes: '...',
minimumOsVersion: '7.0',
wrapperType: 'software',
formattedPrice: 'Gratis',
trackCensoredName: 'CodeHub - GitHub for iOS',
languageCodesISO2A: [
'EN'
],
fileSizeBytes: '20558576',
contentAdvisoryRating: '4+',
averageUserRatingForCurrentVersion: 5,
userRatingCountForCurrentVersion: 3,
artworkUrl100: 'http://a1363.phobos.apple.com/us/r30/Purple4/v4/47/96/97/479697ad-2032-3cb6-af4c-1ed00afe6848/mzl.sdsxxvxi.png',
trackViewUrl: 'https://itunes.apple.com/nl/app/codehub-github-for-ios/id707173885?mt=8&uo=4',
trackContentRating: '4+',
averageUserRating: 4.5,
userRatingCount: 13
}
]
}
```

@@ -116,0 +159,0 @@

@@ -12,12 +12,12 @@ /*

var http = require('http')
var querystring = require('querystring')
var http = require ('http');
var querystring = require ('querystring');
module.exports = function( params, cb ) {
module.exports = function (params, cb) {
// prevent multiple callbacks
var complete = false
function doCallback( err, res ) {
if( !complete ) {
complete = true
cb( err, res || null )
var complete = false;
function doCallback (err, res) {
if (!complete) {
complete = true;
cb (err, res || null);
}

@@ -27,13 +27,13 @@ }

// check input
if( !params || !(params instanceof Object) ) {
doCallback( new Error('invalid params') )
return
if (!params || !(params instanceof Object)) {
doCallback (new Error('invalid params'));
return;
}
// build request
params.version = params.version || 2
params.version = params.version || 2;
var options = {
host: 'itunes.apple.com',
path: '/WebObjects/MZStoreServices.woa/ws/wsSearch?'+ querystring.stringify( params ),
path: '/WebObjects/MZStoreServices.woa/ws/wsSearch?'+ querystring.stringify (params),
method: 'GET',

@@ -44,57 +44,57 @@ headers: {

}
}
};
var request = http.request( options )
var request = http.request (options);
// response
request.on( 'response', function( response ) {
var data = []
var size = 0
request.on ('response', function (response) {
var data = [];
var size = 0;
response.on( 'data', function( ch ) {
data.push( ch )
size += ch.length
})
response.on ('data', function (ch) {
data.push(ch);
size += ch.length;
});
response.on( 'close', function() {
doCallback( new Error('request closed') )
})
response.on ('close', function () {
doCallback (new Error ('request closed'));
});
response.on( 'end', function() {
data = new Buffer.concat( data, size ).toString('utf8').trim()
response.on ('end', function () {
data = new Buffer.concat (data, size).toString ('utf8').trim ();
if( response.statusCode >= 300 ) {
var error = new Error('http error')
error.code = response.statusCode
error.body = data
doCallback( error )
return
var error = new Error ('http error');
error.code = response.statusCode;
error.body = data;
doCallback (error);
return;
}
try {
data = JSON.parse( data )
data = JSON.parse (data);
if( !(data.results instanceof Array) || data.results.length === 0 ) {
doCallback( new Error('no results') )
if (!(data.results instanceof Array) || data.results.length === 0) {
doCallback (new Error('no results'));
} else {
doCallback( null, data )
doCallback (null, data);
}
}
catch(e) {
var error = new Error('invalid response')
error.error = e
doCallback( error )
catch (e) {
var error = new Error ('invalid response');
error.error = e;
doCallback (error);
}
})
})
});
});
// request failed
request.on( 'error', function( err ) {
var error = new Error('request failed')
error.error = err
doCallback( error )
})
request.on ('error', function (err) {
var error = new Error ('request failed');
error.error = err;
doCallback (error);
});
// run it
request.end()
}
request.end ();
};

@@ -9,37 +9,37 @@ /*

var util = require('util')
var util = require ('util');
// Setup
var app = require('./')
var app = require ('./');
// handle exits
var errors = 0
process.on( 'exit', function() {
if( errors == 0 ) {
console.log('\n\033[1mDONE, no errors.\033[0m\n')
process.exit(0)
var errors = 0;
process.on ('exit', function () {
if (errors === 0) {
console.log ('\n\033[1mDONE, no errors.\033[0m\n');
process.exit (0);
} else {
console.log('\n\033[1mFAIL, '+ errors +' error'+ (errors > 1 ? 's' : '') +' occurred!\033[0m\n')
process.exit(1)
console.log ('\n\033[1mFAIL, '+ errors +' error'+ (errors > 1 ? 's' : '') +' occurred!\033[0m\n');
process.exit (1);
}
})
});
// prevent errors from killing the process
process.on( 'uncaughtException', function( err ) {
console.log()
console.error( err.stack )
console.trace()
console.log()
errors++
})
process.on ('uncaughtException', function (err) {
console.log ();
console.error (err.stack);
console.trace ();
console.log ();
errors++;
});
// Queue to prevent flooding
var queue = []
var next = 0
var queue = [];
var next = 0;
function doNext() {
next++
if( queue[next] ) {
queue[next]()
function doNext () {
next++;
if (queue[next]) {
queue[next] ();
}

@@ -51,41 +51,41 @@ }

// ])
function doTest( err, label, tests ) {
if( err instanceof Error ) {
console.error( label +': \033[1m\033[31mERROR\033[0m\n' )
console.error( util.inspect(err, false, 10, true) )
console.log()
console.error( err.stack )
console.log()
errors++
function doTest (err, label, tests) {
if (err instanceof Error) {
console.error (label +': \033[1m\033[31mERROR\033[0m\n');
console.error (util.inspect (err, {depth: 10, colors: true}));
console.log ();
console.error (err.stack);
console.log ();
errors++;
} else {
var testErrors = []
tests.forEach( function( test ) {
if( test[1] !== true ) {
testErrors.push(test[0])
errors++
var testErrors = [];
tests.forEach (function (test) {
if (test[1] !== true) {
testErrors.push (test[0]);
errors++;
}
})
});
if( testErrors.length == 0 ) {
console.log( label +': \033[1m\033[32mok\033[0m' )
if (testErrors.length === 0) {
console.log (label +': \033[1m\033[32mok\033[0m');
} else {
console.error( label +': \033[1m\033[31mfailed\033[0m ('+ testErrors.join(', ') +')' )
console.error (label +': \033[1m\033[31mfailed\033[0m ('+ testErrors.join (', ') +')');
}
}
doNext()
doNext ();
}
queue.push( function() {
app( null, function( err, data ) {
doTest( null, 'Error: invalid params', [
queue.push (function () {
app (null, function (err) {
doTest (null, 'Error: invalid params', [
['error', err && err.message === 'invalid params']
])
})
})
]);
});
});
queue.push( function() {
app(
queue.push (function () {
app (
{

@@ -98,13 +98,13 @@ entity: 'software',

},
function( err, data ) {
doTest( null, 'Error: no results', [
function (err) {
doTest (null, 'Error: no results', [
['error', err && err.message === 'no results']
])
]);
}
)
})
);
});
queue.push( function() {
app(
queue.push (function () {
app (
{

@@ -117,4 +117,4 @@ entity: 'software',

},
function( err, data ) {
doTest( err, 'search', [
function (err, data) {
doTest (err, 'search', [
['data type', data && data instanceof Object],

@@ -126,10 +126,10 @@ ['resultCount', data && data.resultCount && data.resultCount === 1],

['item kind', data && data.results && data.results[0] && data.results[0].kind === 'software']
])
]);
}
)
})
);
});
// Start the tests
console.log('Running tests...\n')
queue[0]()
console.log ('Running tests...\n');
queue[0] ();
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc