Archived
1
0
Fork 0
Send notifications when products become available
This repository has been archived on 2024-12-18. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
2020-12-30 15:25:36 +01:00
.gitignore Initial release 2020-12-27 18:27:07 +01:00
.pre-commit-config.yaml Initial release 2020-12-27 18:27:07 +01:00
.pydocstyle Initial release 2020-12-27 18:27:07 +01:00
config.json.example Initial release 2020-12-27 18:27:07 +01:00
config.py Initial release 2020-12-27 18:27:07 +01:00
crawlers.py Improve crawlers mapping 2020-12-30 15:25:36 +01:00
db.py Initial release 2020-12-27 18:27:07 +01:00
LICENSE Initial commit 2020-12-27 18:23:36 +01:00
main.py Improve crawlers mapping 2020-12-30 15:25:36 +01:00
notifiers.py Initial release 2020-12-27 18:27:07 +01:00
parsers.py Initial release 2020-12-27 18:27:07 +01:00
README.md Initial release 2020-12-27 18:27:07 +01:00
twitter_auth.py Initial release 2020-12-27 18:27:07 +01:00
utils.py Initial release 2020-12-27 18:27:07 +01:00

Year 2020 has been quite hard for hardware supply. Graphics Cards are out of stock everywhere. Nobody can grab the new generation (AMD RX 6000 series, NVIDIA GeForce RTX 3000 series). Even older generations are hard to find. GraphicRestock is a bot that crawl retailers websites and notify when a product is available.

Setup

Based on Debian 10:

apt install python3-selenium python3-sqlalchemy python3-tweepy firefox-esr
curl -L -s https://github.com/mozilla/geckodriver/releases/download/v0.28.0/geckodriver-v0.28.0-linux64.tar.gz | tar xvpzf - -C /usr/local/bin/
chown root:root /usr/local/bin/geckodriver
chmod +x /usr/local/bin/geckodriver

Configure

Configuration file example can be found here.

Options:

  • twitter.consumer_key: key of your Twitter application
  • twitter.consumer_secret: secret of your Twitter application
  • twitter.access_token: authentication token generated by twitter_auth.py
  • twitter.access_token_secret: authentication token secret generated by twitter_auth.py
  • urls: list of retailers web pages (they need to respect crawlers' format)
  • executable_path (optional): path to selenium driver (firefox/gecko browser)

Twitter authentication

Create a configuration file with twitter.consumer_key and twitter.consumer_secret parameters.

Then authenticate:

python3 twitter_auth.py

You will have to open the URL and authenticate:

Please go to https://api.twitter.com/oauth/authorize?oauth_token=****

Click on Authorize app. A verifier code will be shown. Go back to your console and enter the code.

Verifier:*******

Tokens will be created:

access_token = *****
access_token_secret = ****

Finally, write them to configuration file in twitter.access_token and twitter.access_token_secret parameters.

Usage

python3 main.py --help

How to contribute

First things first, check issues to ensure the feature or bug you are facing is not already declared.

Pull requests are highly appreciated.

Please lint your code:

docker run -it -v $(pwd):/mnt/ --rm debian:10 bash
apt-get update && apt-get upgrade -y && apt-get install -y python3-pip git
pip3 install pre-commit
cd /mnt
pre-commit run --all-files

Happy coding!

Disclaimer

Crawling a website should be used with caution. Please check with retailers if the bot respects the terms of use for their websites. Authors of the bot are not responsible of the bot usage.