A web scraper that extracts and analyzes customer reviews and ratings from Myntra product pages, built as part of the PW Skills Data Science program.
- Objective: Develop a web scraper to extract customer reviews and ratings from Myntra's product pages.
- Purpose: Gain insights into customer sentiments and preferences to inform business decisions.
- Outcome: A structured dataset containing product reviews, ratings, and user feedback, viewable in-browser and downloadable as CSV.
- Data Source: Myntra's official website.
- User inputs a Myntra product URL (via Flask or Streamlit UI).
- Scraper fetches and parses the webpage with
requests+BeautifulSoup. - Extracted data is cleaned (whitespace, duplicates) and structured with
pandas. - Data is presented in a user-friendly table and available for CSV download.
Note on live scraping: Myntra renders much of its review content via JavaScript and actively blocks simple scripted requests. This project's scraper first attempts a live HTML fetch + parse. If that returns no reviews (common for a JS-rendered page or a blocked request), it automatically falls back to a generated demo dataset so the full pipeline — fetch, clean, store, display, download — can still be run and evaluated end-to-end. See
scraper.pyfor extension points (internal API endpoints, Selenium/Playwright) if you want to pursue full live scraping.
| Purpose | Library |
|---|---|
| HTTP requests | requests |
| HTML parsing | beautifulsoup4 |
| Data structuring | pandas |
| Web interface (opt 1) | Flask |
| Web interface (opt 2) | streamlit |
| Production server | gunicorn |
myntra-review-scrapper/
├── app.py # Flask web app
├── streamlit_app.py # Streamlit web app (alternative UI)
├── scraper.py # Core scraping / parsing / cleaning logic
├── requirements.txt
├── Procfile # gunicorn entry point for deployment
├── setup.sh # Conda environment setup script
├── templates/
│ ├── index.html
│ └── results.html
├── static/
│ └── style.css
├── data/ # Scraped CSV output lands here
├── notebooks/
│ └── exploration.ipynb # Ad-hoc analysis of scraped data
├── tests/
│ └── test_scraper.py
├── .gitignore
└── README.md
- Python Version: 3.10
- Package Manager: Conda
- Required libraries:
requests,beautifulsoup4,pandas,Flask/streamlit,gunicorn(seerequirements.txtfor pinned versions)
git clone https://github.com/sofdev1/myntra-pulse.git
cd myntra-review-scrapperconda create -n myntra-review-scrapper python=3.10
conda activate myntra-review-scrapper(Or simply run bash setup.sh to do both steps above automatically.)
pip install -r requirements.txtpython app.pyNavigate to http://localhost:5000.
For production:
gunicorn app:app --bind 0.0.0.0:5000streamlit run streamlit_app.pyNavigate to http://localhost:8501.
- Enter a Myntra product URL, e.g.
https://www.myntra.com/tshirts/roadster/roadster-men-navy-blue-solid-round-neck-t-shirt/1234567/buy - Click Scrape Reviews.
- View extracted reviews, ratings, and summary stats in the results table.
- Click Download CSV to save the structured dataset locally.
- User Input: Myntra product URL.
- HTTP Request: Fetches the product page content.
- HTML Parsing: Identifies and extracts review sections.
- Data Cleaning: Removes unnecessary characters and normalizes whitespace/formatting.
- Data Storage: Organizes data into a structured CSV file.
pip install pytest
pytest- Customer Insights — understand customer satisfaction and areas for improvement.
- Product Development — inform design and feature enhancements based on feedback.
- Marketing Strategies — tailor campaigns to address common customer concerns.
- Competitive Analysis — benchmark against competitors by analyzing similar products.
- Sentiment Analysis: Integrate NLP techniques to gauge overall sentiment (e.g. VADER, TextBlob, or a transformer model).
- Automation: Schedule regular scraping for continuous data updates
(e.g. via
cronor Airflow). - Data Visualization: Build dashboards to visualize trends and patterns over time.
- Scalability: Extend the scraper to other e-commerce platforms.
This project is provided for educational purposes.
See LICENSE for details.