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:
$.ajax({ type: 'GET', dataType: 'json', url: 'https://api.rss2json.com/v1/api.json?rss_url=https%3A%2F%2Fwww.esrl.noaa.gov%2Fgmd%2Fwebdata%2Fccgg%2Ftrends%2Frss.xml', timeout: 10000, success: function(data, textStatus ) { // load the data array co2data = data.items; // flag set var found = false; for (var i = 0; i < co2data.length; ++i) { // look for Weekly Update in title console.log(co2data[i].title); if ( co2data[i].title.startsWith("Weekly") ) { // found first match, use it. Set date object var d = new Date(); // update output $('#results').html(co2data[i].description + 'last updated: ' + d.toLocaleString() + '
') ; found = true; break; // exit now! } } // if we got this far we failed if (!found) $('#results').text('Weekly C02 Data not found'); }, fail: function(xhr, textStatus, errorThrown){ $('#results').text('Failed to retrieve data stream. Check internet connection?'); } });
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.
update_co2_data(); // set to update once a day var myDailyRoutine = setTimeout(update_co2_data, 86400000);
It’s rather exciting, eh? The page it produces is plain, as Mike originally requested.
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

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
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.
Four years later, came back to check the litle site. Still pulling live data like a champ, but the web cam version was pictureless. The NOAA web cam looks 404, so swapped for a USGS one– see https://code.cog.dog/co2/cam.html