Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Prime Now #50

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jazaval
Copy link

@jazaval jazaval commented Apr 11, 2020

This PR:

  • Adds support for Prime Now orders from any merchant - Whole Foods, Amazon, Bartell Drugs, etc.

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.

This was referenced Apr 11, 2020
This was referenced Apr 12, 2020
@Esummins Esummins mentioned this pull request Apr 13, 2020
@Merculis
Copy link

Worked for me!

@awu1004
Copy link

awu1004 commented Apr 13, 2020

Worked for me, too. Thank you!

@americanhanko
Copy link

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

@nikkiam
Copy link

nikkiam commented Apr 16, 2020

@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
Copy link
Author

jazaval commented Apr 16, 2020

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants