Script Alert for Web Page with Javascript

I’ve been trying to get a fresh direct order scheduled for a few days now, but the time slots fill up immediately. From what I can tell the slots are not opened at a specific time. It has occurred sometime around midday or early in the morning and once 2 days were opened at the same time.

So, I’d like to script something that will load the page and alert me when a new day is added, similar to how @wendell bought his ASUS XG438Q when they were selling out in seconds.

My experience doing things like this starts and ends with curl, which afaik, is not really an option here because of the javascript. (I tried using curl to send the form data with my address but it didn’t return anything useful).

https://www.freshdirect.com/help/delivery_info_check_slots.jsp

What tools do people use for this kind of thing (ideally on Linux or macOS)?

I’ve seen tools do something like this using Ruby and its Mechanize library. Unfortunately I’m either blind or there is no usable documentation for it. I can find a bunch of Docs for Perl Mechanize but that doesn’t really help…

edit: If you wanna take a look at it…

edit 2: as an example, this is a script (forked repo) I used to use for accessing some stuff on a bank’s website, it logs into the user account, navigates some links, then downloads some stuff. I modified it later for my use (hence the fork), but doing so was a pain in the a** with next to no documentation… just navigating the DOM structure doesn’t seem to be documented at all… either way, you can take a look here (it’s defunct now as the bank website changed some stuff due to new regulations):

2 Likes

Use Distill.

2 Likes

Not sure how you want to be ‘alerted’, but as far as detection goes, a few lines of Javascript and a userscript manager like Tampermonkey is all you really need. I park/pin a tab in Firefox and the script just scans/reloads the page in the background.

My scripts play a sound file to alert me of relevant events/changes.