Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

todsul beat me to it (good show!), but in the spirit of teaching a person to fish:

   for airport in JFK GEO TXL SXF AGA LGW LTN SAW IKA KUL PER BKK KBP; do
      curl "http://airportcode.riobard.com/airport/$airport?fmt=JSON";
      echo;
      sleep 1;
   done
Semicolons are present because I did this in one line, left so you can too. Linebreaks are for HN convenience only. echo is because curl doesn't add linefeeds, sleep 1 is to be polite.


Author of airportcode.riobard.com here. Couldn't believe my eyes when I saw someone wrote a script to call that ancient API of mine from a few years back. Thank you for the `sleep 1` =)

I haven't maintained that service for a long time, and I've got a dozen or so emails suggesting ways to improve the API. I'm not sure what I should do with it, given that the data is really scrapped from Wikipedia and pretty hard to keep it up-to-date. Any suggestions?


Ha! Sorry, didn't mean to resurrect a dead project. I just searched for an API to the airport codes and ran with it.

I was actually hoping to find just a data dump of them somewhere, but if you can't I suppose no such thing publicly exists.

My personal recommendation is to do what you want to do. If you don't want to maintain it, perhaps add a note about that, but whatever. You've got no obligation.


Please don't feel sorry about it. I'm actually quite happy to see it's still useful for someone today. I'm just not sure what to do with it next. Right now it doesn't cost me anything to run it anyway. Thanks very much for your idea :)

I was in searching of such a data dump before I wrote AirportCode, but like you said, it's not really available. Some websites sell these data for big fees, which I couldn't pay for, so I ended up scraping Wikipedia for the data. And these things change over the time, which makes it rather complicated to maintain.

I'm thinking maybe something like open source data would be helpful to make these kinds of data available to the public, and let the public to update and maintain it so everyone could benefit from it.


http://openflights.org/data.html has a pretty decent airports data set!


Ha, that's the one I'm dreaming about! Thanks!


Doesn't work on Windows ;)


Sure it does. Install cygwin. (Or something else like that.) No serious computer user should be without a good shell. Powershell may be fine, too. There's probably some way to convince it to understand the JSON as a native object.


    $wc = New-Object "System.Net.WebClient"
    $airports = @("JFK", "GEO", "TXL", "SXF", "AGA", "LGW", "LTN", "SAW", "IKA", "KUL", "PER", "BKK", "KBP")
    foreach($airport in $airports) {
        $wc.DownloadString("http://airportcode.riobard.com/airport/" + $airport + "?fmt=json")
    }




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: