I need to download some data from html embedded code

I have a website with an embedded code with some weather data (and I'm interested in temperature and other things to turn them into data that I'd like to put in a graph and so on...)

But if I use the CURL command with the page I need to get (for example curl -L www.website.com), I just get the full HTML code, but there is no data inside

So, if there is this embedded code in that site...

<iframe width="200" height="145" scrolling="no" frameborder="no" noresize="noresize" src="http://www.ilmeteo.it/box/previsioni.php?citta=5913&type=real1&width=200&ico=1&lang=ita&days=6&font=Arial&fontsize=12&bg=FFFFFF&fg=000000&bgtitle=0099FF&fgtitle=FFFFFF&bgtab=F0F0F0&fglink=1773C2"></iframe>

...I just get this code.

However, using a browser you can see some data in the iframe (temperature, wind, weather...). I need these datas.

2 answers

  • answered 2017-11-12 19:52 Rob

    It sounds like you are downloading an outer HTML container for the web page and the rest is loaded in the iframe.

    If you change your URL to the contents of the iframe:

    curl -L "http://www.ilmeteo.it/box/previsioni.php?citta=5913&type=real1&width=200&ico=1&lang=ita&days=6&font=Arial&fontsize=12&bg=FFFFFF&fg=000000&bgtitle=0099FF&fgtitle=FFFFFF&bgtab=F0F0F0&fglink=1773C2"

    you should get the contents you are looking for. If the website has a API for downloading the data you should probably use that, but for a small amount of data like this it doesn't seem to be a big deal.

  • answered 2017-11-12 20:01 user7490232

    I have to try again in my Linux, because now it's working on my mac. I think I forgot to use the " chars before and after the link. I almost sure of this...