Adam's blog: Buying tickets from Ticketmaster

16 Oct 2022, 1344 words

A few days ago, I wanted to buy a ticket to a concert. A relatively simple task, as you need only to act quickly enough and find your place as soon as the sale opens. Little did I know that since I bought tickets last time, the Ticketmaster introduced some “upgrades”.

Ticketmaster(.cz ≠ .at ≟ .eu)

I believe, that I do not need to introduce you to the Ticketmaster, as it has quite a reputation. The sale was supposed to begin at 10:00, so at about 9:40 I began to look for the event. The link at the artist’s web page took me to the ticketmaster.at (which makes sense as the event takes place in Austria), where I tried to log in with my Ticketmaster account. When filling the username and password through my browser extension, the login has failed, so I opted for copying the credentials from my backup password manager. This resulted in another fail. To check the validity of saved information, I have tried to log in into ticketmaster.cz, which was successful. It would seem that the Ticketmaster does not share the information between its instances in different countries, even if both countries are part of the EU.

Now, at 9:53, there was no time to research what exactly is happening. Instead, I have created a new account at ticketmaster.at using autofill of the same credentials as for ticketmaster.cz. After this, I was met with a reassuring message on a white background.

“You will be automatically placed in the queue when the sale begins”

The interesting this about this was, that now I was redirected to ticketmaster.eu, so the Ticketmaster does share account data between its national instances in the end?

Smart Queue

“The Latest Way to Shop for Ticket to Popular Events”, said Ticketmaster. According to them, it is a form of ticket bots prevention. Very well, I am intrigued how this will go. The 10:00 strikes about … now!

Queue with more than 25 thousands people before me about 20 minutes after the start

As soon as the clock hit the 10:00 mark, the page refreshed and showed me my place in the smart queue - I was nearly 30 thousandth person to be waiting for the tickets. This will take a while. Why not use the time to learn something more about the new queuing system? Let’s see what Ticketmaster recommends me “For a smoother shopping experience…”:

  1. “Sign in to your Ticketmaster account at least 10 minutes in advance of joining the Waiting Room. This will speed up your purchase later.”
  2. “Confirm you have a valid form of payment in your account with current email and billing information. This will make checkout a breeze.”
  3. “If you need to step away, turn up the volume on your device so when it’s your turn, you hear the Queue notification bell.”

Because I created my Austria-based Ticketmaster account only about 7 minutes before the sale has started, this may explain why I received such a high queue position. Well, nothing I can do about it now – but I can prepare for the second point by filling in all my info (which I have already filled in my Czech-based account).

Smart Queue with notifications

It had seemed that the queue will take a few hours, and I certainly did not intend to stare at the screen all that time. But leaving would mean that I may miss a crucial time when to return to the keyboard. If only there was some way to notify me when only a certain number of people is left before me…

The easiest way would surely be to inject a script through a developer tools, which would parse the number of people left and call a HTTP endpoint. But I did not intend to risk being detected as the bot by merely opening the browser’s developer tools, let alone by injecting a new script into the page.

I had to opt for something less invasive – something that would read the text from the screen for me. As it turned out, there exists a package for an OCR software called tesseract, which takes a single image as an input and a single text file as output. Furthermore, because the number would (hopefully) not grow and consequently nor would the size of the text, I could be able to manually record the dimensions and coordinates of the text for cropping unnecessary information out of the picture.

After cropping, what I was left with was a black text on a white background, which almost seemed like it was made with people using OCR on screenshotted web browser in mind! After a bit of fiddling with Bash, I came up with a script that will:

  1. send me periodical updates twice a minute
  2. send me a priority message once less than 500 people is in front of me
#!/bin/bash
set -Eexuo pipefail

trap "while true; do bash -c 'notif --important FAIL' && break; sleep 2; done" ERR

wd="$(mktemp -d)"
cd "$wd"
touch last.txt

(
    while true; do
        gnome-screenshot -f screen.png
        convert screen.png -crop 420x38+2090+568 screen.crop.png
        tesseract -l eng screen.crop.png screen.txt
        count="$(egrep 'ahead of you: ([0-9]+)' screen.txt.txt | sed -Ee 's/^.*:\s([0-9]+).*?$/\1/')"
        lastCount="$(cat last.txt)"

        if [ "$count" != "$lastCount" ]; then
            if [ "$count" -lt 500 ]; then
                important="--important"
            else
                important=""
            fi
            notif $important "Queue: $count"
            echo "$count" > last.txt
        fi
        sleep 35 || break
    done
) && true

rm -r "$wd"

And how did it turned out? I think pretty great, as evidenced by my message history.

Messages sent by the notification script

Here comes the bell

After about 2 and half hours of waiting, the time to act was now. It was my turn to buy the tickets – all I had to do was to select how many of what type of tickets I wanted, press the “Search for tickets” button and … “There was an error while processing your request”. Wait, what? I have waited more than 150 minutes just to fail? What about a single ticket of any other category? Also fail. Why? What was happening?

At this point I had nothing to loose, so I opened the browser developer tools and looked at the network section. Whenever I pressed the button, the response for the subsequent HTTP request would be simply blocked with a status code of 403. The system things that I am a bot. Why does it think that? I really don’t know, as nothing I have done should differ from a normal user behavior. Maybe because I have registered a new account, as they suggested in their 2nd point, only 5 minutes before the sale has started? By the way – the bell mentioned in the 3rd point never rang.

Desperately, I have refreshed the page and was greeted with a new place in the queue – more than 40 thousands.

Do I have the tickets?

Yes! With a great foresight, my girlfriend has joined the queue at about 10:05 from her iPhone without any prior registration and has successfully completed the whole process. Needless to say, if there was any alternative to the Ticketmaster, I would gladly use it. But with the current state, if I want to get to the event, I have no other option.