This script will send you an email when the price for specific items you followed on Amazon drops beneath a certain price you set.
You can parse the price without Amazon API !
pip install -r requirements.txt
Then you need to edit the config.json first,
1. email → sender, sender-password, receivers
2. amazon-base_url (change to amazon store where your target item is)
3. item-to-parse (add item id which you want to track)
After installed required package and finished config.json, you can use it by
python crawler.py
1. Google Mail
Put config.json in same folder as code, or you can configure the path by '-c' argument
Sleep time between each check (seconds)
- sender : sender Google mail account
- sender-password : sender Google mail account password
- receivers : receivers' mail, you can add as much as you want
Remember to close the setting of Less Secure Apps
Get url from your amazon of you location. For example : URL of Amazon JP is https://www.amazon.co.jp/dp/
You need to put item ID and expected price here.
Search your item and go into the item page.
You can find the item id in the url
There may be two problem of it.
1.Your ip was banned by Amazon
Change your IP or wait for unban.
2.The item selector changed
Search your item and go into the item page.
Use your mouse and right click on the price text and choose inpector
You will see the selector id of price text in the inspector window
Server will send 3 kinds of mails to receiver
-
Server working notification mail
Send every day for reminding you server still working
-
Server shutdown notification mail
Server shutdown mail for reminding you to restart. Most reason of the problem is the server banned by Amazon. You can restart it after 30 minutes.
-
Price dropped mail You will received price alert mail while your target item below the price you set.
This code use some skill preventing banned by Amazon. However, the best interval time between each time of price checking is around 15 minutes.
Using Google smtp server to send mail, you need to enable less secure apps in your account for using it.
Python 2
lxml
json
requests
smtplib
MIMEText
ConfigParser, argparse, urlparse
1. Direct message notification via Twitter