Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flightradarapi

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flightradarapi

SDK for FlightRadar24

  • 1.3.26
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
274
increased by18.1%
Maintainers
1
Weekly downloads
 
Created
Source

FlightRadarAPI

Unofficial SDK for FlightRadar24 written in JavaScript with NodeJS.

If you want to use the data collected using this SDK commercially, you need to subscribe to the Business plan.
See more information at: https://www.flightradar24.com/terms-and-conditions

Python Package Pypi License Python Version Npm Downloads Frequency

Installing FlightRadarAPI:

npm install flightradarapi

Basic Usage:

Import the class FlightRadar24API and create an instance of it.

const { FlightRadar24API } = require("flightradarapi");
const frApi = new FlightRadar24API();

Getting flights list:

let flights = await frApi.getFlights(...);  // Returns a list of Flight objects

Getting airports list:

let airports = await frApi.getAirports(...);  // Returns a list of Airport objects

Getting airlines list:

let airlines = await frApi.getAirlines();

Getting zones list:

let zones = await frApi.getZones();

Getting flight and airport details

You can also get more information about a specific flight such as: estimated time, trail, aircraft details, etc.

let flightDetails = await frApi.getFlightDetails(flight);
flight.setFlightDetails(flightDetails);

console.log("Flying to", flight.destinationAirportName);

Or get more information about a specific airport such as: runways, weather, arrived flights, etc.

let airportDetails = await frApi.getAirportDetails(icao);

Arrivals and departures can have a limit flightLimit (max value is 100) to display. When you need to reach more than 100 flights you can use additional parameter page to view other pages.

Get flights above your position:

The getBoundsByPoint(...) method has parameters latitude and longitude for your position and radius for the distance in meters from your position to designate a tracking area.

// Your point is 52°34'04.7"N 13°16'57.5"E from Google Maps and radius 2km
let bounds = frApi.getBoundsByPoint(52.567967, 13.282644, 2000);

let flights = await frApi.getFlights(null, bounds);

Filtering flights and airports:

The getFlights(...) method has some parameters to search for flights by: area line, bounds (customized coordinates or obtained by the getZones() method), aircraft registration or aircraft type. See the example below:

let airlineIcao = "UAE";
let aircraftType = "B77W";

// You may also set a custom region, such as: bounds = "73,-12,-156,38"
let zone = (await frApi.getZones())["northamerica"];
let bounds = frApi.getBounds(zone);

let emiratesFlights = await frApi.getFlights(
  airlineIcao,
  bounds,
  null,
  aircraftType,
);

There are more configurations that you may set by using the setFlightTrackerConfig(...) method. See the method documentation for more information.

Getting airport by ICAO or IATA:

let luklaAirport = await frApi.getAirport("VNLK", true);

Getting the distance between flights and airports:

The Flight and Airport classes inherit from Entity, which contains the getDistanceFrom(...) method. That method returns the distance between the self instance and another entity in kilometers. Example:

let airport = await frApi.getAirport("KJFK");
let distance = flight.getDistanceFrom(airport);

console.log("The flight is", distance, "km away from the airport.");

Downloading Flight Data

Note: This requires a premium subscription and for you to be logged in.

let historyData = await frApi.getHistoryData(flight, "csv", 1706529600);

const buffer = Buffer.from(historyData);
fs.writeFile("history_data.csv", buffer);

flight_id - The ID of the flight. Can be gotten from any other function that returns flight details.
file_type - Either CSV or KML.
time - The STD/scheduled time of deperature in UTC of the flight as a Unix timestamp. Putting an invalid time will return a blank document.

Setting and getting Real-time Flight Tracker parameters:

Set it by using the setFlightTrackerConfig(...) method. It receives a FlightTrackerConfig dataclass instance, but you can also use keyword arguments directly to the method.

Get the current configuration with the getFlightTrackerConfig() method, that returns a FlightTrackerConfig instance. Note: creating a new FlightTrackerConfig instance means resetting all parameters to default.

let flightTracker = frApi.getFlightTrackerConfig();
flightTracker.limit = 10

frApi.setFlightTrackerConfig(flightTracker, ...);

let flights = await frApi.getFlights(...);  // Returns only 10 flights

Keywords

FAQs

Package last updated on 07 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc