-2

I am just starting out to learning Python and have taken some online courses in my free time.

I am trying to find the data source for this website, making a daily count of departures from the airport, and eventually building a flights vs date plot.

Have spent two weeks investigating the page source, but am unable to find the json source. Would a kind soul please show me where the json source is? Thanks!

https://www.changiairport.com/en/flights/departures.html

bitterjam
  • 117
  • 11
  • 1
    Just as a comment, this isn't typically how stack overflow works. Typically you want to ask a question in such a way that it is helpful to others who may stumble across similar problems. The way that you have written this is very particular to only your specific circumstances and limits it's usefulness to the community in general. – Sam Spade Jul 14 '20 at 02:03

1 Answers1

1

https://www.changiairport.com/cag-web/flights/departures?lang=en&callback=JSON_CALLBACK&date=today

There you go. That will give you the flight schedule for today. The date parameter can probably be other things too, but I don't know what the options are. Any normal get request should work, it seems publicly accessible.

You just need to right click and go to "inspect" then hit the "network" tab and then just browse through the different requests.

Just a note:
Just for the record, this is called scraping and it's often in a legal gray area where, so long as you aren't using it too extensively or making a profit off of it you probably won't get in any trouble, but just make sure you have permission from the company if you plan to make a lot of calls to an open API like this. It's usually against their terms of service, but as an unenforced clause that they will only use if you become a nuisance.

Sam Spade
  • 1,107
  • 7
  • 20
  • thank you Sam. Looking back, i realised I can also find this link under Network, just that I need to bring up the DevTools before I load the page, so that the data source(s) appear. – bitterjam Jul 14 '20 at 04:37
  • Would you know how I can find out if the data is limited to "tomorrow", "today" and "yesterday", or I can specify a specific date e.g. 1 June 2020? Am just learning to scrape, I hope it is fine as long as I don't profit from it. – bitterjam Jul 14 '20 at 04:40
  • @bitterjam no idea. You could try a standard UTC formatted date. – Sam Spade Jul 15 '20 at 15:58
  • @bitterjam if this answer was what helped you, please mark it as correct :) – Sam Spade Jan 17 '21 at 01:57
  • @bitterjam, as the person who asked the question, you can click a button to mark answers as correct and it increases my reputation on the site. https://i.stack.imgur.com/OGwTL.png – Sam Spade Jan 26 '21 at 23:35