npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

app-store-client

v1.0.2

Published

A TypeScript client for the Apple App Store API

Downloads

218

Readme

App Store Client

What is this?

This library is a TypeScript library for retrieving public data from the App Store. For example, you can get app details, ratings, reviews, similar apps, and privacy information.

Note that it is different from App Connect API, which focuses on providing API about your app, such as app sales, ratings, reviews, etc.

Motivation

This library is inspired by the app-store-scraper project, which I really appreciate. However, due to recent maintenance issues with the original library, I decided to create this TypeScript version. It includes some breaking changes to enhance TypeScript compatibility and resolve various bugs.

Features

  • 🚀 Full TypeScript support
  • 🔄 Built-in request caching
  • 🛠 Customizable options
  • 📊 Comprehensive API coverage
  • 🧪 Well-tested codebase

Installation

NPM

npm install app-store-client

Yarn

yarn add app-store-client

Usage

First, import and instantiate the AppStoreClient:

import { AppStoreClient, Collection } from "app-store-client";

const client = new AppStoreClient();

Get App Details

You can get app details by ID or bundle ID.

// Use ID
const appData = await client.app({ id: "6446901002" });

// Or use app ID (bundle ID)
const appData = await client.app({ appId: "com.burbn.barcelona" });

console.log(appData);

// {
//   id: '6446901002',
//   appId: 'com.burbn.barcelona',
//   title: 'Threads',
//   url: 'https://apps.apple.com/us/app/threads/id6446901002?uo=4',
//   description: 'Say more with Threads — Instagram’s text-based conversation app.\n' +
//   ...
// }

Get Apps by Developer

You can get apps by developer ID.

// Use developer ID
const apps = await client.appsByDeveloper({ devId: "389801255" });

List Apps

You can list apps by collection name. Please see the Collection enum for available collections.

// Use collection name
const topFreeApps = await client.list({
  collection: Collection.TOP_FREE_IOS,
  num: 5,
});

Get Privacy Details

You can get privacy details by ID. You must provide the ID.

const privacy = await client.privacy({ id: "6446901002" });

Get Ratings

You can get ratings by ID. You must provide the ID.

const ratings = await client.ratings({ id: "6446901002" });

Get Reviews

You can get reviews by ID or app ID (bundle ID). You must provide either ID or app ID.

// Use ID
const reviews = await client.reviews({ id: "6446901002" });

// Or use app ID (bundle ID)
const reviews = await client.reviews({ appId: "com.burbn.barcelona" });

Search Apps

You can search apps by keyword.

const searchResults = await client.search({ term: "chatgpt", num: 5 });

Get Similar Apps

You can get similar apps by ID or app ID (bundle ID). You must provide either ID or app ID.

// Use ID
const similarApps = await client.similarApps({ id: "6446901002" });

// Or use app ID (bundle ID)
const similarApps = await client.similarApps({ appId: "com.burbn.barcelona" });

Get Suggested Search Terms

You can get suggested search terms by keyword.

const suggestions = await client.suggestedTerms({ term: "threads" });

Caching

The client includes built-in request caching. You can customize the cache max age when instantiating the client:

const client = new AppStoreClient({ cacheMaxAge: 1000 * 60 * 5 }); // 5 minutes

This helps reduce unnecessary API calls and improve performance for repeated requests. If the request body or parameters are different, it will be treated as a different request.

The default cache max age is 5 minutes and up to 1000 requests.

Custom Request Options

export interface AppStoreClientOptions {
  country?: Country;
  language?: string;
  requestOptions?: any;
  throttle?: number;
  cacheMaxAge?: number;
  cacheMaxSize?: number;
}
  • country: The country to use. Defaults to US.
  • language: The language to use. Defaults to en-us.
  • requestOptions: The request options to use.
  • throttle: The throttle to use. Defaults to undefined.
  • cacheMaxAge: The cache max age. Defaults to 1000 * 60 * 5 ms (5 minutes).
  • cacheMaxSize: The cache max size. Defaults to 1000.

License

This project is licensed under the MIT License. See the LICENSE file for details.