The Tims NHL Hockey Challenge is an game on the Tim Hortons mobile app where users are given 3 lists of hockey players everyday, from which they select a player from each list. If a selected player scores that day, the user earns points that are redeemable for Tim Hortons goods!

This code automates the daily player submissions using a ranking system based on stats pulled from the following NHL APIs:
The Tim Hortons app does not have a public API. Therefore, you will need to remote debug your android device to obtain your account's refresh token and client ID:
-
Setup remote debugging by following these instructions.
-
Once your phone is connected, open the Tim Hortons app on your phone and inspect the respective tab on your computer, which should open a DevTools window. Install the Tim Hortons app if you haven't already.
-
Sign out of the app if you aren't already.
-
Watch the list of network activity names in the Network tab in the DevTools window as you sign into the app.
Filter for "cognito" and open the first cognito-idp.us-east-1.amazonaws.comactivity and record the following values:user-agent(found in the Headers tab)ClientId(found in the Payload tab)RefreshToken(found in the Preview or Response tab)
Then use the search function (ctrl+f) to search for
thLegacyCognitoIdand record the value asUSER_ID. -
Create a
.envfile in the root directory of this repo and insert the values you found like so:USER_AGENT=___ CLIENT_ID=___ REFRESH_TOKEN=___ USER_ID=___ -
Enter the Tims Hockey Challenge and complete the setup if you haven't already done so (may include a simple math question and contest display name prompt).
- Install Python3.
- Install the required dependencies:
pip install -r requirements.txt. - Run
python autopicker/main.pyto start automatic player submissions.
- Open Task Scheduler and select Create Task.
- Under the Security options in the General tab, select the option Run whether user is logged on or not and check the Hidden box.
- In the Triggers tab, add a new trigger that you want. For example, you can select On a schedule and have the script run every day at a chosen time.
- In the Actions tab, add a new action and insert the path of the
python.exe. Then, insert the absolute path of this repo in the Start in input. - In the Conditions tab, check the box that says Start only if the following network connection is available.
When autopicker/main.py is run, the logs directory is populated with various resources:
logs/autopicker.log: contains runtime information/error messages for debugginglogs/history.json: contains the pick submission results history of the connected Tim Hortons app accountlogs/picks.json: contains the latest picks that the code submittedlogs/rankings_set1.xlsx,logs/rankings_set2.xlsx,logs/rankings_set3.xlsx: contains the ranking data of each of the 3 selection lists used to choose the top hockey players from the latest submission round