How ash04-creater/amazon-flipkart-price-comparison-engine works
Project type and purpose
• This is a small Python‐based command‐line utility (“engine”) whose purpose is to scrape product data and prices from top e-commerce sites (Flipkart and Amazon) and generate comparison spreadsheets. It is neither a multi-tier web app nor a microservice architecture—rather a simple CLI tool with two main modules for product‐spec comparison and price comparison.
File structure
• Top-level files only:
• README.md – project overview and usage
• product_comparator.py – module to compare product specifications on Flipkart
• price_comparator.py – module to compare product prices on Amazon and Flipkart
• images_used/ – screenshots for documentation
• No subdirectories, no database, no server or build scripts. All logic lives in those two Python scripts.
Key insights from the README
• product_comparator.py:
• Takes one or more Flipkart product URLs
• Scrapes specifications (e.g., screen size, RAM, CPU)
• Produces a tabular datasheet (e.g., CSV or Excel)
• price_comparator.py:
• Takes a product name
• Searches Amazon and Flipkart for top-5 matches
• Scrapes prices and product links
• Outputs a datasheet with price comparisons
Main components
a. User (CLI)
b. CLI “Controller” – dispatches to either:
• ProductComparator module
• PriceComparator module
c. Scraping & Parsing Layer:
• HTTP client (requests/urllib)
• HTML parser (BeautifulSoup or similar)
d. Data Aggregator:
• Extracts fields into structured form
• Merges multi-product or multi-site results
e. Output Generator:
• Writes out CSV/Excel (e.g., pandas or csv module)
f. External Services:
• Flipkart (for specs and/or prices)
• Amazon (for prices)
Relationships & data flow
1. User invokes script → CLI Controller
2. CLI Controller parses arguments → selects module
3. Module issues HTTP requests to external site(s)
4. Response → HTML parser → Data Aggregator
5. Aggregated data → Output Generator → Spreadsheet file
6. Final file path reported back to the user
Architectural patterns & design principles
• Clear separation of concerns:
• CLI argument parsing vs. scraping logic vs. output formatting
• Pipeline pattern:
• Input → Fetch → Parse → Aggregate → Write
• Dependency on external services is isolated in the scraping layer.
Technologies & libraries
• Python 3.x
• requests or urllib for HTTP
• BeautifulSoup (bs4) or lxml for HTML parsing
• csv or pandas for data‐sheet generation
• argparse or click for CLI