fix: support a.co short links for Amazon products

1. scraper.ts: Update URL match regex to accept a.co short links
   in addition to full amazon.com URLs

2. products.ts: Use voting-based scraper in confirmed-price flow
   for richer price candidate data

3. Add k8s manifests for deploy via GH Actions
This commit is contained in:
Tony Fruzza 2026-06-15 06:12:19 +00:00
parent 33b944588d
commit b1b232c5b3
3 changed files with 187 additions and 2 deletions

View file

@ -42,7 +42,7 @@ router.post('/', async (req: AuthRequest, res: Response) => {
// If user is confirming a price selection, use the old scraper with their choice
if (selectedPrice !== undefined && selectedMethod) {
// User has selected a price from candidates - use it directly
const scrapedData = await scrapeProduct(url, userId);
const scrapedData = await scrapeProductWithVoting(url, userId);
// Create product with the user-selected price
const product = await productQueries.create(

View file

@ -335,7 +335,7 @@ interface SiteScraper {
const siteScrapers: SiteScraper[] = [
// Amazon
{
match: (url) => /amazon\.(com|co\.uk|ca|de|fr|es|it|co\.jp|in|com\.au)/i.test(url),
match: (url) => /(?:a\.co|amazon\.(?:com|co\.uk|ca|de|fr|es|it|co\.jp|in|com\.au))/i.test(url),
scrape: ($) => {
// Helper to check if element is inside a coupon/savings container
const isInCouponContainer = (el: ReturnType<typeof $>) => {