AI-Enhanced E-commerce Web Scraper

Job ID: 39246736

Budget: $30 – $250 USD

⚠️ OpenAI API is required here.
To do this project, you must have your own OpenAI API key with access to GPT-4.
The key must be added to a .env file and finish the project and after that, i can use my API key

The goal of this project is to build a smart, AI-enhanced web scraper that can automatically extract product information from any product detail page on an e-commerce website or any product detail page URL, given it need to scrape the product data and return it in Excel form.
I have already built some part of it:
This tool uses OpenAI’s GPT-4 model to analyze the HTML of each page and dynamically generate the best CSS selectors to extract key product data, and further, the code extracts the details based on those selectors.

Once the selectors are generated, the scraper fetches live content from the website using Puppeteer, and saves the final product data into Excel files for structured analysis.

What I Have So Far (What’s Already Built)
1. User Input / URL Handling
Prompts the user to enter a URL of a product detail page.
2. Page Loading and HTML Extraction
Uses Puppeteer to open the page in a headless browser and retrieve the full HTML content.
3. Main Product Container Detection
Uses Cheerio to parse the HTML and analyze all <div> elements.
Applies a smart scoring system to identify the div most likely to contain product information.
It filters out unwanted sections like navbars, footers, sidebars, cookie banners, etc.
The best-scoring container is assumed to be the "main product section" and is extracted.

4. AI-Assisted Selector Extraction (via OpenAI GPT)
Sends the selected HTML snippet to OpenAI's GPT-4 Turbo.
GPT returns a JSON mapping of product attribute labels (like "Product Name", "Price", "Material") to CSS selectors.

5. Live Scraping Using Selectors
Once selectors are received from GPT, Puppeteer re-loads the original page.
The script applies each selector to extract the actual product data (text or images).
If any selectors fail, it logs the failure.
6. Saving to Excel
Uses ExcelJS to create two output files:
product_details.xlsx: Contains the selector map from GPT.
product_details_final.xlsx: Contains the actual scraped data (with clickable URLs where applicable).
Related categories: PHP JavaScript Web Scraping Software Architecture HTML