Skip to content

Instantly share code, notes, and snippets.

@oscardoudou
Last active April 5, 2022 22:46
Show Gist options
  • Select an option

  • Save oscardoudou/52928c33cce3a867bf6e3777694b8976 to your computer and use it in GitHub Desktop.

Select an option

Save oscardoudou/52928c33cce3a867bf6e3777694b8976 to your computer and use it in GitHub Desktop.
Fifa world cup 2022 ticket application progess checker (phase 2)

Fifa world cup 2022 ticket application progess checker

Turns out the script is not needed. As the progress is not increasing step by step, it might notify you click enter say at 20%. In my case, it stucks at 13% and then shows Enter page directly after god know some time. For those who don't want to check progress page regularly.

Check the progress from chrome log and notify the progess in mac notification center.

Not sure why mine is stuck at 13% for quite some time. Let me if this is normal.

image

Usage

  1. create symlink for osanotify(will be referenced in main script) side note: system in awk doesn't recognize function, so have to make this script
ln -sfv ${PWD}/osanotify.sh /usr/local/bin/osanotify
  1. add chrome to ~/.bashrc
chrome () 
{ 
    /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir="/Users/$(whoami)/Library/Application Support/Google/Chrome" --enable-logging --v=2
}
  1. start chrome from terminal
chrome
  1. start listening on progress DOM run following in chrome console while with your application progress page opened
# log the progress to chrome log every second
var intervalId = setInterval(()=>console.log(`ticket_application_progress: ${progress}`), 1000)
# clear it when necessary
clearInterval(intervalId)

log would something like this

13805:259:0405/132641.428773:INFO:CONSOLE(1)] "ticket_application_progress: width: 13%;", source:  (1)
  1. kick off main script
./ticket_application_progres.sh

you should see mac os notification everytime progress moving forward 5. let me know if this works or stuck at somepoint or if there is an easier way to achieve this

#!/bin/bash
osascript -e "display notification \"$1\" with title \"$1\" "
#!/bin/bash
chromePath="/Users/$(whoami)/Library/Application Support/Google/Chrome"
chromeDebugLog=${chromePath}/chrome_debug.log
tail -f "$chromeDebugLog" |
awk -F'"' \
'BEGIN {PREV=""}
{
if ($2!=PREV)
{
if($2) {
content=substr($2,0, 7)
if("ticket_"==content){
print $2;
PREV=$2;
P=substr($2, length($2)-4, 4);
system("osanotify " P)
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment