mirror of
https://github.com/clucraft/PriceGhost.git
synced 2026-07-14 16:32:14 +02:00
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:
parent
33b944588d
commit
b1b232c5b3
3 changed files with 187 additions and 2 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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 $>) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue