This project is a browser extension that allows users to highlight a product on any webpage, right-click, and search for similar products on Amazon using a custom-built Python API. The results are displayed in a new window.
- Highlight a product name on any webpage and search for similar products on Amazon.
- Display search results in a new window with product details including title, price, rating, and image.
- Allow users to refine their search with additional parameters: product name, maximum price, limit, and sorting options.
- Python 3.x
- Flask
- BeautifulSoup
- Requests
- Flask-CORS
- Docker (optional)
-
Clone the repository:
git clone https://github.com/yourusername/amazon-product-similarity-extension.git cd amazon-product-similarity-extension
-
Set up the Python environment:
python3 -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate` pip install -r requirements.txt
-
Run the Flask API:
python main.py
Alternatively, you can run the application using Docker:
-
Build the Docker image:
docker build -t amazon-extension .
-
Run the Docker container:
docker run -p 5000:5000 amazon-extension
- Load the extension into your browser:
- Open your browser's extension management page (e.g.,
chrome://extensions
for Chrome). - Enable "Developer mode".
- Click "Load unpacked" and select the directory containing the extension files.
- Open your browser's extension management page (e.g.,
- Highlight the product name you want to search for on any webpage.
- Right-click and select "Search Similar Products".
- A new window will open displaying similar products from Amazon.
Fetch similar products from Amazon.
Query Parameters:
product_name
(str): Name of the product to search for (required).sort_by
(str): Sorting option (default: 'Featured'). Options include:- Featured
- Price: Low to High
- Price: High to Low
- Avg. Customer Review
- Newest Arrivals
- Best Sellers
limit
(int): Number of products to fetch (default: 10).max_price
(float): Maximum price of products (optional).
Example Request:
curl "http://127.0.0.1:5000/scrape?product_name=laptop&sort_by=Price%3A+Low+to+High&limit=5&max_price=1000"