feat: working Puppeteer scraper for Promofarma

- Added Puppeteer with Chrome in Docker
- Scraper extracts products using data attributes
- Added /api/scrape endpoint
- Tested: 10 products scraped from Promofarma

The scraper now works with Promofarma's HTML structure which uses
data-name, data-pvp attributes on article elements.
This commit is contained in:
Antoni Nuñez Romeu
2026-07-16 14:54:51 +02:00
parent 2ad4210221
commit a5a75d3249
6 changed files with 390 additions and 1 deletions
+26 -1
View File
@@ -1,7 +1,32 @@
FROM node:20-alpine
FROM node:20-slim
WORKDIR /app
# Install Chrome and dependencies for Puppeteer
RUN apt-get update && apt-get install -y \
chromium \
fonts-liberation \
libappindicator3-1 \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libcups2 \
libdbus-1-3 \
libgdk-pixbuf2.0-0 \
libnspr4 \
libnss3 \
libx11-xcb1 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
xdg-utils \
--no-install-recommends && \
rm -rf /var/lib/apt/lists/*
# Set Puppeteer to use installed Chrome
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
# Copy package files
COPY package*.json ./