Wfhsucks

07 May 2020

Intro :flashlight:

Wfhsucks is a python script designed for binus students, we all know bimay’s forum interface is slow and ineffective, so I’ve made a little program that automatically grabs all new forums, it grabs the link and also the contents. and added a checkbox on all of them to keep track of which ones I have replied to and which ones I haven’t.

Repo

The project is live on github! I’m also real proud that my friends are using it. If you’re a binus student too, go ahead and use it!

Demo

Here’s a quick demo from the repo readme.

As you can see, it automatically knows what courses to grab for you out of all the courses available in the university, this is done based on your PHPSESSID. Don’t worry, I don’t log or steal any of your data, you can check the source code for yourself to verify.

Speed

Although bimay’s loading speed has increased, it still needs to load in all the other junk data you don’t need like your name, the current time, your privilege status, etc. this script grabs only relevant data, which are the forum threads.

Wfhsucks also keeps an offline copy of the last time you downloaded the forum data, this might sound like much but it’s just the forum texts that are saved, last semester worth of forum data saved by this program was only 77KB. This way we get moar speed for less storage.

Multithreading will be added if the demand is high for even moar speed.

Journaling

Keeping track of which forums have you replied to and which ones you haven’t is even more important now as your attendance depends on it. Which is where the “Finished” column, the “checkbox” feature, the “todo list” style of approach comes into play, automatically. Wfhsucks automatically looks for your reply in every thread, if it’s found, then that thread will automatically be marked as Done, if it’s not found, then it will simple not mark it as done.

Video conference support

Since the pandemic started mid semester, things we’re forced to move online haphazardly, the video conferences were even harder to retrieve than the forum threads you have to check for them individually based on your course and classes, and they sometimes not show up until H-1. So I also scripted a way to grab all of them at once.

But now there’s an app called myclass which does the job with a better UI, so no point in me continuing this feature, although it is still in the code if anyone prefers the command line feel.

How it works

So the basic idea is that for every thread, there’s a chain of API calls that you have to do in order to get that specific thread.

The order of API calls are:

  1. Get all of your courses
    • e.g. Algo, AI, Entre, etc.
  2. Get all of the classes for each of your course
    • e.g. Algo LEC -> COMP1234, Algo LAB -> COMP1235, etc.
  3. Get threads of all topics on the course
    • each class is divided into topics, but there’s an “All topics” option, we choose this one.

Grabbing the thread data

Each thread is saved into a Thread object, consisting of it’s code, name, id, class, course, author, reply count, etc. and is stored in a global array of Thread objects.

Storing and retrieving stored data

The downloaded data is then stored with the pickle library for ease of debugging (threads are public anyways).

Next time you load the program, the pickle data will be loaded in, although new replies might come in and change the reply count data. To circumvent this, checking for new threads also updates the reply count for all the downloaded threads.

Outro

That’s all! I’m really happy that people use my code and that it actually helps them. :grin: