What I just watched on Joost

For fun, I just added a little to this blog in sidebar.php. It shows what I just last watched on Joost, updating itself every 5 minutes.

<script>
updateJson();
function updateJson() {
var url="http://www.joost.com/api/events/lastwatched/libby?json_function=lastW"
var script = document.createElement("script");
script.defer = "true";
script.type = "text/javascript";
script.src = url;
document.getElementsByTagName('head')[0].appendChild(script);
};


setInterval ( "updateJson()", 60000 );


function lastW(obj){
var el=document.getElementById("lastW");
var id=obj.events[0].publicId;
var title=obj.events[0].title;
var thumb=obj.events[0].thumbnail;
if(el){
el.innerHTML="Libby just watched: <a href='http://www.joost.com/"+id+"'>"+title+"</a> on <a href='http://www.joost.com/'>Joost</a>";
}
};
</script>


<p>
<span id="lastW"></span>
</p>

I’m biased of course but I think this is pretty cool. Numerous (alpha, check the heath warning) APIs are at http://www.joost.com/doc/api. Allan and Toni_H have been playing around too.