Skip to content

Getting Started

Mikkel Rask edited this page Mar 1, 2021 · 7 revisions

Getting started

Before installing make sure Google Chrome, chromedriver, python and pip installed and in PATH.

Ubuntu-based systems

Install python and pip

sudo apt update
sudo apt install python3 python3-pip

Install Google Chrome

sudo curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
sudo echo "deb [arch=amd64]  http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
sudo apt-get -y update
sudo apt-get -y install google-chrome-stable

Install chromedriver

wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo mv chromedriver /usr/bin/chromedriver
sudo chown root:root /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver

Arch based systems

With paru: paru python3 python3-pip google-chrome chromedriver

With yay: yay -S python3 python3-pip google-chrome chromedriver

Install tingfinder (Linux/macOS)

Open up a terminal and paste in the following and hit enter

git clone https://github.com/mikkelrask/tingfinder.git
cd tingfinder
chmod +x install.sh
./install.sh

This will install tingfinder and it's python dependencies through pip.

Install (Windows)

Download the latest standalone version from the releases and follow the install instructions to that specific release. Note that the standalone is modified to look only in it's folder for both the data folder, and search agent CSV, and can therefor not be run by i.e cron.

  • Unzip the release file
  • Change your search terms in tingfinder/tingfinder.csv
  • Install requirements
    • py -m pip install -r requirements.txt
  • Run the script with python
    • py tingfinder/tingfinder.py

Configure

  1. Open up config.yml file located in the $HOME/.config/tingfinder directory, in a text editor. (i.e with nano $HOME/.config/tingfinder.config.py)
  2. Fill out the fields in the dictionary with your postal_code and search_radius to activate search radius. Defaults are set to Copenhagen, Denmark and a search radius of 100km.
  3. Open the search-agent.csv located in the $HOME/.config/tingfinder directory in a text editor. (i.e with nano $HOME/.config/tingfinder/search-agent.py)
  4. Put in all of your search terms and min/max price in the following format "seach term",min-price-in-DKK,max-price-in-DKK example: "star trek communicator",200,500

Search

With the script correctly configured you can run the script manually simply by typing tingfinder.py in a terminal. A search will start and show you the output in the terminal, and still push notifications if new lots are available.

If you want to save that output to a file instead, simply use *nix's builtin function for output redirection: I.e: tingfinder.py > your-output-file.log

Automation through cron or scheduled tasks

If you want to automate the process, you can do so with a so called "cron job". Cron is a service that is run in set intervals, and will execute the command you give it.

Cron is automatically installed on most systems - to see if you got it installed open up a terminal and type whereis cron. If you got an output, you got cron.

Edit your cron jobs

  • Type crontab -e in your terminal
    • This opens up the default cli-based text editor. This can be nano, vi(m) or similar depending on your system.
  • Paste in following line accordingly */30 * * * * /usr/local/bin/tingfinder.py > /PATH-OF-YOUR-DESIRE/output.log where PATH-OF-YOUR-DESIRE is the directory path to where you want to save your output file.
  • Save and exit accordingly. Cron should confirm with
    • crontab: installing new crontab.