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.
index.ts
https://ashryanio--e2a76cca3e4f11f0a22076b3cceeab13.web.val.run
A POST-based HTTP API that fetches RSS feeds from multiple sources and returns their content as structured JSON.
- ✅ Fetches full RSS content from multiple feeds
- ✅ Requires structured input with URL and author name
- ✅ Concurrent fetching for better performance
- ✅ Comprehensive error handling with detailed feedback
- ✅ Returns structured JSON with metadata
- ✅ API documentation available via GET request
Returns comprehensive API documentation and usage examples.
curl https://your-endpoint.com/
Fetches RSS feeds based on the provided feed entries.
Content-Type: application/json
Request Body Format:
[ { "url": "https://example.com/feed", "authorName": "Author Name" } ]
curl -X POST https://your-endpoint.com/ \ -H "Content-Type: application/json" \ -d '[ { "url": "https://jtbx.substack.com/feed", "authorName": "JTBX" } ]'
curl -X POST https://your-endpoint.com/ \ -H "Content-Type: application/json" \ -d '[ { "url": "https://jtbx.substack.com/feed", "authorName": "JTBX" }, { "url": "https://stratechery.substack.com/feed", "authorName": "Ben Thompson" } ]'
Each feed entry must include:
- url (string, required): Valid RSS feed URL
- authorName (string, required): Name of the feed author
{ "success": true, "feeds": [ { "url": "https://jtbx.substack.com/feed", "authorName": "JTBX", "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 operation success status
- feeds: Array of successfully fetched feeds
- url: The RSS feed URL
- authorName: Author name as provided in request
- content: Full RSS XML content
- fetchedAt: Timestamp when the feed was fetched
- success: Individual feed success status
- errors: Array of failed feeds with error details
- url: The failed RSS feed URL
- authorName: Author name as provided in request
- error: Error message describing the failure
- fetchedAt: Timestamp when the failure occurred
- success: false
- totalRequested: Total number of feeds requested
- totalSuccessful: Number of successfully fetched feeds
- totalFailed: Number of failed feeds
- fetchedAt: Overall request timestamp
The API handles various error scenarios gracefully:
{ "success": false, "error": "Request body must be an array of feed entries", "expectedFormat": [ { "url": "https://example.com/feed", "authorName": "Author Name" } ], "timestamp": "2025-05-31T18:49:29.163Z" }
{ "success": false, "error": "Each feed entry must have 'url' and 'authorName' string properties", "invalidEntry": { "url": "https://example.com/feed" }, "timestamp": "2025-05-31T18:49:29.163Z" }
{ "success": false, "error": "Invalid URL: not-a-valid-url", "authorName": "Author Name", "timestamp": "2025-05-31T18:49:29.163Z" }
{ "success": false, "error": "Method not allowed. Use GET for API documentation or POST to fetch feeds.", "timestamp": "2025-05-31T18:49:29.163Z" }
When some feeds fail but others succeed, failed feeds appear in the errors
array while successful ones appear in the feeds
array.
- Framework: Built with TypeScript for Val Town
- Concurrency: Uses
Promise.all()
for concurrent feed fetching - Validation: Validates URLs and required fields before processing
- Content: Returns full RSS XML content (not parsed)
- Error Handling: Comprehensive error handling with detailed feedback
- CORS: Enabled for browser usage
- RSS feed aggregation services
- Content monitoring and analysis tools
- Building custom RSS readers
- Data collection for research projects
- Newsletter content backup systems
- Multi-author content platforms
The endpoint respects standard HTTP rate limiting. For high-volume usage, consider implementing caching strategies or batching requests appropriately.
- All responses include timestamps for debugging
- Individual feed failures don't stop the entire operation
- URL validation occurs before any network requests
- Full RSS XML content is preserved without parsing