Skip to content

Instantly share code, notes, and snippets.

@L1fescape
Last active August 29, 2015 14:01
Show Gist options
  • Save L1fescape/5b83175c493167d9d0ff to your computer and use it in GitHub Desktop.
Save L1fescape/5b83175c493167d9d0ff to your computer and use it in GitHub Desktop.
Get the the status of the United Airlines flight you're currently on, provided your flight has wifi (just need to be connected, not paying for it). Implementations in node and curl.
curl 'https://www.unitedwifi.com/payment/ajax/notification.do' --data 'actionkey=FLIGHT_TIME_NOTIFICATIONS' --compressed
# [{
# "class":"com.bluebird.business.flightimebar.FlightimeBarResponse",
# "destinationIATA":"MCO",
# "eventType":"FLIGHTTIMEBAR",
# "flightETA":"8:58PM",
# "flightRunningStatus":89,
# "flightStatusText":"0h 33m with United Wi-Fi!",
# "flightTotalDuration":332,
# "markers":[{
# "class":"com.bluebird.business.flightimebar.ConditionalMarker",
# "position":0,
# "state":"DESCENT",
# "text":"ARRIVAL"
# },{
# "class":"com.bluebird.business.flightimebar.ConditionalMarker",
# "position":4,
# "state":"TAKE-OFF",
# "text":"DEPARTURE"
# }],
# "message":null,
# "originIATA":"SFO",
# "promotionText":"",
# "showWelcomeText":false,
# "welcomeText":""
# }]
// npm install request
var request = require('request');
request({
method: 'POST',
url:'https://www.unitedwifi.com/payment/ajax/notification.do',
form: {'actionkey': 'FLIGHT_TIME_NOTIFICATIONS'}},
function(error, response, body){
if (response.statusCode === 200){
var data = JSON.parse(body)[0];
console.log("United flight destination:", data.destinationIATA);
console.log("ETA:", data.flightETA);
console.log("Arriving in:", data.flightStatusText.split(" ").splice(0, 2).join(" "));
// United flight destination: MCO
// ETA: 8:58PM
// Arriving in: 0h 14m
}
else{
console.log("There was an error getting flight info.");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment