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
feat: add uk stores #455
feat: add uk stores #455
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wowa wowa. It looks great. Thanks for putting in this work. You're on the hunt for that card 😎
name = name.replace(/\bgraphics card\b/gi, '').trim(); | ||
name = name.replace(/\b\w+ fan\b/gi, '').trim(); | ||
name = name.replace(/\s{2,}/g, ' '); | ||
name = name.replace(/\w+-\w+-[^ ]+/g, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow 😮 Nice work!
url: 'https://www.amazon.co.uk/dp/B081265T5Z/' | ||
} | ||
], | ||
linksBuilder: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine we could use this for the other Amazon stores, but could be very wrong there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine the builder
function would work between stores, but determining the urls[].url[]
would require a manual map per region. At a minimum, the following may work (not tested it compiles let alone works):
function getAmazonQueryString(search: string, categoryId: number, includeOutOfStockId: number) {
return [
`k=${encodeURIComponent(search)}`,
'rh=' + encodeURIComponent([
`n:${categoryId}`,
`p_n_availability:${includeOutOfStockId}`
].join(','))
].join('&');
}
// Note: hardcoded amazon.co.uk details
const queryString = getAmazonQueryString('+"RTX 3080" -2080 -GTX', 430500031, 419162031);
const domain = 'www.amazon.co.uk';
const url = `https://${domain}/s?${queryString}`;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense to me. Maybe we can bring this in at a later point. Thanks for checking this out.
No problem. I don't mind it in both. |
I actually snagged a 3080 the same night/morning nvidia made the API changes but trying to do what little I can to help others get their cards :) |
We all appreciate your contribution ❤️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for all this hard work!
url: 'https://www.amazon.co.uk/dp/B081265T5Z/' | ||
} | ||
], | ||
linksBuilder: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense to me. Maybe we can bring this in at a later point. Thanks for checking this out.
Relates to #461 - merge second
This adds 10 UK stores, I've not added
maxPrice
yet but plan to do so in a future PR. andrewmackrodt/nvidia-snatcher@pr-framework-updates...pr-uk-stores