fetchRssForSubcurrent
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.
Viewing readonly version of main branch: v7View latest version
An HTTP GET endpoint that fetches full RSS files from a list of Substack publications.
- ✅ Fetches full RSS content from Substack feeds
- ✅ Supports multiple feeds in a single request
- ✅ Concurrent fetching for better performance
- ✅ Error handling with detailed feedback
- ✅ Flexible input methods (query parameters or hardcoded defaults)
- ✅ Returns structured JSON with metadata
By default, the endpoint fetches the hardcoded example feed:
GET /
Returns RSS content from https://jtbx.substack.com/feed
You can specify custom feeds using the feeds query parameter:
GET /?feeds=https://jtbx.substack.com/feed,https://stratechery.substack.com/feed
GET /?feeds=["https://jtbx.substack.com/feed","https://stratechery.substack.com/feed"]
The endpoint returns a JSON response with the following structure:
{ "success": true, "feeds": [ { "url": "https://jtbx.substack.com/feed", "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>...", "fetchedAt": "2025-05-31T18:49:29.163Z", "success": true } ], "errors": [], "totalRequested": 1, "totalSuccessful": 1, "totalFailed": 0, "fetchedAt": "2025-05-31T18:49:29.163Z" }
success: Overall success statusfeeds: Array of successfully fetched feedsurl: The RSS feed URLcontent: Full RSS XML contentfetchedAt: Timestamp when the feed was fetchedsuccess: Individual feed success status
errors: Array of failed feeds with error detailstotalRequested: Total number of feeds requestedtotalSuccessful: Number of successfully fetched feedstotalFailed: Number of failed feedsfetchedAt: Overall request timestamp
The endpoint gracefully handles various error scenarios:
- Invalid URLs: Returns 400 with error details
- Network failures: Individual feed failures are captured in the
errorsarray - Invalid query parameters: Returns 400 with usage examples
{ "success": false, "error": "Invalid URL: not-a-valid-url", "timestamp": "2025-05-31T18:49:29.163Z" }
curl "https://your-endpoint.com/?feeds=https://jtbx.substack.com/feed"
curl "https://your-endpoint.com/?feeds=https://jtbx.substack.com/feed,https://stratechery.substack.com/feed"
curl "https://your-endpoint.com/?feeds=[\"https://jtbx.substack.com/feed\",\"https://stratechery.substack.com/feed\"]"
- Built with TypeScript for Val Town
- Uses concurrent fetching with
Promise.all()for performance - Validates URLs before making requests
- Returns full RSS XML content (not parsed)
- Includes comprehensive error handling and logging
- CORS enabled for browser usage
- RSS feed aggregation
- Content monitoring and analysis
- Building custom RSS readers
- Data collection for research
- Newsletter content backup
The endpoint respects standard HTTP rate limiting. For high-volume usage, consider implementing caching or batching strategies.