Python script for automated free ticket buying at ikvc.slovakrail.sk/esales/search.
Script will click on buttons and fill up the input boxes for you with the predefined data in person.txt
file.
The only thing what you are required to do is to launch the script with exact stations (departure and arrival station), date and time for your train.
- python >= 3.6.7
- geckodriver >= 0.24.0
- firefox >= 66.0.2
- pip >= 19.0.3
- Initialize the environment via these commands:
# 1) python3.6 + pip3
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6 python3-pip
# 2) geckodriver
wget --verbose https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
tar --extract --verbose --gzip --file geckodriver-v0.24.0-linux64.tar.gz
chmod +x --verbose geckodriver
sudo mv --verbose geckodriver /usr/local/bin
rm --verbose --force geckodriver-v0.24.0-linux64.tar.gz
# 3) repository
git clone https://github.com/europ/zssk-ticket-automation.git
cd zssk-ticket-automation
# 4) python packages
python3.6 -m pip install -r requirements.txt
# 5) help test
python3.6 buy.py --help
- See Usage section.
Set up your account credentials in person.txt
and launch the script with the correct options (see Options section).
[-h] --departure DEPARTURE --arrival ARRIVAL --time TIME --date DATE [--verbose] [-H | -F]
Order of the options does not matter. Option values must exactly match the train details (time, date and stations). It is recommended to use verbose mode option in case of diagnostics.
- Departure station
-D "Foo"
or--departure "Foo"
- Arrival station
-A "Bar"
or--arrival "Bar"
- Departure time
-t "HH:MM"
or--time "HH:MM"
- Departure date
-d "DD.MM.YYYY"
or--date "DD.MM.YYYY"
- Help
-h
or--help
- show help message and exit
- Verbose mode
-v
or--verbose
- explain what is being done
- Headless browser mode
-H
or--headless
- not allowed with full screen mode
- web browser without a graphical user interface
- Full screen browser mode
-F
--fullscreen
- not allowed with headless mode
- web browser in full screen mode
-
Help
python3.6 buy -h
or
python3.6 buy --help
-
Usage example
python3.6 buy.py -D "Bratislava hl.st." -A "Kúty" -t "05:16" -d "18.03.2019" -v
or
python3.6 buy.py --departure "Bratislava hl.st." --arrival "Kúty" --time "05:16" --date "18.03.2019" --verbose
-
Headless mode example
python3.6 buy.py -D "Bratislava hl.st." -A "Kúty" -t "05:16" -d "18.03.2019" -H -v
or
python3.6 buy.py --departure "Bratislava hl.st." --arrival "Kúty" --time "05:16" --date "18.03.2019" --headless --verbose
-
Full screen mode example
python3.6 buy.py -D "Bratislava hl.st." -A "Kúty" -t "05:16" -d "18.03.2019" -F -v
or
python3.6 buy.py --departure "Bratislava hl.st." --arrival "Kúty" --time "05:16" --date "18.03.2019" --fullscreen --verbose
If you have purchased a wrong ticket you are able to cancel it here.
In case of any problem, please feel free to open an issue and specify the problem with detailed description.
Feel free to contribute via opening a pull request or an issue.
This project is available as open source under the terms of the MIT License.