tstromberg / ncdmv-appointment-notifier

Get notified when an appointment opens up at one of your favorite NC DMV locations.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ncdmv-appointment-notifier

Get notified when an appointment opens up at one of your favorite NC DMV locations.

Note

The new NC DMV system is designed to circumvent automated queries. To stay maintainable and under the radar, this script requires you to define exactly which sites you are interested in.

Requirements

  • Go 1.19 or newer
  • curl
  • This probably works on pretty much anywhere, but only tested on macOS so far

Installation

go install github.com/tstromberg/ncdmv-appointment-notifier@latest

Usage

ncdmv-appointment-notifier

It's that easy! There are a number of flags for tuning the behavior of this program:

  • --max-notify-days: only notify if a reservation is available within this many days (default 30)
  • --refresh-delay: how long to wait between refreshes if no matching appointments are found (default 9m0s)
  • --found-delay: how long to wait between refreshes if a matching appointment is found (default 1h0m0s)
  • --run-command: alert command to run (must accept a string argument) (default "say")
  • --sites-directory: path to sites content (default "sites/")

Example Output

On macOS, Linux, and Windows, this program will generate a desktop notification:

ncdmv-appointment-notifier notification screenshot on macOS

If your computer has the "say" command installed (macOS), ncdmv-appointment-notifier will also speak the contents of the notification out loud. You can use --run-command to set an alternative tool, such as espeak.

There is also useful logging output for diagnostics:

 checking sites/carrboro.txt ...
 "sites/carrboro.txt" returned 163988 bytes of data
 next appointment for "Carrboro" is 2022-12-29 00:00:00 +0000 UTC (85 days)
 checking sites/graham.txt ...
 "sites/graham.txt" returned 164279 bytes of data
 next appointment for "Graham" is 2022-12-02 00:00:00 +0000 UTC (58 days)
 Graham has an appointment available at 2022-12-02 00:00:00 +0000 UTC!
 Sending alert: Next appointment for Graham is in 58 days
 Running say ...
 checking sites/hillsborough.txt ...
 "sites/hillsborough.txt" returned 105888 bytes of data
 next appointment for "Hillsborough" is 2022-12-20 00:00:00 +0000 UTC (76 days)
 Hillsborough has an appointment available at 2022-12-20 00:00:00 +0000 UTC!
 Sending alert: Next appointment for Hillsborough is in 76 days
 Running say ...
 checking sites/raleigh-west.txt ...
 "sites/raleigh-west.txt" returned 105822 bytes of data
 "Raleigh West" has no appointments available
 checking sites/siler-city.txt ...
 "sites/siler-city.txt" returned 105878 bytes of data
 next appointment for "Siler City" is 2022-12-02 00:00:00 +0000 UTC (58 days)
 Siler City has an appointment available at 2022-12-02 00:00:00 +0000 UTC!
 Sending alert: Next appointment for Siler City is in 58 days
 Running say ...
 Sleeping for 7m0s ...

Defining your acceptable DMV sites

To define which offices you are interested, you will need to modify the contents of the sites/ subdirectory. Out of the box, this program comes with a couple of sample sites (Carrboro, Hillsborough, etc).

To program a site, you will need to create a text file in the sites/ subdirectory containing the appropriate request data.

Gathering Request Data in Chrome

  1. Visit https://skiptheline.ncdot.gov/
  2. Select your appointment type and location - when you see a Calendar view, you are on the right page.
  3. Click the "Hamburger menu" on the top-right of the browser
  4. Select "More Tools"
  5. Select "Developer Tools"
  6. Click the "Network" tab
  7. Reload the page
  8. Right click on the first entry
  9. Select "Copy" then "Copy as cURL"
  10. Paste the contents into a text file in this directory.

Gathering Request Data in Firefox

  1. Visit https://skiptheline.ncdot.gov/
  2. Select your appointment type and location - when you see a Calendar view, you are on the right page.
  3. Click the "Hamburger menu" on the top-right of the browser
  4. Select "More Tools"
  5. Select "Web Developer Tools"
  6. Click the "Network" tab
  7. Reload the page
  8. Right click on the first POST entry
  9. Select "Copy Value" then "As cURL"
  10. Paste the contents into a text file in this directory.

NOTE: The request data generated by Firefox is ocassionally corrupt. If the site returns 0 bytes of data, try again with Chrome.

About

Get notified when an appointment opens up at one of your favorite NC DMV locations.

License:Apache License 2.0


Languages

Language:Go 100.0%