UMobile TERER Thursday Grabber

It is Thursday again ! Every Thursday from 8am UMobile will give limited free voucher for its own subscribers. Example: Free Ice Cream, Movie Ticket, Candy, etc.

But I'm late raiser. So, the time when I awake, the deal is fully grabbed by others.

umobile

Instead of wake up that early, keep refreshing and compete with thousands of people. Why not I create a bot and do it for me? This idea came into my mind since long time ago, so this is the time to make this idea into reality.

TL;DR: Press button below, it will guide you to setup your own bot server (free).
Deploy

Source code : https://github.com/jackgoh/umobile-thursday

Getting The API Requests

proxy example image To get the requests that send from the app to the server, we need a web proxy act as a middleman, listen to all the requests. In this case, I used Fiddler web debugging proxy. But it only works on Windows tho. If you are OSX user, use Charles.

After setting up the proxy on my phone and launch the app. We can see few request are sending to mobileapps.u.com.my. Next is look for what request is useful for making the bot. In the app, navigate to rewards screen from the side menu.

Now, we got request link that retrieve all the voucher.
screenshot of fiddler found

Next, is to get the assign voucher request. On the app, simply redeem a free voucher.

Wola, we got the request link that assign the voucher to my account.

screenshot of fiddler found

List all voucher API
https://mobileapps.u.com.my/prdcampaign/api/top-deals.php?msisdn=60122345678&is_u_special=false

note: msisdn is your phone number, above is just an example

Assign voucher API
https://mobileapps.u.com.my/prdcampaign/api/assign-voucher.php?msisdn=60122345678&campaign_id=888&plan=21

note: campaign_id is the campaign id from the promo voucher, above is just an example

Simple Script

Version 1

Script above required to re-run every time before the campaign started. Here come version 2, where the script will run automatically every Thursday before campaign is started.

After exploring how to run Python script at specific time. I found APScheduler, a lightweight, in-process task scheduler.

Here is an example from the APScheduler Documentation of running jobs every Monday to Friday at 5pm:

from apscheduler.schedulers.blocking import BlockingScheduler

sched = BlockingScheduler()

@sched.scheduled_job('cron', day_of_week='mon-fri', hour=17)
def scheduled_job():
print('This job is run every weekday at 5pm.')

sched.start()

Now, I just change dayofweek to 'thu' and hour to 8. Then, paste my V1 script into scheduled job and done!

Not Yet! It will still require the PC to run 24/7 without any power outage.

Solution : Heroku

A cloud service what let you yo deploy your application and for free ! (limited)

  1. Install Heroku CLI
  2. Create a file named "Procfile" and paste the content below

    clock: python clock.py
    
  3. Deploy to heroku

    git push heroku master
    
  4. Scale up the clock process

    heroku ps:scale clock=1
    

Wola, server and script is up and running.
heroku

Then on every Thursday...
heroku

Reference :