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

ashryanio

fetchRssForSubcurrent

Public
Like
fetchRssForSubcurrent
Home
Code
4
.vtignore
README.md
deno.json
H
index.ts
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
index.ts
https://ashryanio--e2a76cca3e4f11f0a22076b3cceeab13.web.val.run
README.md

RSS Feed Fetcher API

A POST-based HTTP API that fetches RSS feeds from multiple sources and returns their content as structured JSON.

Features

  • ✅ 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

API Endpoints

GET / - API Documentation

Returns comprehensive API documentation and usage examples.

curl https://your-endpoint.com/

POST / - Fetch RSS Feeds

Fetches RSS feeds based on the provided feed entries.

Content-Type: application/json

Request Body Format:

[ { "url": "https://example.com/feed", "authorName": "Author Name" } ]

Usage Examples

Single Feed

curl -X POST https://your-endpoint.com/ \ -H "Content-Type: application/json" \ -d '[ { "url": "https://jtbx.substack.com/feed", "authorName": "JTBX" } ]'

Multiple Feeds

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" } ]'

Request Format

Each feed entry must include:

  • url (string, required): Valid RSS feed URL
  • authorName (string, required): Name of the feed author

Response Format

Successful Response

{ "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" }

Response Fields

  • 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

Error Handling

The API handles various error scenarios gracefully:

1. Invalid Request Body

{ "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" }

2. Missing Required Fields

{ "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" }

3. Invalid URLs

{ "success": false, "error": "Invalid URL: not-a-valid-url", "authorName": "Author Name", "timestamp": "2025-05-31T18:49:29.163Z" }

4. Method Not Allowed

{ "success": false, "error": "Method not allowed. Use GET for API documentation or POST to fetch feeds.", "timestamp": "2025-05-31T18:49:29.163Z" }

5. Individual Feed Failures

When some feeds fail but others succeed, failed feeds appear in the errors array while successful ones appear in the feeds array.

Technical Details

  • 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

Use Cases

  • 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

Rate Limiting

The endpoint respects standard HTTP rate limiting. For high-volume usage, consider implementing caching strategies or batching requests appropriately.

Development Notes

  • 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
HTTP
  • index.ts
    ashryanio--e2a76cca3e4f11f0a22076b3cceeab13.web.val.run
Code
.vtignoreREADME.mddeno.json
H
index.ts
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
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.