Y’all may be fine with dead links and broken sites, but if they belong to me, I am bothered.

I was dusting off some portfolio items, and noticed one small, tiny project, maybe not even used anymore, was… busted. Blank screen.

Maybe four or five years ago, my friend and colleague Michael Kelly asked if a small thing was possible. He designs exhibits at National Parks and Monuments, many of them involve tech. For one project on climate change, he was seeking a way an iPad might be set up to show the latest statistic in CO2 measurements that are reported via an RSS Feed from the NOAA Earth System Research Laboratory https://www.esrl.noaa.gov/gmd/webdata/ccgg/trends/rss.xml

One of the tricks is that this feed includes entry for Monthly and Weekly data reports, and the one requested was to show the latest weekly ones.

I found a nifty way to do this via YQL or Yahoo Query Language, it more or less allowed via a URL for me to get to this directly find the first item with Weekly C02 Updates in the title and return the description via JSON. This all worked as a simple web page, even with a daily trigger to reload the page. It would work unintended as a kiosk display.

This was all fine… except that in January 2109, as part maybe of its graceless transition to Verizon ownership, Yahoo shut down this service with a grand 48 hour notice and no option for replacement. The link for it just gets redirected.

Thankfully, there is StackExchange where an entry led me to the nifty rss2json service– it creates a direct way to pass it an rss feed and get json in return (yes I know Tom would suggest rolling one’s own).

It nicely shows the data as well as providing an API I can call in my own script.

Now my script could call this, and cycle through the result until it finds one with the title that starts with “Weekly CO2 Update”. This is maybe crude, but it works:

I changed it to be a function update_co2_data that is called when loaded, and then a timeout script simply does the function again, rather than doing a full reload.

It’s rather exciting, eh? The page it produces is plain, as Mike originally requested.

Up-to-date weekly average CO2 at Mauna Loa
Week starting on February 16, 2020: 414.01 ppm
Weekly value from 1 year ago: 411.22 ppm
Weekly value from 10 years ago: 390.45 ppm

But at least it works again. Less plain than a white screen of Yahoo service nuking.

I could not resist making a prettier version. Since there are webcams pointed at the volcanic observatory where these measurements are taken, why not use those images as a background? Check out https://cogdog.github.io/co2/cam.html

The same data as shown above, but sitting above a photo of the Mauna Loa volcano

That is not only working now, but prettier!

Code is available at https://github.com/cogdog/co2/


Featured Image: The screen my site generates on top of Pixabay Image by andreas160578

If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
Become a patron at Patreon!
Profile Picture for CogDog The Blog
An early 90s builder of web stuff and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person. And he is 100% into the Fediverse (or tells himself so) Tooting as @cogdog@cosocial.ca

Comments

  1. It’d likely be a big hassle to write a convertor like that and RSS with javascript is much more of a pain that JSON and javascript.

    No problem on my end with using what’s available otherwise I’d never get anything done. 🙂

    I do love these little webpages that just keep chugging along doing their thing.

Leave a Reply

Your email address will not be published. Required fields are marked *