JKCTech

Tracking Planes on Twitter

Published 3 years ago21-04-2022 - 15:44

image

In february of 2022, I came in contact with Menno Swart, a Dutch aviation journalist. He was looking for someone to build a custom Twitter bot, inspired on ElonJet. Naturally, I offered him my services.

VerstappenJet!

He told me about a Twitter account he set up, to start following Max Verstappen's private jet, the PH-DTF. With my experience in (Twitter) bots and familiarity with the ADS-B Exchange (ADSBX) API, this should not be too hard of a task.

Technical

Okay, so how do we go about tracking planes? Is this even legal??? Short answer: Yes it is perfectly legal. Most airplanes or helicopters worldwide are required to have a transponder to be able to access certain airspaces. This is obviously the case in our target airplane. These signals are very easy to intercept and interpret by anyone with about €50,- of spare cash and a few hours of free time.

Read more about tracking planes yourself here.

Challenges

In this project there we a few challenges I had to overcome:

  1. Deployment & Maintenance - I expect this project to grow and has to be well structured.
    • By building a custom Docker image, I can deploy the bot in a few minutes.
  2. API Limitations - The ADSBX API is not very well made and can get very expensive.
    • By using other data sources and predictions, I can save on requests / hour.
  3. Screenshots - The tweets should display a screenshot of the current location of the plane.
    • Selenium for Python is able to render the radar page of ADSBX.
  4. Location Resolving - The coördinates of the plane should be displayed as location.
    • LocationIQ is a great free solution for this problem.
  5. Robust - Airplane data can fluctuate or literally disappear in some cases.
    • Healthy tolerances and some catches for edge cases solved a lot of these issues.
  6. Savestates - Needs to remember the state of a plane even after a server restart.
    • A database server would be overkill so a local SQLite file is perfect for this.

Escalation

Remember where I said I expected this project to grow? After having the VerstappenJet account running for a few days, I was asked if I could make more bots...

Since I saw this coming from the start, I built the bot so that I could easily add or remove planes and Twitter accounts they are linked to:

"aircrafts": [
    {
        "icao": "486201",
        "registration": "PH-DTF",
        "start": "Verstappen's jet just took off near {LOCATION} {FLAG}",
        "end": "Verstappen's jet just touched ground near {LOCATION} {FLAG}",
        "twitter": "verstappenjet"
    },
    {
        "icao": "485920",
        "registration": "PH-GOV",
        "start": "Het regeringsvliegtuig is zojuist opgestegen rond {LOCATION} {FLAG}",
        "end": "Het regeringsvliegtuig is zojuist opgestegen rond {LOCATION} {FLAG}",
        "twitter": "hewaarisdephgov"
    }
]

Because of this, I had these bots running within a few minutes!

Newspaper

On the 16th of march, 2022, Dutch newspaper de Volkskrant published an article stating Owning a private jet is not at all private anymore. In this article, I am sadly only being mentioned as "a programmer" but nontheless I am proud of the fact stat something I made reached the news. On the 17th of march, this article made it into the sports section of the printed version of de Volkrkant.

Running Bots

I am currently responsible for the technical aspects of the following bots:

  1. VerstappenJet - Tracking Max Verstappen
  2. HeWaarIsDePHGOV - (HeyWhereIsThePHGOV) Tracking the main Dutch Government airplane
  3. KajsaJetGIV - Tracking another Dutch Government owned airplane