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 🙏

© 2026 – Pkg Stats / Ryan Hefner

pocketcasts-api

v1.0.0

Published

Unofficial TypeScript client for the Pocket Casts API

Readme

pocketcasts-api

npm version CI License: MIT

Unofficial TypeScript client for the Pocket Casts API.

Note: This is an unofficial client. Not affiliated with Pocket Casts or Automattic.

Requirements

  • Node.js 20 or later

Installation

npm install pocketcasts-api

Quick Start

import { PocketCasts } from 'pocketcasts-api';

const client = new PocketCasts();

// Authenticate
await client.login('[email protected]', 'yourpassword');

// Read your subscriptions
const { podcasts } = await client.getSubscriptions();
console.log(podcasts.map((p) => p.title));

// Star an episode
const { episodes } = await client.getInProgress();
const episode = episodes[0];
await client.starEpisode(episode.podcastUuid, episode.uuid);

API Reference

Authentication

| Method | Description | | ------------------------ | ------------------------------------------------------------------------------------------- | | login(email, password) | Authenticate and store the session token. Must be called before any authenticated endpoint. |

Read Operations (require login)

| Method | Returns | Description | | ----------------------- | ------------------------------ | ------------------------------------------------------------------- | | getSubscriptions() | { podcasts: Podcast[] } | List all subscribed podcasts. | | getNewReleases() | { episodes: Episode[] } | Episodes from subscribed podcasts released recently. | | getInProgress() | { episodes: Episode[] } | Episodes currently in progress (partially played). | | getStarred() | { episodes: Episode[] } | All starred episodes. | | getHistory() | { episodes: Episode[] } | Listening history. | | getStats() | ListeningStats | Aggregate listening statistics (total time, silence removal, etc.). | | getPodcast(uuid) | Podcast | Details for a single podcast by UUID. | | getEpisode(uuid) | Episode | Details for a single episode by UUID. | | getEpisodeNotes(uuid) | string | HTML show notes for an episode. | | search(term) | { podcasts: SearchResult[] } | Search the Pocket Casts directory. |

Write Operations (require login)

| Method | Description | | ---------------------------------------------------------------------- | ------------------------------------------------------------- | | subscribe(podcastUuid) | Subscribe to a podcast. | | unsubscribe(podcastUuid) | Unsubscribe from a podcast. | | starEpisode(podcastUuid, episodeUuid) | Star an episode. | | unstarEpisode(podcastUuid, episodeUuid) | Remove a star from an episode. | | updatePlayingStatus(podcastUuid, episodeUuid, status) | Set playing status: 'unplayed', 'playing', or 'played'. | | updatePlaybackPosition(podcastUuid, episodeUuid, position, duration) | Update the playback position (seconds) for an episode. |

Discovery Operations (no login required)

| Method | Returns | Description | | --------------- | ------------------------------ | ------------------------------ | | getTrending() | { podcasts: SearchResult[] } | Currently trending podcasts. | | getPopular() | { podcasts: SearchResult[] } | Most popular podcasts. | | getFeatured() | { podcasts: SearchResult[] } | Editorially featured podcasts. |

Error Handling

import {
  PocketCasts,
  PocketCastsAuthError,
  PocketCastsAPIError,
} from 'pocketcasts-api';

const client = new PocketCasts();

try {
  await client.login('[email protected]', 'wrongpassword');
} catch (e) {
  if (e instanceof PocketCastsAuthError) {
    console.error('Authentication failed:', e.message);
  }
}

try {
  await client.getPodcast('invalid-uuid');
} catch (e) {
  if (e instanceof PocketCastsAPIError) {
    console.error(`API error ${e.statusCode}:`, e.message);
  }
}

Error Classes

| Class | Extends | Description | | ---------------------- | ------------------ | ------------------------------------------------------------------------------------ | | PocketCastsError | Error | Base class for all errors from this library. | | PocketCastsAuthError | PocketCastsError | Thrown when authentication fails or a request is made before calling login(). | | PocketCastsAPIError | PocketCastsError | Thrown when the API returns a non-2xx response. Has a statusCode: number property. |

Limitations

  • No automatic retries or backoff. Each method makes a single fetch call. If you need resilience against transient failures or rate limiting, supply your own fetch via the constructor option and handle retries there:

    import { PocketCasts } from 'pocketcasts-api';
    
    const retryingFetch: typeof fetch = async (input, init) => {
      // your retry/backoff logic wrapping globalThis.fetch
    };
    
    const client = new PocketCasts({ fetch: retryingFetch });
  • Unofficial and unstable. Endpoints are reverse-engineered from the Pocket Casts web player and may change without notice.

Contributing

Issues and pull requests are welcome. To work on the library:

npm install
npm test          # unit tests (mocked, no network)
npm run lint      # eslint + type check
npm run format    # prettier

Integration tests hit the real API and are skipped unless you opt in with credentials:

[email protected] POCKETCASTS_PASSWORD=secret npm run test:integration

Security

See SECURITY.md for how to report a vulnerability.

License

MIT