Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

searchitunes

fvdm9.1kUnlicense2.6.0

Search the Apple iTunes Store and App Store with this lightweight module

api, apple, apps, appstore, itunes, lookup, music, search

readme

searchitunes

Lightweight Node.js package to quickly search the Apple iTunes Store and App Store for music, movies, apps, etc.

npm Build Status Coverage Status

Example

const searchitunes = require( 'searchitunes' );

// Find free Github app for iPhone in Dutch App Store
searchitunes( {
  entity:  'software',
  country: 'NL',
  term:    'github',
  limit:   1,
  price:   0,
} )
  .then( console.log )
  .catch( console.error )
;

// Get one specific item by ID
searchitunes( { id: 512939461 } )
  .then( console.log )
  .catch( console.error )
;

Installation

npm i searchitunes

Interface

The module exports only one function. Arguments must be wrapped in an object. It returns a Promise.

Configuration

The parameters below can be included along with the normal API params.

param type default description
[timeout] number 5000 Wait time out in ms
[userAgent] string searchitunes.js User-Agent header
[throwEmpty] bool true Throw no results instead of returning []
... mixed | API parameters
itunes( {
  timeout: 8000,
  entity:  'software',
  term:    'github',
} )

Search API

For searching in the iTunes databases you simply include the search params in your request. The function will resolve with an object.

Lookup by ID

When you wish to retrieve one specific item by its ID, include one of the ID params to use the Lookup API. The result data will be only the object with the item's details.

ID params

  • amgAlbumId
  • amgArtistId
  • amgVideoId
  • id
  • isbn
  • upc
  • trackId

When you lookup a trackId from a search response it will be automatically converted to the id parameter instead. Otherwise the API won't understand it.

searchitunes( { id: 123456 } )
  .then( console.log )
  .catch( console.error )
;

Bulk lookup

To request multiple objects at once you set one of the ID params above to an array with the item ID's. This will always return an array.

searchitunes( { id: [ 123, 789 ] } )
  .then( arr => arr.forEach( processItems )
  .catch( console.error )
;

Errors

API errors are handled and thrown, prefixed with API:

When nothing is found it will throw with no results message. You can prevent this behavior by setting throwEmpty to false to return an empty array.

searchitunes( {
  throwEmpty: false,
  entity: 'software',
  term: 'github',
} )
  .then( console.log )
  .catch( console.error )
;

Unlicense

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to https://unlicense.org/

Author

Franklin | buy me a coffee

changelog

2.6.0 (2023-12-16)

Chores
  • github:
Documentation Changes
Other Changes

2.5.6 (2023-04-27)

Chores
  • package: Simpler dev deps syntax (2d3343b6)
  • github: Fixed syntax typo (b59e67ef)
Bug Fixes
Refactors
  • Rewrite to remove dependency (32d50145)
Tests

2.5.5 (2023-03-29)

Chores
  • github:
    • Update workflow set-output syntax (eec957f7)
    • Removed audit command from CI test (1e2a471c)
    • Bump github/codeql-action from 1 to 2 (#34) (e2f86cfa)
    • Bump actions/checkout from 2 to 3 (#33) (8939e667)
    • Bump actions/setup-node from 2 to 3 (#32) (64226db1)
  • package: Update dependencies (9121a614)
Documentation Changes
  • security: Added security policy (2eafd216)
  • readme: Fixed links to API docs (fc80abe5)
Refactors
Code Style Changes
Tests
  • ci: Include testTimeout env var in action (e93ceebc)

2.5.4 (2021-12-29)

Tests

2.5.3 (2021-10-06)

Tests

2.5.2 (2021-10-06)

Chores
  • package: Update RunKit example key (3d7974fc)
  • Removed contributing doc (c109aec0)
Documentation Changes
Refactors
  • httpreq supports promises (4f2c1ff3)
  • Moved first default to httpResponse (b96af967)
Code Style Changes
Tests
  • ci:
  • config:
    • Schedule and clean up Github action (f1ea7216)
    • Fix ESLint hierarchy issue (3a42e9c9)
    • Limit Dependabot to production deps (2d7f7b9f)

2.5.1 (2021-07-16)

Chores
  • example: Fixed parameters argument (81346e49)
Documentation Changes

2.5.0 (2021-07-16)

Chores
Documentation Changes
  • Modified markdown, texts and example (7e9dacdd)
  • Fix arguments table (51465b33)
  • badges:
  • readme: Added note about lookup id (29a927cf)
New Features
  • Auto convert trackId param to id (fba14822)
Bug Fixes
Refactors
  • errors: Removed invalid params error (6eddd2f2)
  • Replaced arguments w/ object (4a624d5c)
Code Style Changes
  • Removed trailing whitespace (1c256c31)
  • Comma dangle on last lines (b930a247)
  • Readability and consistent return (5d1eabb9)
  • test: Minor readability edits (62e62ddc)
  • example: Minor style change (917e7312)
Tests

2.4.0 (2018-03-16)

Chores
Documentation Changes
New Features
Bug Fixes
  • request: Parse timeout to int (17ceab20)
Refactors
  • package: Add es6-promisify to deps (b711a72d)
Code Style Changes
  • test: Convert to const, let, arrows (d6cd8eec)
  • syntax: Convert to const, let & arrows (ad847cf3)
  • main: Cleaner comments (db75a86e)
  • comments: Clean up JSDoc comments (e02e72f0)
Tests
  • main:
    • Fix broken script after failed promise (859eae62)
    • Just pass the timeout (add96439)
    • Added tests for promises (27bc99fb)
  • package: Change dev deps to dotest (359a8ff4)
  • config:
    • Update Travis CI node versions (543d70c5)
    • Travis CI update node versions (18b433f7)

2.3.2 (2016-10-26)

Chores
  • package:
    • Updated dev dependencies (fbe13d78)
    • Replaced test runner and dev deps by dotest (b10a9fbf)
    • update eslint to version 3.0.0 (435c7afb)
  • develop: Added bitHound config (d0551f3e)
Documentation Changes
  • readme:
  • develop: Added CONTRIBUTING.md doc (65c345e2)
  • badges:
    • Added code quality status from bitHound (db6dd064)
    • Replaced Gemnasium with bitHound deps (435a54e0)
Refactors
  • package:
    • Renamed UNLICENSE file to LICENSE (4988e80a)
    • Minimum supported node v4.0 (9ccb3591)
  • errors: Error handling without returns (ac9126eb)
Tests
  • config:
    • Set bitHound max lines to 400 (89e979b7)
    • Use dynamic node versions on Travis CI (9f60008c)
  • lint: Update eslint to ES6 (b24c9651)

2.3.1 (2016-6-6)

Refactors
  • errors: Moved HTTP error handling to function (5d721802)
Tests
  • setup: Config defaults are set by the module (2842341f)

2.3.0 (2016-6-6)

Chores
  • readme: Update example output, author footnote (fda3d70c)
  • package: Update dependencies version (9658ac39)
Documentation Changes
  • readme:
  • badges:
New Features
  • main: Add lookup support for IDs (a000456d)
Bug Fixes
  • httpResponse: Check res before res.statusCode (251e790a)
  • main: Fixed idKeys typo isbn (f8ac730d)
Other Changes
  • docs: Add Lookup by ID method (5dddd322)
  • undefined: add node v6 to Travis config (e2555c38)
Refactors
  • package:
    • Add test coverage and devDependencies (737cd1a8)
    • Add .gitignore config (61617703)
    • A few more keywords for npm (4a1a67fd)
  • main: Rewrite module to clean structure (39324154)
Tests
  • main:
  • config: eslint operator-linebreak before (b079b5d3)