• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
figleaf

figleaf

gator

Public
Like
gator
Home
Code
7
.claude
1
backend
4
shared
1
.vtignore
AGENTS.md
README.md
deno.json
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
feed-generator.ts
https://figleaf--4d7ba546bbb111f093d242dde27851f2.web.val.run
README.md

Podcast Feed Aggregator

A Val Town-based podcast feed aggregator that combines audio content from multiple sources into a single RSS feed.

Features

  • Email Integration: Send emails with audio attachments to add episodes
  • RSS Polling: Automatically polls an RSS feed daily for "3-track" posts
  • Podcast Feed: Generates a standard podcast RSS feed for all aggregated content

Architecture

The system consists of 3 Val Town vals:

  1. Email Handler (backend/email-handler.ts) - Email trigger
  2. RSS Poller (backend/rss-poller.ts) - Cron trigger (daily)
  3. Feed Generator (backend/feed-generator.ts) - HTTP trigger

Setup Instructions

1. Deploy the Vals

Deploy each of these files as separate vals on Val Town:

Feed Generator (HTTP Val)

  • Deploy backend/feed-generator.ts as an HTTP val
  • This will be your main podcast feed URL
  • Save the URL - you'll use this in your podcast app

RSS Poller (Cron Val)

  • Deploy backend/rss-poller.ts as a Cron val
  • Set schedule to run daily: 0 0 * * * (runs at midnight UTC)
  • Or use Val Town's UI to set "Once a day"

Email Handler (Email Val)

  • Deploy backend/email-handler.ts as an Email val
  • Val Town will provide you with a unique email address
  • Forward or send emails with audio attachments to this address

2. Configure RSS Feed URL

Edit backend/rss-poller.ts and update the RSS feed URL if needed:

const RSS_FEED_URL = "https://nnnnnnnn.co/rss.xml";

3. Test the Setup

Test Email Handler

  1. Send an email with an audio file (.mp3, .m4a, etc.) to your Val's email address
  2. Or send an email containing a direct link to an audio file (e.g., https://example.com/audio.mp3)
  3. Check the Val's logs to confirm it processed successfully

Test RSS Poller

  1. Run the RSS Poller val manually first to populate initial episodes
  2. Check the logs to see how many "3-track" posts were found

Test Feed Generator

  1. Visit your HTTP val URL in a browser
  2. You should see an XML RSS feed
  3. Add this URL to your podcast app

4. Subscribe in Your Podcast App

Use the HTTP val URL in any podcast player that supports custom RSS feeds:

  • Apple Podcasts
  • Overcast
  • Pocket Casts
  • Any other RSS-compatible app

How It Works

Email Processing

  1. Receives email at Val Town email address
  2. Extracts audio attachments (mp3, m4a, wav, ogg, aac, flac)
  3. Extracts URLs from email body and checks for direct audio links
  4. Uses email subject as episode title
  5. Uses email body as episode description
  6. Stores metadata in SQLite database
  7. Supports both attached audio files and URLs to audio files

RSS Polling

  1. Runs daily via cron schedule
  2. Fetches RSS feed from configured URL
  3. Filters for posts containing "3-track" in title or content
  4. Extracts full post text as episode description
  5. Finds mp3 links in enclosures or content
  6. Tracks processed items to avoid duplicates
  7. Adds new episodes to database

Feed Generation

  1. HTTP endpoint accessible via web browser or podcast app
  2. Queries all episodes from database
  3. Generates standard podcast RSS feed with iTunes tags
  4. Sorts episodes by publication date (newest first)
  5. Includes full descriptions from original sources

Database Schema

Episodes Table

  • id: Auto-incrementing primary key
  • source: "email" or "rss"
  • title: Episode title
  • audio_url: URL to audio file
  • pub_date: Publication date (ISO 8601)
  • description: Full episode description
  • guid: Unique identifier
  • created_at: When added to database

Processed RSS Items Table

  • guid: Unique identifier from RSS feed
  • processed_at: When item was processed

Future Enhancements

  • YouTube audio extraction support
  • Web interface for managing episodes
  • Manual episode upload
  • Episode editing/deletion
  • Analytics and statistics
  • Support for additional RSS feeds

Troubleshooting

No episodes appearing

  • Check that RSS poller has run at least once
  • Verify the RSS feed URL is correct
  • Check Val logs for errors

Email episodes not added

  • Confirm email contains audio attachment or URL to audio file
  • Check supported audio formats (mp3, m4a, wav, ogg, aac, flac)
  • URLs must be direct links ending in audio file extension
  • Review email handler logs for URL detection

Feed not loading in podcast app

  • Verify HTTP val is public
  • Test feed URL in browser first
  • Ensure XML is well-formed

Technical Details

  • Runtime: Deno (Val Town)
  • Database: SQLite (Val Town)
  • Language: TypeScript
  • RSS Format: RSS 2.0 with iTunes tags
HTTP
  • feed-generator.ts
    figleaf--4d…f2.web.val.run
Cron
  • rss-poller.ts
Email
  • email-handler.ts
Code
.claudebackendshared.vtignoreAGENTS.mdREADME.mddeno.json
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.