💿 Query Apple store catalogs using the iTunes Search API.
- 🗜️ Small: Tree-shakeable and around 1.4 kB on modern platforms
- 🔎 URLs: Supports looking items up from their store URLs
- 🧪 Reliable: Fully tested with 100% code coverage
- 📦 Typed: Written in TypeScript and includes definitions out-of-the-box
- 💨 Zero dependencies
itunes-store-api
is a typed iTunes Search API client which adds support for looking items up from their store URLs.
import { search, lookup } from "https://cdn.skypack.dev/itunes-store-api"
yarn add itunes-store-api
npm install itunes-store-api
Import search
.
import { search } from "itunes-store-api"
Invoke it asynchronously and access results in return.
const { results } = await search("M83")
// results: [Result, Result, Result...]
Import lookup
.
import { lookup } from "itunes-store-api"
Invoke it asynchronously using a lookup type ("id"
, "isbn"
, "upc"
, "url"
, "amgAlbumId"
, "amgArtistId"
or "amgVideoId"
) and access a result in return.
const { results } = await lookup("id", 1007596731)
// results: [Result]
A variety of store catalog URLs are supported when using the "url"
lookup type.
Both search
and lookup
support a trailing options
argument.
A two-letter country code where the queried store catalog will be from. Defaults to "us"
.
await search("Le Fabuleux Destin d'Amélie Poulain", { country: "fr" })
Only available for
search
.
Limit the number of results. Defaults to 50
.
await search("C418", { limit: 10 })
Only available for
search
.
Whether to sort results by popularity ("popular"
) or recentness ("recent"
). Defaults to "popular"
.
await search("Twitter", { sort: "popular" })
Only available for
search
.
The media type to search for—see Table 2-1. Defaults to "all"
.
await search("Lost in Translation", { media: "movie" })
Only available for
search
.
The type of results returned, relative to the specified media type—see Table 2-1.
await search("Things", { media: "software", entity: "macSoftware" })
Only available for
search
.
Which attribute to search for, relative to the specified media type—see Table 2-2.
await search("Greta Gerwig", { entity: "movieArtist", attribute: "actorTerm" })
Only available for
search
.
Whether to include explicit content. Defaults to true
.
await search("My Beautiful Dark Twisted Fantasy", { explicit: true })