ahertel / Amazon-Fresh-Whole-Foods-delivery-slot-finder

A Mac tool that finds available delivery slots for Amazon's Whole Foods delivery and Amazon Fresh services
MIT License
1.03k stars 168 forks source link

Add support for Prime Now #50

Closed jazaval closed 5 months ago

jazaval commented 4 years ago

This PR:

How:

  1. Each Prime Now merchant has a specific merchantId in the slot delivery page URL that is populated once you click "Proceed to checkout" from the generic cart URL at https://primenow.amazon.com/cart.
  2. I added an if statement enabling restartCheckout to click the "Proceed to checkout" button, which then sets the variable prime_now_merchant_specific_slot_url to the custom, merchant-specific URL that contains the available slot listings (example: https://primenow.amazon.com/checkout/enter-checkout?merchantId=A7D2T2JJFZOBQ&ref=pn_sc_ptc_bwr)
  3. The subsequent runs of the main loop then use prime_now_merchant_specific_slot_url instead slot_site_url and the delivery slot parsing works as expected.
Merculis commented 4 years ago

Worked for me!

awu1004 commented 4 years ago

Worked for me, too. Thank you!

americanhanko commented 4 years ago

@ahertel any ETA on this? It would be great to have this in the upstream repository.

nikkiam commented 4 years ago

@jazaval I just tried this out on a macbook and it mostly worked as expected. After a refresh I happened to be near the laptop for it was displaying a new delivery slot, but for some reason the script didn't trigger any sound or notification of the new slot. Does the script take an additional refresh of the page with the same slot showing to notify the user? Just pointing this out in case it's unintended behaviour due to these prime now support changes.

jazaval commented 4 years ago

@nikkiam this is an expected behavior, but only if there's a slot available in the very first loop of the script. This is a side effect of using the restartCheckout function to obtain the correct merchantID for the cart, which only happens at the end of the first loop.