Obtaining web data that involves JavaScript

I am needing to get the text from a web page that seems to require JavaScript. Is there a simple method?

d-atis is a sample page.

That’s not really a web page – it’s a JavaScript application. It looks quite complicated (use View Page Source in Safari to look for yourself). So I think the answer to your question is no, no simple method. Certainly there is no “one size fits all” solution, you will have to reverse engineer the javascript code.

However … I did a bit of poking around. A google search for

datas.clowd.io api

turned up this promising link:

For those of you that are interested, I have created a website that pulls the digital ATIS text directly from the FAA SWIM data system.
http://datis.clowd.io/
There is also an API endpoint: http://datis.clowd.io/api/klax
And before anyone asks, no, I will not be integrating this back into vATIS.
Enjoy!

Lo and behold, that API endpoint produces JSON! :slight_smile:

[{“airport”:“KLAX”,“type”:“combined”,“code”:“A”,“datis”:“LAX ATIS INFO A 2053Z. 24013KT 10SM FEW038 18/11 A3009 (THREE ZERO ZERO NINER) RMK AO2 SLP187 58007. INST APCHS AND RNAV RNP APCHS RY 24R AND 25L, OR VCTR FOR VISUAL APCH WILL BE PROVIDED, SIMUL VISUAL APCHS TO ALL RWYS ARE IN PROG, SIMUL INSTR DEPARTURES IN PROG RWYS 24 AND 25. TWY D CLSD BTN TWY, K AND TWY D10 . RY 24R SFL OTS, PAPI OTS 24L, 24R, 7L. LAX VOT OTS. HAZD WX INFO FOR LAX AREA AVBL FM FSS. USE CAUTION FOR HANG GLIDING 1 MILE SOUTH LOS ANGELES VOR. BIRD ACTIVITY VICINITY ARPT. INCLUDE YOUR CALL SIGN IN ALL READBACKS. ENSURE TRANSPONDER ON WHILE OPERATING ON MOVEMENT AREAS. …ADVS YOU HAVE INFO A.”}]

You can turn this into a dictionary with the jsonimport( function, then extract the text you need (probably the “datis” text). Tada! :tada:

1 Like