flightradar24-client-ts
v1.3.2
Published
A client for the Flightradar24 API written in TypeScript
Downloads
35
Maintainers
Readme
Getting started
flightradar24-client-ts
Install
npm install flightradar24-client-ts
Usage
Basic Usage
import { FlightRadarApi } from "flightradar24-client-ts";
const flightRadarApi = new FlightRadarApi()
// airports
const airports = await api.fetchAirports();
// airlines
const airlines = await api.fetchAirlines();
// details of a single flight
const flightDetail = await api.fetchFlight("<flight code (ICAO or IATA)>")
// Radar
// get major zones
const zones = await api.fetchZones();
// get flights in a zone
const flights = await api.fetchFromRadar({
zone: zones[0]
});
// multi-zone flight fetch
const multizoneFlights = await api.fetchFromRadarMultiZone(zones);
Filtering live flights
import { FlightRadarApi } from "flightradar24-client-ts";
const flightRadarApi = new FlightRadarApi();
interface LiveFilters {
/**
* The airline ICAO code to fetch aircraft from (e.g. AFR for Air France)
*/
airline?: string[];
/**
* The call signs to fetch aircraft from (e.g.SFR850)
*/
callsign?: string[];
/**
* The flight numbers to fetch aircraft from (e.g. FA850)
*/
flight?: string[];
/**
* The aircraft registration numbers to fetch aircraft from (e.g. F-GZNP)
*/
reg?: string[];
/**
* The aircraft model codes to fetch aircraft from (e.g. A320)
*/
type?: string[];
/**
* The Airports ICAO codes to fetch aircraft from (e.g. LFPG)
*/
airport?: string[];
}
export interface RadarOptions {
/**
* The zone to fetch aircraft from. If not specified, the entire world is used.
*/
zone?: ZoneData;
/**
* Whether to fetch inactive aircraft
*/
inactive?: boolean;
/**
* Whether to fetch aircraft on ground
*/
onGround?: boolean;
/**
* Whether to fetch gliders
*/
gliders?: boolean;
/**
* Whether to fetch aircraft from the MLAT data source
*/
MLAT?: boolean;
/**
* Whether to fetch aircraft from the FAA data source
*/
FAA?: boolean;
/**
* Whether to fetch aircraft from the satellite data source
*/
satellite?: boolean;
/**
* Whether to fetch vehicles
*/
vehicles?: boolean;
/**
* Whether to fetch estimated positions
*/
estimatedPositions?: boolean;
/**
* Whether to fetch aircraft from the FLARM data source
*/
FLARM?: boolean;
/**
* Whether to fetch aircraft from the ADS-B data source
*/
ADSB?: boolean;
/**
* Whether to fetch airborne aircraft
*/
inAir?: boolean;
/**
* The filters to apply to the aircraft data
*/
filters?: LiveFilters;
}
const radarOptions: RadarOptions = {
// Filters
};
const flights = flightRadarApi.fetchFromRadar({
radarOptions
});
- Example: Filtering Flights related to JFK Airport
import { defaultRadarOptions, FlightRadarApi } from "flightradar24-client-ts";
const flightRadarApi = new FlightRadarApi();
const flightsJFK = flightRadarApi.fetchFromRadar({
...defaultRadarOptions,
filters: {
airport: ["JFK"]
}
});
API
Api docs can be found here
Example Project
Flight Tracker
This project uses the flightradar24-client-ts to fetch flights from the radar and display them on a 3d globe. It can also filter the flights based on the user's input.
- link to the project: https://gitlab.com/dev6645326/react-flight-tracker
- link to the live demo: https://react-flight-tracker.apoorva64.com/