jpchip / giveaway-grabber

Automated Amazon Giveaways using Node & Puppeteer (until 10/17/19) 🎁
MIT License
74 stars 20 forks source link

Won giveaways have a different URL #104

Closed rinoma closed 5 years ago

rinoma commented 5 years ago

When a giveaway is already entered, the URL is saved in the DB. However, the url format of a giveaway that has already been won is different: Screenshot 2019-06-10 at 21 34 22 When the url is saved it contains the string /ga/won/. When searching the db, it is searched with /ga/p/ and it isn't found. The winning url is saved again in the db. An error is returned because the url is not unique.

jpchip commented 5 years ago

Here's my thought: We always get the giveaway url to do the is skippable test. What if we store that as currentGiveawayUrl in the giveaways.js file, and we use it everywhere? Then it will always be saving the /ga/p/ version of the url even if you win? See my changes here:

https://github.com/jpchip/giveaway-grabber/blob/log-price-check/src/giveaways.js

rinoma commented 5 years ago

The way you did it looks fine to me.