Public
Commitfest patch history as an RSS feed
httppostgresrssscraper
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.

cf-rss

This app was generated by Townie.

Serves the History section of a PostgreSQL commitfest patch page as an RSS feed. The commitfest JSON API (apiv1.py) doesn't expose history, so the patch page's HTML is fetched and parsed instead.

Routes

  • GET /patch/<id> — RSS feed
  • GET /patch/<id>.json — parsed history as JSON
  • GET /<id> — alias for the RSS feed
  • GET / — form for looking up a patch

Trailing slashes are accepted. Example: feed for patch 6982.

Feed format

Each history row becomes an item with title "who: what", description what, and the row's timestamp as pubDate. Item guids are hashes of the row contents, so they don't change when new rows are added. Responses carry an ETag (hash of the history) and answer If-None-Match with a 304 when nothing changed.

Implementation

The parser (commitfest.ts) uses cheerio to locate the table following the <th>History</th> cell in patch.html. If the page doesn't match the expected structure, a ScrapeError (HTTP 502) is returned. Timestamps on commitfest are naive GMT (Django TIME_ZONE = "GMT", USE_TZ = False).

Parsed results are cached in blob storage for 10 minutes (cache.ts); concurrent requests for the same patch share one upstream fetch, and a failed refresh falls back to the cached copy.

Files

  • main.ts — HTTP routes
  • commitfest.ts — upstream fetch + HTML parsing
  • rss.ts — RSS generation and ETag
  • cache.ts — blob cache
  • config.ts — TTL constant
  • test/ — parser and renderer tests (run with run_file)