Git Product home page Git Product logo

ahertel / amazon-fresh-whole-foods-delivery-slot-finder Goto Github PK

View Code? Open in Web Editor NEW
1.0K 58.0 172.0 207 KB

A Mac tool that finds available delivery slots for Amazon's Whole Foods delivery and Amazon Fresh services

License: MIT License

AppleScript 100.00%
applescript amazon whole-foods automation script apple mac coronavirus grocery-delivery amazon-fresh wholefoods foods-delivery delivery-slots amazon-fresh-services delivery-window-finder scpt notification

amazon-fresh-whole-foods-delivery-slot-finder's Introduction

Featured on CNBC

Quick Links

Amazon Fresh/Whole Foods Delivery Slot Finder

A Mac-only tool that finds available delivery slots for Amazon.com's Whole Foods delivery and Amazon Fresh services.

New Features

  • New interface - added 4/6/20

    • Improve user experiecnce to accompany new features
  • Text message notifications - added 4/6/20

    • You can now get text messages when a slot is found. Added by popular demand, despite limitated utility: If you set the recipient to the same number linked to your Mac's 'Messages' app, you may not be notified on your phone as the texts may be automatically marked as read. Thus it's recommended that you enter a different phone number from the one linked to your 'Messages' app (e.g your google voice number that forwards to your real number, a family member's number, your work cell-phone)
  • Automatically handle unknown pages - added 4/6/20

    • Amazon.com sometimes redirects the URL of the delivery slot page to the Amazon homepage, and previously the tool would require a manual restart. Now it automatically navigates back the delivery slot page whenever an unknown page is encountered. One step closer to this program running without needing any monitoring/intervention
  • Auto-ignore out of stock items - added 3/31/20

    • Amazon.com displays notices when items in your cart go out of stock. Now the tool can automatically ignore these warnings so it keep looking for slots without your intervention.

DISCLAIMER about "disappearing" slots

No guarantee that slots will be found and/or that slots will work. Often you will select a slot but the page will refresh and the slot will disappear. These phantom slots are very common and are unfortunately in Amazon's control, not mine. Eventually a slot should work. Some users report success of after 20+ tries. Wishing you resilience and hope! Feel free to post concerns in the Issues section.

Instructions

  1. Read the Compatibility section below to make sure the tool will work for you
  2. Download the 'delivery-window-finder.scpt' here
  3. Enable "Allow JavaScript from Apple Events". How-to video
  4. Log into your Amazon account in Safari
  5. Fill your Whole Foods/Amazon Fresh cart with your complete order and proceed through the checkout process manually. Stop once you've arrived at the page saying no slots are available
  6. Open delivery-window-finder.scpt in Script Editor and click the 'Play' button to run it and follow the prompts run button
  7. Turn up the volume to hear the notification when a slot is found
  8. Once you receive your order, please consider tipping if you can. They are exposing themselves to risk to protect us. Thanks!

Notes: The script will stop running if your computer falls asleep. You can adjust your 'Energy Saver' settings in System Preferences or download Caffeine app to keep your Mac awake.

Compatibility

Currently not compatible with Whole Foods orders from primenow.amazon.com. Currently only compatible with Amazon Fresh and Whole Foods orders from amazon.com. Prime Now compatibility may be added eventually. Check here for any progress.

Before using this tool, ensure that your checkout page looks exactly like the examples in the Compatible section below. This tool currently only works for some regions because Amazon's checkout pages seem to vary based on your location and I designed the tool based on the page I see in my region. If your checkout page doesn't look like the examples in the Compatible or Incompatible sections below, this tool may still work for you but no guarantees.

Compatible

These are sample screenshots for delivery to a New Jersey address

Whole Foods

Whole Foods

Amazon Fresh

Amazon Fresh

Incompatible

Amazon Fresh

1.

Santa Clara, CA

2.

an unkown city in CA

How it works

  • It opens the checkout page in a new window, minimizes it, and then refreshes every ~60 seconds in the background.
  • Once it finds an open slot it alerts you by putting a notification on your screen and playing a sound, and opening the checkout page. You can choose to receive text messages when a slot is found
  • You can choose to have the tool ignore out of stock notifications and continue searching uninterrupted
  • Once you're notified, quickly select a slot and finish checking out because available slots are snagged almost instantly.

Inspiration for this tool

The Coronavirus 2019 pandemic caused a surge in demand for grocery delivery services, making it nearly impossible to find an open delivery slot. My intention in providing this tool is first and foremost help those in need (e.g. at-risk people, health care workers) have an easier time staying safe. The idea came to me when I realized my parents, who both have auto-immune diseases, had been trying unsuccesfully for several days to get grocery delivery slots.

Supporting me/Donations

Thank you so much for wanting to support me! I don't want anything in return for this tool - I'm just happy to be hearing all the stories about how this has helped people, especially those in need. That said, a few people have wanted to donate. Please consider donating to GiveDirectly which directly pays affected families, or one of the many other charities addressing COVID-19. If you'd like to support me directly: I am graduating from Georgetown Undergrad Business School in May and looking for a job opportunities so any introductions or leads would be greatly appreciated. Broadly speaking, I’m interested in the intersection of business/tech, including product management, operations, and business/data analytics. My resume

Common Issues

  • "Safari got an error: can't get window id" Solution: Don't quit Safari, or close the window opened and minimized by the script. See here for more help.

A copy of the code is also available in .txt format. However, this copy might not be the most up to date version. The .scpt file is the most current and the one you should download if you want to run this tool.

GitAds

amazon-fresh-whole-foods-delivery-slot-finder's People

Contributors

ahertel avatar antoniablair avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amazon-fresh-whole-foods-delivery-slot-finder's Issues

Windows Compatability

This would be more generally accessible if it had a way to run on Windows as well as Mac.

Walmart?

Any chance you could alter this to work with the Walmart pickup app? We're 30 miles from the closest Whole Foods, but only 15 to Walmart. And, we're also senior citizens trying to get groceries without spending 2 hours in the store.

Thanks in advance! And kudos to you for helping your parents.

Page being sent backward.

Hello,
Thank you so much for creating this! I am using it now for the first time and waiting for a slot to open. Unfortunately, I keep being sent out of the "checkout" area and back to the ordering page. Is there something on my end that I can do to fix this?

[enhancement] auto-confirm out of stock

Hey @ahertel, thank you so much for making this project. I'm really liking the script. One thing that keeps happening is one of my items will go out of stock and I will manually have to delete the item and confirm. Due to how often things go out of stock I just deal with this by buying 4 different versions of the same thing assuming 3 out of 4 things will be gone.

  • Would this feature be valuable?
  • How could someone choose to enable this feature or not? Dialogue box on startup maybe?

I can help with building this feature if that would be of use.

[Region expansion] - Slot pages w/ 3+ days

Thank you for this script!

When I've looked for slots manually, occasionally they seem to open up 2 or 3 days out (instead of just on the current day). I'm going to try to work on a PR, but in the meantime I wanted to suggest this as a possible enhancement: Could the script check each day displayed on the page, instead of just the current day?

(PS: I'm using this with the "Reserve your time" variation, which shows more days than just today/tomorrow, so that's why I'd like to try all of them. I tweaked slot_page_keyword and no_slot_keyword to match my variation of the page, and it seems to work fine.)

error message

tell application "Script Editor"
display dialog "Welcome to Delivery Slot Search Tool!

INSTRUCTIONS:

  1. Sign into Amazon.com in Safari
  2. Fill your grocery cart
  3. Manually start and continue the checkout process until you arrive at the delivery slot page. The session is now initialized. Close this slot page. It's no longer needed.
  4. Turn up the volume to hear the announcement when a slot is found
  5. Adjust your 'Energy Saver' settings in 'System Preferences' so the the display never turns off. Also plug in your laptop, if possible
  6. Go to Safari.
  7. Read the DISCLAIMER
  8. Click 'Continue'. After you answer the prompts, the tool will start searching for slots

DISCLAIMER:

No guarantee that slots will be found and/or that slots will work. Often you will select a slot but the page will refresh and the slot will disappear. These phantom slots are very common and are in Amazon's control, not mine. Eventually a slot should work. Some users report success of after 20+ tries. Wishing you resilience and hope!

FEEDBACK:

Post any concerns/feedback on GitHub issue page" with title "Welcome" with icon stop buttons {"Cancel", "Continue"} default button "Continue"
--> {button returned:"Continue"}
display dialog "Amazon gives notices when items in your cart go out of stock.
Would you like the script to:
A. automatically ignore the warnings so it keep looking for slots (recommended)
B. stop searching for slots until you manually review what went out of stock?" buttons {"Cancel", "A. Keep looking for slots", "B. Wait for me to review"} default button "A. Keep looking for slots" with title "Ignore Out Of Stock?" with icon note
--> {button returned:"A. Keep looking for slots"}
display dialog "The advanced features of this tool involve clicking on and navigating the Amazon website. The following permission MUST be enabled for this tool to run.

INSTRUCTIONS:

  1. While in Safari, push Command-comma together to open Safari Preferences.
  2. Go to the 'Advanced' page on the far right and enable 'Show develop menu in menu bar' at the very bottom.
  3. Click 'Develop' in the menu bar at the top of the screen and click 'Allow Javascript from Apple Events' to enable it.
  4. When finished, click 'Done' to proceed or 'Exit Script' to stop using this tool" with title "More access needed" buttons {"End Script", "Done"} with icon stop default button "Done"
    --> {button returned:"Done"}
    end tell
    tell current application
    do shell script "/bin/ls /System/Applications/Messages.app/Contents/Resources/MessagesAppIcon.icns"
    --> "/System/Applications/Messages.app/Contents/Resources/MessagesAppIcon.icns"
    end tell
    tell application "Script Editor"
    display dialog "Would you like to receive text messages when delivery slots appear?
    Note: If you haven't previously used your Mac's 'Messages' app to send or receive texts, select 'No'" buttons {"Cancel", "Yes", "No"} default button "Yes" with title "Text Notifications" with icon file "System:Applications:Messages.app:Contents:Resources:MessagesAppIcon.icns"
    --> {button returned:"No"}
    end tell
    (user selected no text messaging)
    tell application "Script Editor"
    display dialog "What delivery service do you want to use this script for?" buttons {"Cancel", "Whole Foods via Amazon.com", "Amazon Fresh"} with icon note with title "Which Service?"
    --> {button returned:"Whole Foods via Amazon.com"}
    display dialog "The script will start searching for slots once you click 'Continue'.

HOW DO I KNOW IT'S WORKING?

The tool will open and minimize a window once you click 'Continue'. It will quietly search in that window. You won't be get any notifications until A) a slot appears or B) an item goes out of stock and you selected to be notified. If you want to verify the script is running, you can open the minimized window and watch it open and close the slot page every ~60 seconds. You can then minimize the window again or leave it open. Just don't close it" buttons {"Cancel", "Continue"} with title "Configuration Complete" with icon note default button "Continue"
--> {button returned:"Continue"}
end tell
tell application "Safari"
make new document
--> document "Favorites"
get id of window 1
--> 749
make new tab with properties {URL:"https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1"}
--> tab 2 of window id 749
set current tab of window id 749 to last tab of window id 749
set miniaturized of window id 749 to true
get every text of last tab of window id 749
--> "
Schedule your order

Due to increased demand, available windows are limited. Please check back later or shop a Whole Foods Market near you.
Select a location
We’ll leave your order at your doorstep. To receive it in person, switch to Attended Delivery.

Delivery to:
Gina M. Cohen - 190 WASHINGTON ST, WELLESLEY HILLS, MA 02481-3108
Change
Select a day

Today
Apr 9
Not available

Tomorrow
Apr 10
Not available
Select a time
Be sure to chill your perishables immediately upon receiving your order.
No delivery windows available. New windows are released throughout the day.
Select your delivery window

Continue
"
close last tab of window id 749
end tell
(no slots found)
tell application "Safari"
make new tab with properties {URL:"https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1"}
--> tab 2 of window id 749
set current tab of window id 749 to last tab of window id 749
get every text of last tab of window id 749
--> "
Schedule your order

Due to increased demand, available windows are limited. Please check back later or shop a Whole Foods Market near you.
Select a location
We’ll leave your order at your doorstep. To receive it in person, switch to Attended Delivery.

Delivery to:
Gina M. Cohen - 190 WASHINGTON ST, WELLESLEY HILLS, MA 02481-3108
Change
Select a day

Today
Apr 9
Not available

Tomorrow
Apr 10
Not available
Select a time
Be sure to chill your perishables immediately upon receiving your order.
No delivery windows available. New windows are released throughout the day.
Select your delivery window

Continue
"
close last tab of window id 749
end tell
(no slots found)
tell application "Safari"
make new tab with properties {URL:"https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1"}
--> tab 2 of window id 749
set current tab of window id 749 to last tab of window id 749
get every text of last tab of window id 749
--> "
Schedule your order

Due to increased demand, available windows are limited. Please check back later or shop a Whole Foods Market near you.
Select a location
We’ll leave your order at your doorstep. To receive it in person, switch to Attended Delivery.

Delivery to:
Gina M. Cohen - 190 WASHINGTON ST, WELLESLEY HILLS, MA 02481-3108
Change
Select a day

Today
Apr 9
Not available

Tomorrow
Apr 10
Not available
Select a time
Be sure to chill your perishables immediately upon receiving your order.
No delivery windows available. New windows are released throughout the day.
Select your delivery window

Continue
"
close last tab of window id 749
end tell
(no slots found)
tell application "Safari"
make new tab with properties {URL:"https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1"}
--> tab 2 of window id 749
set current tab of window id 749 to last tab of window id 749
get every text of last tab of window id 749
--> error number -1728 from window id 749
Result:
-- 'ascr''err '{ '----':'utxt'("Can’t make every text of last «class bTab» of window id 749 of application "Safari" into type string."), 'errn':-1700, 'erob':'obj '{ 'form':'indx', 'want':'ctxt', 'seld':'abso'($206C6C61$), 'from':'obj '{ 'form':'indx', 'want':'bTab', 'seld':-1, 'from':'obj '{ 'form':'ID ', 'want':'cwin', 'seld':749, 'from':null() } } }, 'errt':'TEXT' }�

SMS texting vs iMessage

I just noticed you updated your script to send a text already (I did it manually.)
In my testing locally I had to do something like the following to actually send a message with SMS:

tell application "Messages"
    send "A new Amazon Fresh delivery window is available!" to buddy phoneNumber of service "SMS"
end tell 

The other method seemed to only work for iMessage contacts and not SMS messaging.

[Region Expansion] - UK - Code contribution

Hey there, we were chatting on reddit about this but wanted to add my changes here.

Screenshot of the slots page:

Reserve a Time Slot - Amazon co uk Checkout 2020-04-05 19-43-33

For no slots logic we have to check for three texts as it splits it out into morning. afternoon and evening blurbs and if all three are present then we know there's no slots. Otherwise, and as the screenshot shows, checking for lowercase "am" or "pm" works for the slot found logic - there's no need to check for the "slot_page_keyword" var as this is always present on the page even when there are no slots found.

My git is rusty, if I remember how to create a PR for my changes I'll put them in, otherwise find them here:

-- Source: https://www.cubemg.com/how-to-extract-information-from-a-website-using-applescript/
to clickClassName(theClassName, elementnum, tab_num, window_id)
	
	tell application "Safari"
		
		-- display dialog (text of last tab of window id amzn_win_id) as string
		-- display dialog (text of document 1) as string
		do JavaScript "document.getElementsByClassName('" & theClassName & "')[" & elementnum & "].click();" in tab tab_num of window id window_id
		
	end tell
	
end clickClassName


-- variable definitions
set found_slot to false
set oos_keyword to "We're sorry we are unable to fulfill your entire order"
set oos_msg to "click 'continue' on out of stock page before closing this dialog box"
set unknown_page_msg to "Unknown amazon page was loaded. try to manually navigate back to the 'Schedule your order page', and then run the program again"
set slot_site_url to "https://www.amazon.co.uk/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1"
set slot_page_keyword to "Schedule your order"
set no_slot_keyword_m to "No morning delivery windows"
set no_slot_keyword_a to "No afternoon delivery windows"
set no_slot_keyword_e to "No evening delivery windows"
set is_first_run to true
set auto_ignore_oos to true

-- prompt whether to ignore oos or wait for user to review
display dialog "When items in your cart go out of stock, would you like the script to ignore it and keep looking for slots (recommended), or do you it to stop searching for slots until you manually review what went out of stock?" buttons {"Keep looking for slots", "Wait for me to review"} default button "Keep looking for slots"

if result = {button returned:"Keep looking for slots"} then
	set auto_ignore_oos to true -- redundant, but included for clarity
else if result = {button returned:"Wait for me to review"} then
	set auto_ignore_oos to false
end if

-- create new empty window, with one empty tab
tell application "Safari"
	make new document
	delay 0.5 -- wait for new window to open
	-- instead of creating a new tab in your current window, this creates a window and 'hides it by minimizing it. apple script doesn't allow you to move tabs around, all new tabs are created. an alternate solution would be to get the unique id of the tab and access it that way instead of putting the tab in a new window
	set amzn_win_id to id of front window
end tell

repeat while found_slot is false
	-- load the delivery slot page
	tell application "Safari"
		-- opens in a new tab every time instead of just using open url request, which would prompt "Are you sure you want to send a form again?" and prevent this from running neatly in the background
		tell window id amzn_win_id
			make new tab with properties {URL:slot_site_url}
			set current tab to last tab
		end tell
		if is_first_run is true then
			-- minimizes window on the first iteration so it can run quietly in background
			set miniaturized of window id amzn_win_id to true
			set is_first_run to false
		end if
		
		-- wait for the page to load
		delay 20
		
		-- get the text on the page
		set siteText to (text of last tab of window id amzn_win_id) as string
	end tell
	
	-- PROCESS PAGE CONTENTS:
	
	-- no delivery slots available
	if siteText contains no_slot_keyword_m and siteText contains no_slot_keyword_a and siteText contains no_slot_keyword_e then
		
		
		-- closes the tab since no slot was found
		tell application "Safari"
			close (last tab of window id amzn_win_id)
		end tell
		log "no slots found"
		
		-- delay so you don't spam Amazon's site
		delay 10
	else if siteText contains oos_keyword then
		-- landed on out of stock page
		
		if auto_ignore_oos then
			-- click continue button to dismiss out of stock warning
			clickClassName("a-button-text", 0, -1, amzn_win_id)
			
			log "Items out of stock were ignored"
			say "ignored oos item"
			-- delay to wait for the next page to load(it might be another oos page or the delivery slot page
			delay 20
			
			-- closes the tab so the tab can be reloaded and processed anew
			tell application "Safari"
				close (last tab of window id amzn_win_id)
			end tell
		else
			say "Item out of stock. See pop up"
			display dialog oos_msg
		end if
		
	else if siteText contains "am" or siteText contains "pm" then
		-- landed on delivery slot page and delivery slot selection drop down appears aka. slot found!
		display notification "Found delivery slot!" with title "Amazon" sound name "Sosumi"
		say "Success: Delivery slot found"
		set found_slot to true
		
		tell application "Safari"
			-- bring window to front
			set miniaturized of window id amzn_win_id to false
			-- wait for window to open
			delay 1
			-- maximize window so delivery slots are clearly visible
			-- this might be useful later on if I want to have it take a screenshot as proof of delivery slots found
			-- Credit for fill to screen: https://macosxautomation.com/applescript/firsttutorial/18.html
			tell application "System Events"
				tell application "Finder" to get the bounds of the window of the desktop
				tell application "Safari" to set the bounds of the front window to ¬
					{0, 22, (3rd item of the result), (4th item of the result)}
			end tell
		end tell
	else
		-- encountered unknown page
		say "unknown page encountered. see pop up"
		display dialog unknown_page_msg
		-- correctly exit the loop and end the program
		set found_slot to true
	end if
end repeat

Thanks again for the initial work!

Legal and ethical issues

First, I want to thank you for using your skills in a way to help other in these trying times. Developing new technology to help others is a laudable endeavor. That said, I have some concerns about this tool and implications it may have for users and other customers of Amazon, despite its intention. I want to highlight my personal thoughts about these potential issues here.

Automated access of Amazon sites in this manner is prohibited by their conditions of use. Specifically prohibited:

any use of data mining, robots, or similar data gathering and extraction tools

Following this, the use of this automation is likely to be a violation of these terms and possibly US law, such as the CFAA, for exceeding authorized access to Amazon's computer systems (as described in conditions of use) especially given the information exported is not publically available (you need to login and checkout to see delivery availability) and arguably causes damage to Amazon and their other customers. Some additional food for thought here.

Lastly, no matter how well-intentioned, this automation has enabled bad actors to hoard resources and unduly deprives other Amazon customers of fair use of the service. This is particularly concerning amid the global COVID-19 crisis where resources, including these delivery slots, are scarce. While the power for abuse lies in the user's hands, it is my personal opinion that this software should not be publically available for the reasons stated above.

syntax error

		-- send text notification
		if sendTexts then
			-- Credit for texting code: Sean Pinkey, https://github.com/spinkney
			tell application "Messages"
				set targetService to 1st service whose service type = iMessage
				set targetBuddy to buddy phoneNumber of targetService
				send deliverySlotFoundTextMsg to targetBuddy
			end tell
			log "text message sent about slot found"
		end if
		
		-- bring Safari window to front and expand to fill screen so delivery slots are clearly visible
		tell application "Safari"
			-- unminimize
			set miniaturized of window id amzn_win_id to false
			-- wait for window to open
			delay 1
			-- maximize window 
			-- this might be useful later on if I want to have it take a screenshot as proof of delivery slots found
			-- Credit for fill to screen: https://macosxautomation.com/applescript/firsttutorial/18.html
			tell application "System Events"
				tell application "Finder" to get the bounds of the window of the desktop
				tell application "Safari" to set the bounds of the front window to ¬
					{0, 22, (3rd item of the result), (4th item of the result)}
			end tell
		end tell
		
		-- signals that the loop should end
		set found_slot to true
	else
		-- encountered unknown page
		-- will navigate back to the cart and from there back to the slot selection page
		log "unknown page encountered"
		restartCheckout(selected_cart_url, amzn_win_id)
	end if
end repeat

else
log "user did not confirm javascript access was enabled. exiting due to insufficient permissions"
end iftell application "Finder"
activate
open document file "delivery-window-finder.scpt" of folder "Amazon-Fresh-Whole-Foods-delivery-slot-finder-master" of folder "Downloads" of folder "ginamariacohen" of folder "Users" of startup disk
end tell
tell application "Finder"
activate
close Finder window id 252
end tell

Chrome

Any update on iPad or PC use

"User Canceled" Error

Hi, thanks a lot for putting this script together. When I try to run it, I'm getting the message:
error "User canceled." number -128 from «script» to item

I believe I followed all the right steps. Did I miss something?

Thanks!

Refreshing Window Problem

I believe I followed the directions completely, so it may be a result of a setting somewhere, but I'm encountering a problem at the end where a window is supposed to pup up an minimize, it actually popped up as a tab in my current window and didn't minimize because of that. At first, I was like, fine whatever, but I have a problem where if I'm using Safari, it will actually refresh the current page I'm on to the Amazon cart instead of the designated tab, which basically means I can't use Safari. Does someone have advice for how to fix this?

Support for Google Chrome on Mac

Adding this because a reddit user asked for Google Chrome support on Mac, because their Safari doesn't work. I figured this was a one-off situation but just in case I'm posting this hear in case other have issues with their Safari.

For now, I am not going to spend time on adding Chrome support for Mac for now because I've been really swamped by all the questions and more commonly requested functionality additions. If more people share that they have a need for Chrome support for Mac, I'll work on it.

In the mean time, doing a find and replace in the Script Editor on the script, replacing the word "Safari" with "Google Chrome" might work. But often times the AppleScript syntax to control Chrome is slightly different so I'm doubtful.

You can also try pcomputo's tool. It requires more technical knowledge to set up, and doesn't have as many features as this tool, but it runs in Chrome! Also check out Auto Refresh Plus

Prime Now?

Quick question-- does this work correctly with Prime Now - Whole Foods orders

I have it set up and just pasted the link to my Prime Now cart and it is refreshing..(no openings yet)

Just wondering if anyone knows if it works for this.

Thanks!

Two Questions

Hey,

Thanks for writing the script. Two questions:

  • Exactly what happens where there is success? Does it just stop refreshing?
  • Can you share the sound the computer makes upon success?

Thanks

[question] Curious about the every minute refreshes

I'm surprised that Amazon website didn't block us after so many refreshes and doesn't think we are bot. I went through the script and couldn't see any sort of cookie magic. Just curious on any ideas that you might have about how that works. Thank you for this, it's a life saver. Stay safe.

Doing Harm

I appreciate the spirit in which you created this project, however I believe you are going to be doing more harm than good, and excluding exactly the demographic you intended to serve. Disabled and older shut in’s are unlikely to have an expensive Mac computer, and will be completely unaware of your project and likely unable to utilize it due to it’s technology barrier, (even if they were aware).

As an example, I care for my mom full time, and because of this virus I can’t leave the house but rely on internet delivery services such as Amazon Fresh to receive food. My mom is lucky to have me scouring the internet for delivery options, which is not easy, but most of the people you are trying to help do not have a full time, fairly tech savvy caregiver. But now, because I don’t have a Mac, I will not be able to get her delivery slots as easily, (I haven’t found one in days), and of course it will get much worse as your project gains popularity with the tech savvy, git hub community, which the disabled and elderly are often not a part of.
I don’t know how you put this genie back in the bottle, but I truly feel you are making it much harder for the elderly and needy to receive shipment of needed supplies from Amazon.

Email Message alerts

Would love to see this send with some SMTP email with a library sending emails through an authenticated SMTP account like gmail !

PrimeNow?

Would it be possible to extend this to PrimeNow?

Too many prompts to accept at the start of the script

Thanks for this awesome script! However, since the last update, the amount of prompts to go through is really tedious, especially given that the script will often find ghost slots and then need to be restarted.

Lots of those windows feel like gimmicks, and while they're definitely useful for some people, I don't expect them to be useful for the majority. For example, the message notification is probably not that helpful given how quickly an order must be placed after a delivery slot is found.

All the disclaimers could also be skipped, since it's in your README. They're informative, but redundant after seeing them more than once.

Keep up with the good work!

Keep track of cart

Items will automatically disappear from the cart when it went out of stock and I need to manually check what is missing. Is it possible to use the script to track what is missing from the cart?

Donations

You should set up kofi or something similar so people can donate to you. Thanks for making this tool. I was about to make it myself and you saved me a bunch of time. <3

auto-select slot and place order

Am starting a new issue for this feature that was discussed in issue #3

The idea: Once slots appear, the script could automatically select the first available one, and then click continue to finish the order. However, sometimes a slot appears, but by the time you select it and click "continue" it's already full and the continue button stops working. So in that case the program would keep refreshing, selecting new time slots, trying to checkout until the order finally goes through and the order confirmation page appears. This would make the tool complete in my eyes as it would then be fully autonomous and could even place orders while one is sleeping haha. I think once we having the auto-confirm out of stock clicking figured out, it would pretty easy to add this auto-checkout feature.
The user chooses to enable this feature via a dialog box.

The progress so far: The automatic slot selection and checkout feature have proven far more difficult. More specifically, I ran into a roadblock: Once my script finds a slot, I can't even manually select it in Safari on my computer so I get stuck on that page, no matter how many times I refresh. To ensure it wasn't an out of stock issue, I loaded the checkout page in Google Chrome, and was repeatedly able to select a slot and finishing checkout out. I am also able to select a slot in Safari on a different MacBook in my house. Either something is wrong with my laptop's Safari, or perhaps Amazon has flagged my laptop's Safari client on my specific laptop due to my constant refreshing.
Am curious to hear your thoughts. Thanks

Can we add smile.amazon.com support?

I can contribute if you'd like, or fork, but optionally, this script could potentially be slightly more valuable for people who like to contribute via Amazon's smile program. We could add support for configuring the script to use smile.amazon.com or www.amazon.com. Are you willing to add support for smile.amazon.com (instead of www.amazon.com)?

Does not allow checkout after slot selected

I had high hopes. After about 30 minutes the script reported it had found a slot. I clicked on the slot, then clicked Continue and I was brought back to the page showing no slots available. Crap. I closed the browser, re-opened it, re-started the script and after about 10 or so minutes it found another slot - but the same thing happened again. I pick a slot (quickly) then click continue, but no dice, back to the No Slots Available page. Bummer.

error

tell application "Script Editor"
display dialog "Welcome to Delivery Slot Search Tool!

INSTRUCTIONS:

  1. Sign into Amazon.com in Safari
  2. Fill your grocery cart
  3. Manually start and continue the checkout process until you arrive at the delivery slot page. The session is now initialized. Close this slot page. It's no longer needed.
  4. Turn up the volume to hear the announcement when a slot is found
  5. Adjust your 'Energy Saver' settings in 'System Preferences' so the the display never turns off. Also plug in your laptop, if possible
  6. Go to Safari.
  7. Read the DISCLAIMER
  8. Click 'Continue'. After you answer the prompts, the tool will start searching for slots

DISCLAIMER:

No guarantee that slots will be found and/or that slots will work. Often you will select a slot but the page will refresh and the slot will disappear. These phantom slots are very common and are in Amazon's control, not mine. Eventually a slot should work. Some users report success of after 20+ tries. Wishing you resilience and hope!

FEEDBACK:

Post any concerns/feedback on GitHub issue page" with title "Welcome" with icon stop buttons {"Cancel", "Continue"} default button "Continue"
--> {button returned:"Continue"}
display dialog "Amazon gives notices when items in your cart go out of stock.
Would you like the script to:
A. automatically ignore the warnings so it keep looking for slots (recommended)
B. stop searching for slots until you manually review what went out of stock?" buttons {"Cancel", "A. Keep looking for slots", "B. Wait for me to review"} default button "A. Keep looking for slots" with title "Ignore Out Of Stock?" with icon note
--> {button returned:"A. Keep looking for slots"}
display dialog "The advanced features of this tool involve clicking on and navigating the Amazon website. The following permission MUST be enabled for this tool to run.

INSTRUCTIONS:

  1. While in Safari, push Command-comma together to open Safari Preferences.
  2. Go to the 'Advanced' page on the far right and enable 'Show develop menu in menu bar' at the very bottom.
  3. Click 'Develop' in the menu bar at the top of the screen and click 'Allow Javascript from Apple Events' to enable it.
  4. When finished, click 'Done' to proceed or 'Exit Script' to stop using this tool" with title "More access needed" buttons {"End Script", "Done"} with icon stop default button "Done"
    --> {button returned:"Done"}
    end tell
    tell current application
    do shell script "/bin/ls /System/Applications/Messages.app/Contents/Resources/MessagesAppIcon.icns"
    --> "/System/Applications/Messages.app/Contents/Resources/MessagesAppIcon.icns"
    end tell
    tell application "Script Editor"
    display dialog "Would you like to receive text messages when delivery slots appear?
    Note: If you haven't previously used your Mac's 'Messages' app to send or receive texts, select 'No'" buttons {"Cancel", "Yes", "No"} default button "Yes" with title "Text Notifications" with icon file "System:Applications:Messages.app:Contents:Resources:MessagesAppIcon.icns"
    --> {button returned:"Yes"}
    display dialog "Please enter desired recipient phone number. Format: 10 digits, no symbols or spaces (e.x. 8002752273)" default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue" with title "Recipient Phone Number"
    --> error number -128
    end tell
    (user clicked cancel during phone number prompts)
    tell application "Script Editor"
    display dialog "What delivery service do you want to use this script for?" buttons {"Cancel", "Whole Foods via Amazon.com", "Amazon Fresh"} with icon note with title "Which Service?"
    --> {button returned:"Whole Foods via Amazon.com"}
    display dialog "The script will start searching for slots once you click 'Continue'.

HOW DO I KNOW IT'S WORKING?

The tool will open and minimize a window once you click 'Continue'. It will quietly search in that window. You won't be get any notifications until A) a slot appears or B) an item goes out of stock and you selected to be notified. If you want to verify the script is running, you can open the minimized window and watch it open and close the slot page every ~60 seconds. You can then minimize the window again or leave it open. Just don't close it" buttons {"Cancel", "Continue"} with title "Configuration Complete" with icon note default button "Continue"
--> {button returned:"Continue"}
end tell
tell application "Safari"
make new document
--> document "Favorites"
get id of window 1
--> 750
make new tab with properties {URL:"https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1"}
--> missing value
set current tab of window id 750 to last tab of window id 750
--> error number -1719 from last tab of window id 750
Result:
error "Safari got an error: Can’t get last tab of window id 750. Invalid index." number -1719 from last tab of window id 750

Safari error

"Safari got an error. Can't get last tab of window id 680. This happened just as I got a sound for a free time. And script program stopped running.
Screen Shot 2020-04-13 at 6 02 30 PM

JavaScript Enabled But Error Message

Hello, when I first downloaded this script, I received a slot within seconds, unfortunately, I didn't catch it in time. However, ever since then, despite having JavaScript Allowed through Apple Events, I keep receiving this error message:

log "user did not confirm javascript access was enabled. exiting due to insufficient permissions"
end if

I don't know what to do considering it is enabled but it isn't allowing the script to run further. Please advise.

Thank you.

amazon sign out

hi, after i leave it running for awhile (30 minutes or so), my amazon acc logs out. is this normal? i have to keep signing back in and re-running the script.

Error code

If I open the minimized Safari window, after 30 seconds it quits and I get the following error

error "Safari got an error: Can’t get window id 6178." number -1728 from window id 6178

Instacart

Have you considered doing something similar for Instacart? Currently, you have to do a manual refresh constantly to get a window.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.