Hey guys,
welcome to Day 47 of 100 Days of Code. Today
we're going to be building a project that I personally find really useful.
It's a Amazon price tracker project.
So I don't know about you,
but I find it much more time-efficient to go online and search for the thing
that I need rather than have to go and browse through the shops,
find the thing I want and I just find the whole shopping experience,
really tiring. Whereas with buying stuff online,
you can simply go on Amazon, type in the thing you want,
and then a few days later you'll get it delivered straight to your door.
But one of the things I've noticed with online shopping is that the prices of
things vary dramatically from day to day. For example,
one of the things I've been really tempted to buy is a instant pot.
Um, it's basically it like a souped up pressure cooker.
It can do all the normal things like cook your rice
or work as a slow cooker, or pressure-cook your meat until it's really tender,
but it can even do crazy stuff like bake a cake in the pressure cooker or make
yogurt. This is something that I've had my eye on for a while,
but I haven't really even able to pull the trigger just because I can't really
justify paying $120 for something that I can sort of do with the other things
I have, right? You can bake a cake with an oven, you can, um,
you can make everything on the stove,
but it's something that I've really been fascinated by
and I wonder if I could cut down the amount of time I spend cooking so I can do
some other things like making Programming tutorials.
But one of the things I've noticed about this item or a lot of items on Amazon
is that the price really fluctuates.
So I've been keeping my eye on this product for a while now
and I've seen it go up and down even on a day to day basis sometimes.
And there is a really cool website that I discovered called camelcamelcamel.com,
where you can simply take a product's URL,
so you select the size you want, the style, the item, whatever it may be,
and then you take the URL and you paste it into camelcamelcamel.com
and it will give you the price history of that
product. isn't that cool?
So now you can look and get actual data on how much that product costs over the
past few months or year and you can now see what was the lowest price,
what was the highest price and see how it just fluctuates almost randomly.
Now, normally I would think that on big sale days
like black Friday or prime day, that you would get the cheapest price,
but actually, that's not always the case. For example, in this case,
the cheapest price for this item happened on May 25th,
which is, I think, just a normal day.
I don't really why it got price-dropped to that amount.
So let's say that we have set a price in our mind at which point I'm ready to
make a purchase. So for me,
maybe if this item drops down from $119
um, to let's say $99, then I'll actually buy it.
Now we can actually do this using what we've learned,
and then on that day, I get an email and it tells me Instant Pot price alert,
the product price is now $99.99 below your target price, go ahead and buy now.
So this is basically the functionality that we want to build using our knowledge
of Python and web scraping.
And our Python bot is going to be the one that's going to be constantly checking
for the price. And when the time is right,
it's going to be the one that's going to alert us, using an email,
telling us to buy so that we don't have to spend every day looking at the
website,
checking the price and doing something that our Python bot could do by itself.
The idea here is our little Python body is going to have a set time, let's say
9:00 AM every day where it checks that URL that we got.
So it's going to look at a specific thing on that webpage,
which is the price. So at the moment, it's right, registering as
$119.99
and the moment when it checks that price and it sees 99.9 something,
so anything that's below our set target of a hundred dollars,
then it's going to send us an email and give us an alert.
So then we can go to the URL and purchase is that product.
Instead of having to check it out ourselves,
we now get notified when our condition is met.
As you can imagine, this is going to involve a little bit of web scraping,
where we try to get hold of the value of this price and we turn it into a number
and we check it against our target price. And then when the conditions are met,
then we use the SMTP module to send ourselves an email.
So that's the goal of today's project
and I think if you're somebody like me who buys a lot of stuff online,
then this is going to be pretty interesting for you.
And I hope that will actually come in handy at some point as well.
So head over to the next lesson and let's get started building our Amazon price
tracking bot.