0

I would like to extract some text, which is changing every 30 min, from a weather website (METAR for pilots) and integrate it on a self made html page (i'm doing a summary of many weather informations on one page). The text is in a class on this website : https://metar-taf.com/LFBO

and it is the text in the dark blue rounded box, above the "donate" button. looks like this when i inspect : METAR LFBO 011700Z AUTO 29020KT CAVOK 08/M05 Q1010 TEMPO 32020G35KT

i don't really like iframes as they slow down the page loading a lot, is there another way ?

thank you

I tried to use some part of code here Extract the text out of HTML string using JavaScript but it is not adapted to my use. I just need the text "extracted" and usable on another page.

1 Answers1

0

The best way to go about this is certainly not extracting text from that third-party page. They will likely change their page layout at some point, forcing you to re-write whatever scraper you wrote. There is also likely to be CORS issues, which are always a pain.

I would therefore recommend just getting the raw data from NOAA. For the METAR station you provided (LFBO), you can get two formats:

the decoded data: https://tgftp.nws.noaa.gov/data/observations/metar/decoded/LFBO.TXT

or the raw data: https://tgftp.nws.noaa.gov/data/observations/metar/stations/LFBO.TXT

These formats will be much easier to parse. I hope this helps!

Pufferfishe
  • 139
  • 1
  • 7