A simple tool to track prices on amazon.de.
Note: Other amazon sites, such as amazon.com, wont work. If you want to track prices on other amazon websites different from amazon.de, you have to adjust the
/py-code/scraper.pyfile. In thecheck_price()function, exchange the id for the title element as well as the class for the price element with the correct value for that other website. Moreover, the hardcoded strings inside the if statements as well as the currency sign have to be adjusted, too.Also remember that you should not make this service publicly available on your server because users can type in arbitrary inputs which are not checked properly (which can be very dangerous).
git clone [email protected]:Malte311/Amazon-Price-Tracker.git
docker-compose.yml file. Specify the correct server url and port. If you want
to get notifications via email, you need a gmail account. Set the MAIL_USER variable to the
sender email (has to be a gmail account) and MAIL_PW to the corresponding app password (not
the "normal" password!). The receiving email address can use any email provider.
version: "2"
services:
web:
image: malte311/amazon-price-tracker:latest
container_name: amazon-scraper
ports:
- "127.0.0.1:8080:80"
volumes:
- ./data/:/php-code/data/
restart: always
environment:
- SERVERURL=https://example.com/amazon-scraper
- [email protected]
- MAIL_PW=password
- [email protected]
docker-compose pull
docker-compose up -d
chmod +x cron.sh
crontab -e -u root
A cronjob every 30 minutes could look like this:
*/30 * * * * /bin/sh /var/docker-compose/amazon-scraper/cron.sh
Note that the scraper has a session limit of 5 connections per session in order to avoid
too many requests at the same time. This limit can be changed by adjusting the parameter
given to scraper.py in the file cron.sh.
Content type
Image
Digest
Size
46.2 MB
Last updated
about 6 years ago
docker pull malte311/amazon-price-tracker