Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functional extension to follow one particular flight by FlightRadar24 id #86

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DaPheles
Copy link

@DaPheles DaPheles commented Sep 17, 2024

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é

@JeanExtreme002
Copy link
Owner

JeanExtreme002 commented Sep 24, 2024

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?

@DaPheles
Copy link
Author

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é

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants