Readme

What Do You Think of it so far?

Rubbish!

Our bin men (garbage men to you) come round every Friday morning. But alternate weeks, they take either rubbish or recycling.

This val extracts from our local council website which collection they're doing this week and E. mails me the details every Thursday afternoon.

I've hidden the URL in an environment variable (sorry) but the URL has details of our address and I'm not sure how happy our local council would be to start getting loads of hits from all round the world. But it's here as a sample of how easy it is to scrape a website and E. mail the details to yourself.

And, on that subject, can I just say "hats off to val.town", I've been looking for a little cloud host that will let me E. mail myself from a cron for absolutely ages.

1
2
3
4
5
6
7
8
9
10
11
12
13
import { email } from "https://esm.town/v/std/email";
import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
import { load } from "npm:cheerio";
export default async (interval: Interval) => {
const html = await fetchText(Deno.env.get("rubbish_url"));
const $ = load(html);
const containers = $(".bin-collection-container");
await email({
"subject": "Bin Day",
"html": containers.first().html() + containers.next().html(),
});
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
July 19, 2024