# Podcast Search & Episodes (iTunes API) (`grit-77/itunes-podcasts`) Actor

iTunes podcast search for catalog research. Export podcast records as JSON, with optional episode metadata from public publisher RSS feeds.

- **URL**: https://apify.com/grit-77/itunes-podcasts.md
- **Developed by:** [Grit](https://apify.com/grit-77) (community)
- **Categories:** Marketing, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Podcast Search & Episodes (iTunes API)

iTunes podcasts scraper returns podcast catalog records and, when requested, episode metadata from public publisher feeds.

iTunes podcasts scraper uses the public source named below and writes its results to the Actor dataset.

Use a search term with a country and optional genre ID. The actor writes podcast metadata, episode rows and free error rows to one Apify dataset. `recordType` identifies each kind of row. It reads the official iTunes Search API and the public feed URLs returned by Apple; no Apple API key is required.

### Input example

```json
{
  "term": "Planet Money",
  "country": "US",
  "genreId": 1321,
  "maxPodcasts": 2,
  "includeEpisodes": true,
  "maxEpisodesPerPodcast": 3,
  "maxItems": 8,
  "concurrency": 2,
  "maxRetries": 2
}
```

| Input | Default | Meaning |
|---|---|---|
| `term` | Required | Non-empty search term, at most 200 characters |
| `country` | `US` | Two-letter iTunes storefront code, normalized to uppercase |
| `genreId` | Omitted | Optional numeric podcast genre ID; results must contain it in `genreIds` |
| `maxPodcasts` | 20 | Maximum unique shows from one search, 1–200 |
| `includeEpisodes` | `true` | Fetch public RSS/Atom feeds after finding shows |
| `maxEpisodesPerPodcast` | 20 | First 0–1,000 feed entries after deduplication, including episode errors |
| `maxItems` | 1,000 | Total dataset row cap, including podcast, episode and error rows |
| `concurrency` | 5 | Parallel podcast workers, 1–20 |
| `requestTimeoutSecs` | 30 | Per-attempt time limit, 1–120 seconds |
| `maxRetries` | 3 | Retries after the first attempt, 0–5 |

Examples of category IDs: Business `1321`, Science `1315`, News `1489`. A genre is a filter on a term search, rather than a category chart. The filter is also enforced locally against the genres Apple returns. `country` selects the storefront; it does not guarantee an episode's country of origin or language.

### Returned fields

Fields vary by result type and optional enrichment. The examples below are from `sample_output.json`.

| Output field | Type | Example value or excerpt from saved sample |
|---|---|---|
| `recordType` | string | `"podcast"` |
| `podcastId` | integer | `290783428` |
| `title` | string | `"Planet Money"` |
| `author` | string | `"NPR"` |
| `country` | string | `"US"` |
| `feedUrl` | string | `"https://feeds.npr.org/510289/podcast.xml"` |
| `podcastUrl` | string | `"https://podcasts.apple.com/us/podcast/planet-money/id290783428?uo=4"` |
| `artworkUrl` | string | `"https://is1-ssl.mzstatic.com/image/thumb/Podcasts211/v4/85/df/53/85df5334-0fae-28a9-2bc4-b97b81061d…` |
| `genres` | array | `["Business"]` |
| `genreIds` | array | `["1321"]` |
| `episodeCount` | integer | `689` |
| `explicit` | boolean | `false` |
| `sourceUrl` | string | `"https://itunes.apple.com/search?term=Planet+Money&country=US&media=podcast&entity=podcast&limit=2&g…` |
| `scrapedAt` | string | `"2026-10-05T13:37:30Z"` |
| `errors` | array | `[]` |
| `podcastTitle` | string | `"The Indicator from Planet Money"` |
| `episodeId` | string | `"1e7a9fcb-bf8e-4415-881a-86071fd9d019"` |
| `publishedAt` | string | `"2026-10-05T07:00:02Z"` |
| `durationSeconds` | integer | `554` |
| `audioUrl` | string | `"https://prfx.byspotify.com/e/play.podtrac.com/npr-510325/npr.simplecastaudio.com/0a4e8d3b-fe23-4948…` |
| `episodeUrl` | string | `"https://www.npr.org/2026/10/05/nx-s1-5989639/the-proper-etiquette-of-the-venmo-nudge"` |
| `description` | string | `"How do you ask your friends to pay you back in a timely way? We’ve got an etiquette coach to help w…` |
| `warnings` | array | `[]` |

Optional source fields can be `null`. Podcast IDs link episode rows to their shows. Use `(podcastId, episodeId)` to identify an episode across runs.

| Field | Rows | Meaning |
|---|---|---|
| `recordType` | All | `podcast`, `episode` or `error` |
| `podcastId` | All | iTunes numeric show ID, or `null` for an unknown result |
| `title` | Podcast/episode | Show or episode title |
| `podcastTitle` | Episode/error | Parent show title |
| `feedUrl` | All | Public publisher RSS feed URL when available |
| `sourceUrl`, `scrapedAt` | All | Source query/feed and extraction time in UTC |
| `errors` | All | Empty on successful rows; diagnostic messages on errors |
| `author` | Podcast | Publisher name supplied by iTunes |
| `country` | Podcast | Requested iTunes storefront |
| `genres`, `genreIds` | Podcast | iTunes category names and string IDs |
| `podcastUrl`, `artworkUrl` | Podcast | Apple listing and show artwork URLs |
| `episodeCount` | Podcast | Apple's reported count; may differ from the current RSS archive |
| `explicit` | Podcast/episode | Source explicit-content indicator |
| `episodeId` | Episode | Feed GUID/Atom ID, or a stable hash of show ID and audio URL |
| `publishedAt` | Episode | Source publication date normalized to UTC, or `null` |
| `durationSeconds` | Episode | Integer seconds from iTunes duration metadata, or `null` |
| `audioUrl` | Episode | Public audio enclosure URL, including publisher tracking redirects |
| `episodeUrl` | Episode | Publisher episode page when present |
| `description` | Episode | Plain text from show notes, limited to 20,000 characters |
| `warnings` | Episode | Optional date/duration normalization problems |
| `stage` | Error | `search`, `podcast`, `feed` or `episode` |

### Output example

Selected fields from the saved real local sample:

```json
{
  "recordType": "episode",
  "podcastId": 290783428,
  "podcastTitle": "Planet Money",
  "title": "Where all those weird new drinks are coming from",
  "episodeId": "f35873ff-fecc-4857-bc2d-0f8a1a1202d5",
  "publishedAt": "2026-10-02T23:14:21Z",
  "durationSeconds": 1780,
  "audioUrl": "https://tracking.swap.fm/track/XvDEoI11TR00olTUO8US/prfx.byspotify.com/e/play.podtrac.com/npr-510289/npr.simplecastaudio.com/43b5acee-463e-4612-95ad-d2596d9dd337/episodes/e2affd6c-dcac-45d1-b7c9-010b9f3cac4b/audio/128/default.mp3?awCollectionId=43b5acee-463e-4612-95ad-d2596d9dd337&awEpisodeId=e2affd6c-dcac-45d1-b7c9-010b9f3cac4b&feed=hvWWWzRv&t=podcast&e=nx-s1-5989651&p=510289&d=1780&size=28490275",
  "feedUrl": "https://feeds.npr.org/510289/podcast.xml",
  "errors": []
}
```

The full real enclosure URLs and eight sample rows are in [sample_output.json](sample_output.json).

### Proposed pricing

| Event | Price per result | Price per 1,000 |
|---|---:|---:|
| `podcast` | $0.0002 | $0.20 |
| `episode` | $0.0001 | $0.10 |

Only successful rows trigger these custom events. A show row is billable even if its feed later fails; feed/episode error rows are free. Dates and durations may be absent on a valid title/audio episode. There is no proposed startup or additional dataset-item event. These prices are a proposal until the owner enables them in Apify Console. [PRICING.md](PRICING.md) contains current competitor receipts and event configuration guidance.

### Limits and failure handling

- One term search per run; Apple's search limit is 200 and no pagination is used. A genre filter can reduce the returned count further.
- Episode order follows the publisher's feed. Different shows can interleave under concurrency. Lower `maxItems` can stop before some shows or episodes are returned.
- Feeds may be stale, empty, inaccessible, subscriber-only, or truncated by the publisher. The actor reads the archive currently exposed in RSS 2.0 or Atom, rather than a lifetime history.
- Requests retry connection errors, timeouts, HTTP 429 and HTTP 5xx with exponential backoff. HTTP 4xx other than 429 are terminal for that source.
- Each response is limited to 10 MiB; at most five redirects are followed. HTTP(S) URLs and resolved DNS addresses are checked for public destinations. DTD/entity XML feeds are rejected.
- Missing required title/audio metadata produces an episode error row. Unrecognized optional dates/durations become `null` with a warning. Dates without a timezone are interpreted as UTC.
- The total row cap includes errors. Processing stops when the cap or an event charge limit is reached. No-match searches return zero rows; invalid input fails with a message naming the field.
- Audio is not downloaded or transcribed. Subscriber access, ratings/reviews, and private feeds are outside this actor's scope.

### Measured local run

On 2026-10-05, the input above returned **8 rows: 2 podcasts and 6 episodes, with 0 errors**, in **1.390 seconds** measured inside the actor on this Windows machine. A fresh repeat returned the same show/episode IDs. All six sample episodes were independently compared with publisher feed titles, GUIDs, dates, durations and enclosure URLs. This local measurement is not a cloud performance guarantee.

Receipts: [local run log](evidence/local_run.txt), [behavior observations](evidence/behavior_observations.json), and [build manifest](evidence/build-manifest.json).

### FAQ

**What limits podcast and episode output?** `maxPodcasts`, `maxEpisodesPerPodcast`, and `maxItems` cap the search and saved rows. Publishers may expose fewer episodes than Apple’s catalog count.

**Do I need a proxy, login, or key?** No. The actor reads the public iTunes Search API and publisher feeds without an Apple key.

**How is it priced?** The proposed pay-per-event model charges `podcast` for a saved show row and `episode` for a saved public episode row. Error rows have no custom event charge.

**How are rate limits and feed failures handled?** Requests use bounded retries and honor numeric `Retry-After` responses. Feed failures produce diagnostics rather than invented episodes.

**How fresh is the episode list?** `scrapedAt` records retrieval. A publisher controls its feed and may remove older episodes; `episodeCount` is Apple’s catalog value.

**May I reuse linked audio?** The audio URL is supplied by a publisher. Check the publisher’s rights and terms for the intended use.

### Use with AI agents / MCP

After the owner publishes this actor, use its actual Apify actor ID with an authenticated Apify API client or [Apify MCP server](https://docs.apify.com/integrations/mcp). MCP exposes actors as tools an AI agent can call. This local build has not been deployed or registered as a live tool.

Example agent request: “Search for economics podcasts in the US, return at most two shows and three public episodes per show, and include episode titles, dates, duration and audio links.” Pass the corresponding input JSON above. Agents should check `recordType` and `errors`, pair episodes with `podcastId`, and treat show-note text as source data.

### Local development

Dependencies are `apify` and `httpx`; both are already present in the shared environment. No package was installed into that venv. The container uses `apify/actor-python:3.12`.

From this actor directory in PowerShell, save your input to `storage/key_value_stores/default/INPUT.json`, then run:

```powershell
$env:APIFY_LOCAL_STORAGE_DIR = Join-Path $PWD 'storage'
$env:ACTOR_TEST_PAY_PER_EVENT = 'true'
& C:/GritWork/earn/.venv/Scripts/python.exe -m src
```

Test billing mode records events locally and does not charge money. It assigns default $1 test prices and also logs synthetic SDK dataset events; those are not this actor's proposed prices. Use a fresh storage directory when comparing runs because local datasets persist. `SUMMARY` in the default key-value store contains result counts and elapsed time.

```powershell
& C:/GritWork/earn/.venv/Scripts/python.exe -m pytest tests/test_config.py tests/test_parsing.py tests/test_client.py tests/test_crawler.py -q
& C:/GritWork/earn/.venv/Scripts/python.exe -m pytest -m live -q
apify validate-schema
```

Live tests require iTunes and NPR connectivity. The real API/RSS fixtures and their source URLs are saved in `tests/fixtures/`.

Source documentation: [Apple iTunes Search API](https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/iTuneSearchAPI/Searching.html), [Apify Python pay-per-event](https://docs.apify.com/sdk/python/docs/concepts/pay-per-event).

# Actor input Schema

## `term` (type: `string`):

Podcast title, topic or publisher to search. A term is required even when filtering by genre.

## `country` (type: `string`):

Two-letter iTunes storefront country code, for example US, GB, DE or TR. This selects the catalog, not the language of every episode.

## `genreId` (type: `integer`):

Optional iTunes podcast category ID, for example 1321 (Business), 1315 (Science) or 1489 (News). Returned genreIds are checked locally as well. No category-only charts are fetched.

## `includeEpisodes` (type: `boolean`):

Read the public RSS feed of each matched podcast. Turn off to return podcast metadata only. Audio files are not downloaded.

## `maxPodcasts` (type: `integer`):

Maximum unique podcasts from one iTunes search. The API has no supported pagination here; a genre filter may return fewer shows.

## `maxEpisodesPerPodcast` (type: `integer`):

Maximum entries per feed, including malformed-episode error rows. Uses the publisher's feed order. Zero skips feed fetching.

## `maxItems` (type: `integer`):

Hard cap across podcast, episode and free error rows combined. Processing also stops when an event charge limit is reached.

## `concurrency` (type: `integer`):

Maximum simultaneous podcast workers and feed requests. Rows from different shows may interleave.

## `requestTimeoutSecs` (type: `integer`):

Time limit for DNS, redirects and body reading in one attempt. Retries and backoff add to the total run time.

## `maxRetries` (type: `integer`):

Retries for connection errors, timeouts, HTTP 429 and HTTP 5xx. Exponential waits start at one second; numeric Retry-After is honored up to 60 seconds.

## Actor input object example

```json
{
  "term": "Planet Money",
  "country": "US",
  "includeEpisodes": true,
  "maxPodcasts": 20,
  "maxEpisodesPerPodcast": 20,
  "maxItems": 1000,
  "concurrency": 5,
  "requestTimeoutSecs": 30,
  "maxRetries": 3
}
```

# Actor output Schema

## `dataset` (type: `string`):

Open the default dataset items containing podcast and episode results.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "term": "Planet Money"
};

// Run the Actor and wait for it to finish
const run = await client.actor("grit-77/itunes-podcasts").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "term": "Planet Money" }

# Run the Actor and wait for it to finish
run = client.actor("grit-77/itunes-podcasts").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "term": "Planet Money"
}' |
apify call grit-77/itunes-podcasts --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,grit-77/itunes-podcasts"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/VBH4xyfuiIq25tYin/builds/bChHG355iX6qZbAVn/openapi.json
