Trying out the new Corsair SF 750 watt and I get constant in-stock hits for both newegg.com and amazon.com.
Newegg opens a browser that leads to a page saying something like "This item is actually out of stock. Would you like to 1. Auto Notify, 2. Save for later"
I've set in my .env MAX_PRICE_CORSAIR_SF="190" but with amazon I get an in stock alert and an browser launch with a "Confirm you want this item added to your cart" with a price of $277.99.
I'm also getting a false positive In Stock alert for a used 3070 on Amazon that's over the MAX_PRICE.
+1. Also getting the same false positive. fyi this is because the selector string changes for used items:
Normal:
container: 'span[class*="PriceString"]
Used:
container: 'span[class*="offer-price"]
would be nice to be able to specify both.
Wrote a quick helper function that allows you to have array's for containers (for max price). Using this in my build atm.
Just need to adjust some types. (this goes in store/includes-labels.ts)
export async function getCardPrice(page: Page, query: Pricing, options: Selector): Promise<string | null> {
const selector = query.container
if (typeof selector === 'string') {
return await extractPageContents(page, {...options, selector});
}
for (let index = 0; index < selector.length; index++) {
const cardPrice = await extractPageContents(page, {...options, selector: selector[index]});
if (cardPrice) {
return cardPrice
}
}
return null
}
And is called like (in the same file):
export async function cardPrice(
page: Page,
query: Pricing,
max: number,
options: Selector
): Promise<number | null> {
if (!max || max === -1) {
return null;
}
const cardPrice = await getCardPrice(page, query, options)
if (cardPrice) {
const priceSeperator = query.euroFormat ? /\./g : /,/g;
const cardpriceNumber = Number.parseFloat(
cardPrice.replace(priceSeperator, '').match(/\d+/g)!.join('.')
);
logger.debug(`Raw card price: ${cardPrice} | Limit: ${max}`);
return cardpriceNumber > max ? cardpriceNumber : null;
}
return null;
}
This config allows you to just do this in a store:
maxPrice: {
container: ['span[class*="PriceString"]', 'span[class*="offer-price"]', 'span[class*="a-color-price"]']
},
This should be fixed now: https://github.com/jef/streetmerchant/commit/c3beedced82141e6bbb0735b3edb7c573907aa7a
+1. Also getting the same false positive. fyi this is because the selector string changes for used items:
Normal:
container: 'span[class*="PriceString"]Used:
container: 'span[class*="offer-price"]would be nice to be able to specify both.
You think folks would be interested in used items as well?
Also, feel free to make a PR for going through a list of containers! Seems like a great addition.
had a similar request, would be really great if someone puts it together and then fixes :)
see #1500
Most helpful comment
Wrote a quick helper function that allows you to have array's for containers (for max price). Using this in my build atm.
Just need to adjust some types. (this goes in
store/includes-labels.ts)And is called like (in the same file):
This config allows you to just do this in a store: