Added country url bypass + scroll JS to properly load the "non visible" product stock checks

master
Jeremy R 2022-11-06 12:01:36 -05:00
rodzic e3a5f3c02f
commit 2f973812d1
1 zmienionych plików z 23 dodań i 1 usunięć

@ -47,7 +47,8 @@ document.getElementById('onetrust-accept-btn-handler').click();
### Web page change alerts for BestBuy products
BestBuy will often ask for a 'local' or 'country' store, we simply click on the USA flag link from the English section of the site https://changedetection.io/share/pkhEFXeb8Cka
BestBuy will often ask for a 'local' or 'country' store, just append ```&intl=nosplash``` to the end of the url to go directly to the site and bypass the country selection.
https://changedetection.io/share/pkhEFXeb8Cka
In that above shared link, we will be watching BestBuy for changes in GTX 4090 graphic card prices
@ -62,6 +63,27 @@ setInterval(function(){
```
and "**Wait seconds before extracting text**" to around `5`
If the page contains more then 3 products, you will also need to execute JS to scroll the page if you wish for it to properly check stock.
```var notChangedStepsCount = 0;
var scrollInterval = setInterval(function() {
var element = document.querySelector("div.footer");
if (element) {
// element found
clearInterval(scrollInterval);
element.scrollIntoView();
} else if((document.documentElement.scrollTop + window.innerHeight) != document.documentElement.scrollHeight) {
// no element -> scrolling
notChangedStepsCount = 0;
document.documentElement.scrollTop = document.documentElement.scrollHeight;
} else if (notChangedStepsCount > 20) {
// no more space to scroll
clearInterval(scrollInterval);
} else {
// waiting for possible extension (autoload) of the page
notChangedStepsCount++;
}
}, 50);```
"**CSS/JSON/XPATH Filter**" to `.shop-sku-list-item` (to just extract the product prices and price+description)