There are two urls that you are using to hit Nvidia's store(3080 used as an example):
URL 1: https://www.nvidia.com/en-us/shop/geforce/gpu/?page=1&limit=9&locale=en-us&category=GPU&gpu=RTX%203080
URL 2: https://www.nvidia.com/en-us/geforce/graphics-cards/30-series/rtx-3080
I noticed that by changing the inStock text to 'out of stock' to test an alert, and removing URL 1. It doesn't trip an alert.
This is because the container class name currently used, .main-container, doesn't exist on URL 2.
The easy fix is to change it to general-container. I Found that this trips an alert on both URLs.
However I do want to point out that when cards were available this past Wednesday, Nvidia made big changes to their site. I had URL 1 refreshing the whole time and i noticed that the listing for the 3080 never showed a button with Add to Cart, but rather Check Availability. Clicking that redirected you to URL 2. That was just my observation, correct me if i'm wrong.
The only reason i brought this issue up is because I believe URL 2 is more reliable, However Nvidia added an antibot measure on URL 2 where they delay the visibility of the out of stock button by about 10-15 seconds(not sure if you noticed that). No worries, because I tested this and you guys had that all figured out with Puppeteer's networkidle0
This is because the container class name currently used, .main-container, doesn't exist on URL 2.
Ah! Good find.
However Nvidia added an antibot measure on URL 2 where they delay the visibility of the out of stock button by about 10-15 seconds
Wow, thanks for the digging. Didn't notice that!
This may help with multiple containers: https://github.com/jef/nvidia-snatcher/pull/268. I suppose we can wait for both of the links involved, but will need to update the container list for this as well!
That being said, nvidia-api is available (when the site isn't down) and should be good to use. Until they change it again :smile:
@andrewmackrodt I'll make a PR to set this up.
I'm just going to use .inner for now since it's broader for the other page since I can't see what "Add to Cart" will really be when it goes live again.
However Nvidia added an antibot measure on URL 2 where they delay the visibility of the out of stock button by about 10-15 seconds
I don't think Nvidia's store is quite as advanced as this. Their stock availability API was down for ~18 hours after the news broke yesterday that they were leaking customer data in the checkout form. This ~15 second delay is the amount of time CloudFlare will wait before not being able to contact their servers and simply returning a 504 Gateway Error. The nvidia-api implementation uses the same endpoint as this.
@andrewmackrodt I think you are right about that, It seems to come up a lot faster now. I was getting very consist delays yesterday but today seems to be a different story.