Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
brunnsPublic

About

Aggregate, de-duplicate and republish RSS feeds

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

RSS aggregator

made-with-python made-with-uv Licence ci deploy GitHub forks GitHub stars GitHub watchers GitHub contributors GitHub issues GitHub issues-closed GitHub pull-requests GitHub pull-requests closed Lines of Code Top Language Languages Code to Comment zread Ask DeepWiki

Aggregate, de-duplicate and republish RSS feeds.

The problem I'm solving here is this; if I subscribe to the main Guardian RSS feed, I see a great many articles I'm not interested in1. But if instead I subscribe to the feeds for individual tags, while I don't see the things I'm not interested in, I do see a great many duplicates - articles with multiple tags show up in multiple feeds. This little app allows me to have the best of both worlds - I can see only2 the articles I'm interested in my reader3, and only once.

Prerequisites

Local development requires:

  • uv for all things Python
  • just as a task runner
  • colima4 for running the docker images we need for our integration tests

Some tasks may require additional tools:

On a Mac, you can install most of these with homebrew and asdf.

brew install uv just gh 1password-cli awscli asdf colima libxml2 fzf gum # And follow any additional setup instructions brew gives you
brew install --cask terraform-linters/tap/tflint
asdf plugin add terraform
asdf install

Design

The application is a Flask async web app deployed as an AWS Lambda function running within the Lambda Web Adapter.

Good places to start investigating the code are:

  • web.py, the application entry point.
  • routes.py, the Flask route definitions.

On each request, RSSService orchestrates the full pipeline:

  • A FeedsService implementation reads a list of feed paths and constructs full Guardian RSS URLs.
    • FileFeedsService reads from from feeds.txt, OR
    • S3FeedsService reads from an S3 object using boto3.
    • Feeds may be commented out (by prefixing with a #)
    • Feeds may be excluded (by prefixing with a -). Items on these feeds will be excluded, even if they are also on an included feed.
  • Fetcher retrieves all feeds concurrently using httpx2 with HTTP/2 and connection pooling.
  • RSSParser parses the responses with defusedxml and de-duplicates items by GUID.
  • RSSGenerator sorts by date, applies a configurable item limit, and emits a fresh RSS feed.

Services are wired together with wireup for dependency injection, with configuration sourced from environment variables as per the twelve-factor app. AWS API Gateway provides the public HTTP endpoint, backed by Terraform-managed infrastructure-as-code located in terraform/.

Configuration

Configuration is sourced from environment variables:

Variable Description Default
FEEDS_SERVICE Feeds service implementation: FileFeedsService or S3FeedsService FileFeedsService
FEEDS_FILE Path to the feeds list file (used by FileFeedsService) feeds.txt
MAX_ITEMS Maximum number of items in the output feed 50
MAX_CONNECTIONS Maximum number of concurrent HTTP connections 16
MAX_KEEPALIVE_CONNECTIONS Maximum number of keep-alive HTTP connections 16
KEEPALIVE_EXPIRY Keep-alive connection expiry in seconds 5
RETRIES Number of HTTP retry attempts per feed 3
TIMEOUT HTTP request timeout in seconds 3
LOG_LEVEL Log verbosity: ERROR, WARNING, INFO, or DEBUG INFO

The following are additionally required when FEEDS_SERVICE=S3FeedsService:

Variable Description Default
FEEDS_BUCKET_NAME S3 bucket name containing the feeds list brunns-rss-agg-feeds
FEEDS_OBJECT_NAME S3 object key for the feeds list feeds.txt
AWS_DEFAULT_REGION AWS region for S3 access boto3 default
AWS_ACCESS_KEY_ID AWS access key ID for S3 access boto3 default
AWS_SECRET_ACCESS_KEY AWS secret access key for S3 access boto3 default
S3_ENDPOINT Custom S3-compatible endpoint URL, e.g. for local testing AWS S3

Tasks

Development and build tasks can be run using just. To see available tasks, run:

just -l

Initial setup steps

Use brunns-python-template or similar.

Footnotes

  1. How is there so much sport in the world, and so many people writing and talking about it? ↩

  2. Or mostly only - the sub-editors do seem to do some questionable tagging sometimes. ↩

  3. Currently Feedly. ↩

  4. On a Mac - I'm not sure what you might use on other platforms. ↩

About

Aggregate, de-duplicate and republish RSS feeds

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages