{"library":"podcast-api","title":"Listen Notes Podcast API JavaScript Library","description":"The `podcast-api` library provides convenient JavaScript bindings for the Listen Notes Podcast API, enabling developers to search, retrieve, and manage podcast and episode metadata programmatically. It supports a wide range of environments, including server-side Node.js applications, serverless Cloudflare Workers/Pages, and client-side browser JavaScript, although browser usage is discouraged without proper API key handling to prevent exposure. The current stable version is 2.0.4, with active development indicated by frequent releases introducing new endpoints like `searchEpisodeTitles` and `fetchPodcastsByDomain`. A key differentiator is its dual client architecture, offering `Client` for Node.js/browser environments and `ClientForWorkers` specifically optimized for Cloudflare Workers, providing streamlined access to the same API that powers the Listen Notes search engine.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install podcast-api"],"cli":null},"imports":["import { Client } from 'podcast-api';\nconst client = Client({ apiKey: process.env.LISTEN_API_KEY ?? '' });","import { ClientForWorkers } from 'podcast-api';\nconst client = ClientForWorkers({ apiKey: LISTEN_API_KEY });","const { Client } = require('podcast-api');\nconst client = Client({ apiKey: process.env.LISTEN_API_KEY ?? '' });"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { Client } from 'podcast-api';\n\n// Initialize the client with your API key.\n// For Node.js, use process.env.LISTEN_API_KEY.\n// For Cloudflare Workers, use LISTEN_API_KEY from secrets.\n// For browser-side, handle key securely (e.g., via a proxy).\nconst apiKey = process.env.LISTEN_API_KEY ?? 'YOUR_LISTEN_NOTES_API_KEY'; // Replace or ensure env var is set\n\nif (!apiKey || apiKey === 'YOUR_LISTEN_NOTES_API_KEY') {\n  console.error('API Key is missing. Please set LISTEN_API_KEY environment variable or replace the placeholder.');\n  process.exit(1);\n}\n\nconst client = Client({ apiKey });\n\nasync function searchPodcasts(query) {\n  try {\n    const response = await client.search({\n      q: query,\n      sort_by: 'relevance',\n      type: 'podcast',\n      offset: 0,\n      len_min: 10,\n      len_max: 30,\n      genre_ids: '68,82',\n      published_before: 1580172454000,\n      published_after: 0,\n      only_in: 'title,description',\n      language: 'English',\n      safe_mode: 0\n    });\n    console.log(`Found ${response.data.total} podcasts for \"${query}\":`);\n    response.data.results.slice(0, 3).forEach(podcast => {\n      console.log(`- ${podcast.title_original} (ID: ${podcast.id})`);\n    });\n  } catch (error) {\n    console.error('Error searching podcasts:', error.message);\n  }\n}\n\n// Example usage\nsearchPodcasts('web development');","lang":"typescript","description":"This quickstart initializes the `podcast-api` client and demonstrates a basic full-text search for podcasts, logging the results. It highlights API key configuration and error handling.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}