FlightRadarAPI icon indicating copy to clipboard operation
FlightRadarAPI copied to clipboard

Functional extension to follow one particular flight by FlightRadar24 id

Open DaPheles opened this issue 1 year ago • 3 comments

First of all... thank you for offering that nice API for FlightRadar24, it's been fun playing with it!

I've started a project that will soon be public. I had to patch a few lines in your api.py code to enhance functionality.

With the patch I am able to follow one particular flight by using the FlightRadar24 identifier: self.fr_api.get_flights(bounds=self.bounds, flight_id=self.flight_id) There will be just one result with the selected id.

Please consider merging it into your code!

Best regards, André

DaPheles avatar Sep 17 '24 22:09 DaPheles

Hi @DaPheles !

First, I apologize for the delayed response and thank you for the contribution!

However, I tested the feature and it seems that it’s not working.

flights = fr_api.get_flights("GLO")  # 53 flights
target_id = flights[0]  # Take the first one

flights = fr_api.get_flights(flight_id=target_id)  # Returns 1500 flights

Could you please check this?

JeanExtreme002 avatar Sep 24 '24 14:09 JeanExtreme002

Hi @JeanExtreme002,

great hearing from you!

And sorry for the confusion. I was just debugging the behavior and it seems a little different.

The new request_params["selected"] in your api.py get_flights() function does make sure the selected flight is actually in the result list. Without bounds, you'll typically receive the maximum count of 1500 flights. If the flight_id you're looking for is not among those flights, the particular selected one is added, so you''ll receive 1501 flights in this case.

If you check the response.get_content() JSON response, you'll get an additional structure like: 'selected-aircraft': {}, 'selected': {'374057f8': {'matched-filter': True, 'matched-settings': True}}

Without the selected option, it would be hard to locate one particular flight in the masses available. I used to create a bounds rectangle in the expected local flight location neighborhood, so I generally end up with just one result for better runtimes.

You may check out my FlightTracker. If you click one flight by middle mouse button, a FollowFlight app will open and follow the flight to its destination. It makes use of this patch and I used it in that way for months.

Best regards, André

DaPheles avatar Sep 24 '24 20:09 DaPheles

Ping

DaPheles avatar Oct 23 '25 20:10 DaPheles