I finally got my PS5!!!
Tags: showdev, javascript, programming
Published: 2021-07-23 08:13:20

In my previous post I wrote about how I used my super-duper programming skills to write a bot that would scrap all the polish online shops looking for the new and shiny PlayStation 5.

{% link https://dev.to/humberd/how-i-wrote-a-ps5-hunter-bot-in-7-hours-6j4 %}

Now I can announce that I FINALLY BOUGHT A NEW PS5!!!

![screen of my new and shiny PlayStation 5](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i7pcb4n093rl5p95hssh.jpg)
 
Thank you bot, you did a good job :D
.
.
.
.
.
.
.
That would have been a pretty good scenario, only if the reality hadn't verified my plans :/

## Problems

The first major problem was that my bot only detected changes in specific sections of the web page. I didn't know how would the shop look like when the PS5 is available, because it could have some more shiny decorations to encourage people to buy it instead of a regular product details. So my approach was not to look for keywords, but rather the lack of them. This means if a word "unavailable" was no longer there my bot happily sent me a mail that something changed. Unfortunately, this was a very naive approach :(

![list of false positive mails](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ekoeebxnk1anymflh7gz.png)

In the image above there is a list of mails I received in February. We can see that on average I got 1 mail a day. That would have been a quite impressive achievement, but unfortunately, they were all false positives. I checked every one of them and I can divide them into 2 categories:

### Shop changes

Half of the mails were regarding to changes the shop made deliberately. They either removed the PS5 for some reason or added a new unrelated item to a list of items related to "PS5" phrase triggering my change detection for list count.

### Errors

Another half of the mails were errors. Every a couple of days, at night, I received that something has changed only to later look at the logs and see that the shop showed a 500 error page, which probably indicated that they were deploying a new version. For example from the mails I tell that https://www.euro.com.pl/ made a deploy every 2 weeks on Thursday at 5 in the morning. They only changed this pattern and deployed on Wednesday, because on Thursday was New Year's Eve.

I was so fed up with the constant false positives that I turned off the bot at the beginning of March.

## Global chip shortage

Another reason I didn't grab a PS5 was that the shops didn't even have them in stock. The global chip shortage was way more severe than I anticipated and even if I have found the console it would have been more expensive, which wouldn't make sense to me, because this bot was a solution to buy them cheaper than from scalpers.

## The rush

One day, during a windy February day I was in the office writing some very sophisticated code when I received an intriguing email saying that Media Markt listing has changed. So being a very responsible engineer and a Team Lead I naturally I dropped everything and took a look at the site 🙂 And... the PlayStation WAS AVAILABLE. WOW!!

Unfortunately, there was a problem. It was displayed as available, but not for sale online, which meant I would need to get physically to the shop. I looked at the map and the shop was on the other side of the Warsaw. I immediately jumped out of the office and after 3 minutes I was already in a bus. 

45 minutes later I was there, looking at the building, which in the next couple of minutes could have fulfilled all my desires that have been building up for the 2 previous months. I rushed to the shop, asked the guy that worked there to give me my precious (muahauhau) aaand... My adrenaline dropped to 0 and a willingness to breath to about 20% (part of my brain was still functioning correctly 😀) when I heard that sure, the console is in the building, but could be sold only on leasing to a company 😐.

Devastated, I quietly returned to the office, continued writing a "very sophisticated code" and from time to time kept thinking how my life would have looked like if back then I had grabbed my greatest desire.

## How did I buy it then?

Oh well... I received a mail from a pricing comparator site https://ceneo.pl, which told me that the price has dropped. 

I bought it for 2750 PLN (710 USD), but it also included Spider-Man: Miles Morales valued at 350 PLN, which I was willing to buy separately anyway. In result the net value of the console was 2400 PLN (620 USD), which compared to an MSRP price of 2300 PLN (590 USD) is a pretty good deal.

## Conculsion

By investing more time I could have reduced the amount of false positives, but on the other hand it wouldn't necessarily mean I would have grabbed the console due to global chip shortage.

At the end of an article it would be cool to say that I learned a lot in this project. The reality is that I learned pretty much nothing. It took me 1 day with a tech stack I already knew, so there was no area I could improve. Nonetheless, the time spent is an experience gained.