DEV Community

Ayesha Shaikh
Ayesha Shaikh

Posted on

๐Ÿ›’ Building a Real-Time Product Price Comparison Website Using Python

In todayโ€™s online shopping world, prices for the same product can vary across platforms like Amazon, Flipkart, Snapdeal, and Croma. To help users find the best deal, I built a real-time product price comparison tool using Python and web scraping.

๐Ÿ’ก Project Overview
The goal of my project was simple:
Allow users to enter a product name โ†’ fetch live prices from multiple e-commerce websites โ†’ display results in a clean web page.

๐Ÿ› ๏ธ Tech Stack Used
Python (main logic)
Selenium (for dynamic page scraping)
BeautifulSoup (for parsing HTML)
HTML/CSS (for front-end)
Flask (optional, for running web locally)

๐Ÿ” How It Works
User enters a product name in the HTML form.
The Python backend uses separate scripts to scrape:
Amazon
Flipkart
Snapdeal
Croma

It fetches:
Product Name
Price
Product URL
(Optional) Image

The data is shown on results.html page.
Clicking the URL takes user directly to the product listing.

๐Ÿง  Key Challenges Faced
Handling different HTML structures on each site.
Dynamic content loading via JavaScript (solved using Selenium).
Avoiding scraping blocks (using user-agent tricks and time delays).
Optimizing performance by letting users choose which websites to scrape.

๐ŸŽฏ Features
โœ… Real-time scraping (no CSV files)
โœ… Website selection filter (e.g., Amazon only, or Amazon + Flipkart)
โœ… Simple UI (HTML + CSS)
โœ… Results with name, price, and clickable product links

๐Ÿ“ธ Sample Output
A user searches โ€œRedmi Note 13โ€ โ†’ sees prices from 3 sites side-by-side โ†’ clicks the cheapest โ†’ buys it!

๐Ÿงฉ What's Next?
Add more websites (e.g., Ajio, TataCliq)
Add product images to improve UI
Host the project on cloud (Render or Railway)

๐Ÿ“‚ Codebase
Iโ€™ve structured the project into:

index.html โ€“ front end form
scrape_amazon.py, scrape_flipkart.py, etc. โ€“ individual scrapers
results.html โ€“ to display results
main.py โ€“ master controller for logic (optional Flask app)

๐Ÿš€ Final Thoughts
This project helped me learn:

Real-world Python scraping
Managing HTML forms and back-end integration
Handling edge cases and data inconsistencies
Itโ€™s a great example of applying Python to solve practical e-commerce problems.
Iโ€™m proud of how it turned out, and I look forward to improving it further!

๐Ÿ“‚ Full Project Code: View on GitHub

๐Ÿ’ฌ Have questions or want to try it out? DM me or leave a comment
โ€” Ayesha Shaikh

Top comments (0)