Python

Web Scrapper (Amazon Price Tracker)

A few days ago, I had to buy the Hard disk for my computer from amazon. Its price was much higher than I can afford, so decided to wait for the sale so that I can get it at a lower price. But in the daily routine, I got so busy that even sale came and go but I could not get notified about it, especially about the product that I was willing to buy. On that day I decided to do a small web scrapper project Python so that I can get notified in my inbox when the price falls below my expected price.

Read more..


Such is the origin of my project idea, so without wasting much time let’s get into it.

Project Description 

The idea of the project is very straight forward: Input the URL of the product you want to buy. Scrap the HTML of a webpage of that product and extract useful data like product title, price, in stock, etc. If the product price falls below our expected price, it should send an email notifying that price has fallen down and now you can buy it.

To make such a beneficial task possible, we have used Python as it has all the libraries required to perform this task.

Python modules used in this project:  

request: request is a module that allows you to send the HTTP request without manually adding a query string to your URL. It is extremely easy to use. Request has one special method called request.get (url_of_your_choice) which returns the response object. eg. r = request.get(“https://www.amazon.in/dp/B00UJCZ9K0”,headers = headers), where headers can be obtained by simply searching for ‘My user agent’ in Google.

We use response.txt to make the content human-readable stored in the response object. We get all the information we needed from this object.

bs 4: bs4 stands for Beautiful Soup version 4. It is a library that makes it very easy to scrap information from web pages. It is popular for HTML and XML parsing, providing a Pythonic approach for iterating, searching, and modifying the parse tree. By using bs4, we will find the exact information about the product using find() method.

smtplib: smtplib is a module that defines an SMTP client session object which can send email to any machine with SMTP or ESMTP listener. We will use smtplib to send mail notifying the user regarding the price changes.


Latest projects on Python

Want to develop practical skills on Python? Checkout our latest projects and start learning for free


Project Implementation

Start the project by installing and importing the above libraries: request, bs4, smtplib.

Follow the below steps to complete the project.

  • Create a variable named url and assign it the url you want to examine.
  • Store the response returned by get method in object say r. It has all the necessary data we need.
  • Pass this r object to Beautiful Soup and store parse tree generated by Beautiful Soup in soup object.
  • The price of the product is given under the id of priceblock_ourprice in the HTML of the webpage. So we’ll use it to extract the price of the product. Extract price by using soup.find().getText() method. But this price is in string format, to convert it in float type, just cast it to float.
  • Now decide your target price of that product and whenever the price falls below your designed price, it should fire an email.
  • Let’s take look at sending an email. Create a connection between gmail and our machine using smtp.gmail.com and port number 587. Using the login method and login with senders credentials. Send the email with cool subject and body by specifying the sender and receiver in sendemail() method.
  • Now if the product price becomes less than our designed value, it will notify us via email.
  • You can run such web scrapper on the cloud to continuously monitor the data about the amazon products (or any other e-commerce site also).

Software requirements: Text editor and Python3.

Programming Languages and modules: Python, request-module, bs4- module, smtplib.


How to build Python projects Did you know

Skyfi Labs helps students learn practical skills by building real-world projects.

You can enrol with friends and receive kits at your doorstep

You can learn from experts, build working projects, showcase skills to the world and grab the best jobs.
Get started today!


Kit required to develop Web Scrapper (Amazon Price Tracker):
Technologies you will learn by working on Web Scrapper (Amazon Price Tracker):
Web Scrapper (Amazon Price Tracker)
Skyfi Labs Last Updated: 2021-07-05





Join 250,000+ students from 36+ countries & develop practical skills by building projects

Get kits shipped in 24 hours. Build using online tutorials.

More Project Ideas on Python

Face recognition using Raspberry Pi
Linux Based Medication remainder
Ultrasonic beats player
Automated door opener with lighting control
IoT based theft detection using Raspberry Pi
Wheelchair wih safety system
Raspberry Pi osilloscope
Health monitoring using Raspberry pi
Automatic Green house system
Wheel combined robotic suspension system
Bank Account Management System using SQL and C++
Content Aggregation Project using Python
URL Shortener
Develop An Expense Tracking System using Python
Mp3 Player using Python
Simple Chat room using Python
Folder sorter according to files extensions using Python
Batch Image editor using Python
Password Generator and Manager using Python
Web Scrapper (Amazon Price Tracker)
Bird Species detection using Python
Develop An Online CV Builder using Python
Online Job Portal using Python and SQL database
Social Media Site using Python (Django)
Driver Drowsiness detection using Python
Traffic recognition using python
Website Blocker using python
Speech Emotion Recognition using Python
Speed Typing test with Python
Gender and Age Detection using Python
Pharmacy management using Python
Virtual Notebook - Python project
Find My Professor
How to Develop a TIC TAC TOE game using Python
Admission tracking system
Assignment submission system using Python
Smart feedback system using Python
Data collection tool using Python
Language translator and converter using Python
Automatic Brand LOGO detection using Python
Rock, paper, scissor game using python
Youtube video downloader with Tkinter UI python project
Instagram bot using python
Desktop notifier app using python
Spotify song downloader using python
Jarvis Personal assistant using Python
Sound processing python project
Develop a Supermarket Billing System with Python
Desktop voice assistant project

Subscribe to receive more project ideas

Stay up-to-date and build projects on latest technologies