API recipe

Get podcast listing links from a feed URL

For developers building podcast imports: get Apple Podcasts, Spotify and YouTube links from an RSS feed URL.

beginner 5 minutes Pod Engine Team
PodcastsRSSIntegration

Before you start

  • API token with access to podcast details
  • An RSS feed URL

Choose your example

Your selection applies to every step. HTTP uses built-in clients without the Pod Engine libraries.

Use Node.js 22 or newer. Save the complete script as recipe.mjs.

npm install @podengine/sdk
# macOS / Linux shell; set the same variable in your shell on Windows
export PODENGINE_API_KEY="YOUR_API_KEY"
node recipe.mjs

Set up the client

Start your file with this setup, then append each step in order. The complete script below includes everything.

import { PodEngine, PodEngineApiError } from '@podengine/sdk';

const apiKey = process.env.PODENGINE_API_KEY;
if (!apiKey) throw new Error('Set PODENGINE_API_KEY before running this recipe');
const pe = new PodEngine({
  apiKey,
  baseUrl: process.env.PODENGINE_API_URL || 'https://api.podengine.ai',
});
const rssFeedUrl = process.env.PODENGINE_RSS_FEED_URL || 'https://anchor.fm/s/7c624c84/podcast/rss';
Complete runnable script
Download script
import { PodEngine, PodEngineApiError } from '@podengine/sdk';

const apiKey = process.env.PODENGINE_API_KEY;
if (!apiKey) throw new Error('Set PODENGINE_API_KEY before running this recipe');
const pe = new PodEngine({
  apiKey,
  baseUrl: process.env.PODENGINE_API_URL || 'https://api.podengine.ai',
});
const rssFeedUrl = process.env.PODENGINE_RSS_FEED_URL || 'https://anchor.fm/s/7c624c84/podcast/rss';

// Optional: remove this block to go straight to the details call.
const { podcast } = await pe.podcasts.getPodcastIdLookup({ rssFeedUrl });
if (!podcast) {
  console.log('Pod Engine does not track this feed');
  process.exit(0);
}

let platforms;
try {
  // The SDK URL-encodes rssFeedUrl and unwraps the API's data envelope.
  ({ platforms } = await pe.podcasts.getPodcastByFeedUrl({ rssFeedUrl }));
} catch (error) {
  if (!(error instanceof PodEngineApiError) || error.status !== 404) throw error;
  console.log('Pod Engine does not track this feed');
  process.exit(0);
}

if (!platforms) throw new Error('No platform data returned; check the API version');
console.log('Apple Podcasts (certain):', platforms.apple.url);
if (platforms.spotify) {
  // verifiedAt is set only when the link passed our identity check.
  const label = platforms.spotify.verifiedAt ? 'verified' : 'inferred; confirm with the publisher';
  console.log(`Spotify (${label}):`, platforms.spotify.url);
} else {
  console.log('Spotify: no match yet; the show may still be on Spotify');
}
if (platforms.youtube) {
  const { tier, role, url } = platforms.youtube;
  // Only an associated channel has a role. A candidate has not passed our checks yet.
  let confidence = 'confirm with the publisher';
  if (tier === 'associated') {
    confidence =
      role === 'primary' ? "passed checks, the show's own channel" : 'passed checks, a channel that carries the show';
  }
  console.log(`YouTube (${tier}; ${confidence}):`, url);
} else {
  console.log('YouTube: no channel match yet');
}
1

Check whether we track the feed (optional)

Start with the feed URL you already have. These examples use This Week in Startups: https://anchor.fm/s/7c624c84/podcast/rss. Set PODENGINE_RSS_FEED_URL to try another feed. Call GET /api/v1/podcasts/id/lookup with rssFeedUrl to check whether Pod Engine tracks it. This call is free: it does not use podcastLookups. A successful response can contain data.podcast: null; stop if it does.

// Optional: remove this block to go straight to the details call.
const { podcast } = await pe.podcasts.getPodcastIdLookup({ rssFeedUrl });
if (!podcast) {
  console.log('Pod Engine does not track this feed');
  process.exit(0);
}
5

Handle a feed we do not track

A 404 from by-feed-url means we do not track that feed. It does not mean the show is missing from Apple Podcasts, Spotify or YouTube. The response has status: "Not Found" and a message that names the feed URL you sent.

To ask us to add a show, email support@podengine.ai with its feed URL.

6

Account for monthly usage

The details call uses one podcastLookups unit per podcast per month. Fetching the same podcast again that month does not use another unit. The optional ID lookup does not use a unit.