Life expectancy data for countries, obtained from Wikipedia and plotted with pigshell
ycat http://en.wikipedia.org/wiki/List_of_countries_by_life_expectancy | hgrep -r 0 table.wikitable | table2js foo country data | iframe -g /usr/template/d3-worldmap1
Running through the pipeline step by step:
ycat
uses YQL to retrieve the contents of the Wikipedia page. We useycat
to jump the same-origin barrier.hgrep
selects HTML elements using a jQuery/CSS-like expression.table2js
converts the table contents into plain Javascript objects, the contents of the first three ""s of a row corresponding to thefoo
,country
anddata
properties of the object.iframe
supplies the objects to an HTML template rendered in a sandboxed iframe.