Skip to content

TeamPodlink/episode-link-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Episode Link Generator

A serverless TypeScript function that generates Podlink URLs from podcast show names and episode titles.

How It Works

  1. Accepts a POST request with showName and episodeTitle
  2. Searches the Apple Podcasts Search API for the show
  3. Fetches the podcast's RSS feed
  4. Finds the matching episode by title
  5. Generates a URL-safe base64 hash of the episode GUID
  6. Returns a Podlink URL in the format: https://pod.link/<appleID>/episode/<base64-guid>

API Endpoint

POST /api/episode-link

Request Body:

{
  "showName": "The Daily",
  "episodeTitle": "Your Episode Title Here"
}

Success Response (200):

{
  "podlinkUrl": "https://pod.link/1200361736/episode/Z3VpZC12YWx1ZS1oZXJl",
  "podcast": {
    "name": "The Daily",
    "appleId": 1200361736
  },
  "episode": {
    "title": "Your Episode Title Here",
    "guid": "guid-value-here"
  }
}

Error Responses:

  • 400 - Missing or invalid request fields
  • 404 - Podcast or episode not found
  • 405 - Method not allowed (only POST is accepted)
  • 500 - Internal server error

Development

Prerequisites

  • Node.js 20+
  • npm or pnpm

Setup

npm install

Run locally

npm run dev

The function will be available at http://localhost:3000/api/episode-link

Test with cURL

curl -X POST http://localhost:3000/api/episode-link \
  -H "Content-Type: application/json" \
  -d '{"showName": "The Daily", "episodeTitle": "Some Episode Title"}'

Deployment

Deploy to Vercel:

npm run deploy

Or connect your repository to Vercel for automatic deployments.

Tech Stack

  • Runtime: Vercel Serverless Functions
  • Language: TypeScript
  • XML Parsing: fast-xml-parser
  • APIs: Apple Podcasts Search API

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Contributors