Flavor of the Day Tracker
This application lists the flavor of the day at Frozen Custard vendors around the MKE area.
Consists of two pieces, the importer script and the site. See the readme in each directory for more details on each.
The gist though is this:
- run the importer to pull in the flavor of the day from all the sites defined in
sites.json
(or you can point to another file).
deno run -A --unstable importer.ts --sites ./sites.json
- Launch the server to view the outputted flavors in a website:
deno run --allow-env --allow-net --allow-read server.ts
- Deno >=1.36.1
Install Chrome for Puppeteer:
deno run -A --unstable https://deno.land/x/puppeteer@16.2.0/install.ts
Copy importer/.env.example
to .env
. You don't need to touch it beyond that unless you want to make use of browserless.io for scraping and R2 for storing the file.
Copy site/.env.example
to .env
. You don't need to touch it beyond that unless you have a custom url to your list of flavors of the day.
Right now the index.html
is hard coded to my flavorOfTheDay.json file on R2. To use a local copy or your own, replace the url as needed.
The importer needs a cronjob or some other timer to generate a new file daily.
The website can run anywhere, it just needs to point to the json file generated by the importer.
We use SemVer for versioning. For the versions available, see the link to tags on this repository.
The site the Importer pulls from are defined in the sites.json
. Each site needs a corresponding script file that returns the flavor of the day. These scripts file should export a load
function in the format of:
type LoadFunction = (browser: Browser, site: MkeFrozenTreatsImporter.Site) => string;
By default the importer loads up the site.json located in the importer directory. It outputs to /sites/output.json
by default, but you can set a custom destination with the --output
flag.
deno test --allow-read
Uses Deno lint in VS Code, and Deno FMT for automatic code formatting.
This could easily be forked and setup for your own locations! You could even swap out custard with some other thing (eg. soup, tacos, sales). Have fun with it!
Some sites (cough Bubba's cough) use hosting that block Bots like Puppeteer, so they cannot be scraped consistently.
Other places only list their flavors of the day on their facebook page and use inconsistent formatting that can't be scrapped.
See LICENSE file