Skip to content

stabbylambda/trashcal

Repository files navigation

🗑️📆 Trashcal

Trashcal is a small AWS Lambda function that parses the City of San Diego's trash collection pages and produces an iCal file with events for trash, recycling, and greens days.

The actual lambda is written in Rust and you'll need cargo lambda to build it.

Usage

This is a CDK app, so set up all your AWS stuff, set DOMAIN_NAME to the domain you want, and then run cdk deploy.

How it works

San Diego has all of the waste pickup info in a Salesforce app where you can get either your PDF calendar with alternate Recycling and Greens weeks or get an HTML page with your next pickup dates. (For the record, I don't know who lives at 1234 Agate St. It was just the first address that popped up when I searched 1234 A). This lambda just loads that page, parses the HTML, and generates the ICalCalendar for you.

There is a JSON representation of this information, but that would require parsing HTML to get the CSRF token anyway and I worry that the Salesforce API would change. The city calls this a "bookmarkable page" so I believe this will be durable.