Yann Oliveira

Reading 19 RSS feeds with zero dependencies

The script behind O Navegador's daily curation. Python standard library only, and one failing feed never takes the others down.

Placeholder text#automacao#ia

Every day the curation for O Navegador reads newsletters in Gmail and 19 RSS feeds. This is the feeds part: a single-file script, no pip install, that returns JSON for Claude to pick what goes into the issue.

How to use it

python3 -I fetch_feeds.py 30   # items from the last 30 hours

The output has items (source, topic, title, link, date and a short summary) and errors (the feeds that failed and why).

The part that matters

RSS 2.0 and Atom store the same fields in different places. One generator covers both formats:

fetch_feeds.py
def items_of(root):
    for item in root.iter("item"):  # RSS 2.0
        yield (
            item.findtext("title"),
            item.findtext("link"),
            item.findtext("pubDate"),
            item.findtext("description"),
        )
    for entry in root.iter(ATOM + "entry"):  # Atom
        link = entry.find(ATOM + "link[@rel='alternate']")
        yield (
            entry.findtext(ATOM + "title"),
            link.get("href") if link is not None else None,
            entry.findtext(ATOM + "published"),
            entry.findtext(ATOM + "summary"),
        )

Why it is built this way

  • No dependencies: it runs on any machine and in a cloud routine with no environment setup.
  • Isolated failures: every feed has its own try. A site that is down becomes one line in errors, and the curation goes on.
  • Short summaries: the script cuts text at 280 characters. Deciding what to read in full is the curation's job, not the script's.