A small Python watchdog script for VTOP data changes. Currently implemented only to fetch from the Marks endpoint.
- Periodically requests the VTOP marks endpoint
- Converts HTML response into structured JSON
- Stores the previous snapshot locally
- Detects changes using a hash-based comparison
You can run VTOP WatchPup in two different ways.
Steps
- Go to the repository Releases page and download the latest executable (watchdog.zip).
- Extract the downloaded archive.
- Inside the extracted folder, create the
.envfile - Open the provided
.env.examplefile and copy its contents into the newly created.envfile. - Fill in all required values in
.envby following the examples in.env.example. - Run the
helper.exefirst and get the sem id of your choice and paste it in the.env(you can change the sem id whenever you want to change the focus of your watchdog) - Run the
watchpup.exe(raise an issue if it doesn't work as intended). - Add the
watchpup.exeto your system’s background/startup processes so that it keeps running automatically (or whatever).
Steps
- Clone this repository to your own GitHub account (MIT ikr. No forking cuz gh doesnt allow cron jobs to run in forked repos).
- Open "your" repo and go to
Settings -> Secrets and variables -> Actions -> Secrets - Create new repository secrets for all required variables by referring to the
.env.examplefile:REGDPASSVTOP_SEMIDINTERVAL_SECONDSMAX_RETIRESTG_BOT_TOKENTG_CHAT_ID
- make the
.github/workflows/main.ymlfile and paste the following in it and push it to "your" repo again.
name: Watchdog job
on:
schedule:
- cron: "*/30 * * * *"
# - cron: "*/mins */hours * * *"
# the above is an example for quick config
# refer the gh actions cron docs to make your own scheduling (mine runs every 30 mins)
workflow_dispatch:
jobs:
watchdog:
runs-on: ubuntu-latest
timeout-minutes: 1
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run watchdog
env:
GH_ACTIONS: "true"
REGD: ${{ secrets.REGD }}
PASS: ${{ secrets.PASS }}
VTOP_SEMID: ${{ secrets.VTOP_SEMID }}
MAX_RETIRES: ${{ secrets.MAX_RETIRES }}
TG_CHAT_ID: ${{ secrets.TG_CHAT_ID }}
TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }}
run: python main.py
- name: Commit updated state
run: |
git config user.name "watchpup-bot"
git config user.email "bot@watchpup"
git add state/last_saved.json
git diff --quiet && git diff --staged --quiet || git commit -m "bot: update state"
git push
Note: Actions implementation saves the last state by commiting it back to the repository, so if you're insecure abt ur marks or smtg, make the repo private but also keep in mind the 2000 minutes limit on actions' private repo.
- Clone
- Dependencies:
pip install -r requirements.txt - env variables:
.env
REGD=xxxxxxxxxxxx
PASS=xxxxxxxxxxxx
INTERVAL_SECONDS =xxxxxxxxxxx # in seconds
MAX_RETIRES=10 # to skip the google captcha
TG_BOT_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxx
TG_CHAT_ID=xxxxxxxxxxxxxxxxxxxx
VTOP_SEMID=xxxxxxxxxxxxxx
You could get the VTOP_SEMID from the list by running get_semid.py
TODO:
- show actual change in the data
- logging
- automatic cookie fetching (gotta deal with captcha)
- notifying the user
- automatic sem id maybe
- extend to more than just the marks page (
grades,cgpa,calendar) - maybe make an exe
- something so the user doesnt have to run get_semid
- send the sub name instead of sub code
- error handlers
Insights into VTop auth: VIT Verse app by Divyanshu Patel
Captcha weights: VtopCaptchaSolver3.0 by Pratyush