The logical structure of the page (including "widgets" like archives, feeds etc) seem to be encoded in a strange markup and dumped in a giant string in the header. This string is the sole parameter of a function called "_WidgetManager._Init". This function is invoked on page load and is defined in this external script. At this point, my brain boggled and I needed a lie down.
The actual
To that end, I knocked together a little fragment of (ugly, unsafe) code to extract the labels and counts into a JavaScript object and read it back to you:
javascript: var rexp=/search\?label=(\S+)/i; var cexp=/.*(\d).*/i; var labels={}; var links=document.links; for(var i=0; i<links.length;i++) if (l=rexp.exec(links[i].href)) if (!links[i].rel) labels[l[1]]=cexp.exec(links[i].nextSibling.nodeValue)[1]; for (var j in labels) alert(j+' ['+ labels[j]+']')
(load up a beta blog and copy/paste this code into your browser address bar to watch the magic unfold.)
Here's another code snippet to transform Google's labels into a form a little more familiar to delicious JSON feed users:
javascript: var rexp=/search\?label=(\S+)/i; var cexp=/.*(\d).*/i; var labels={}; var links=document.links; for(var i=0; i<links.length;i++) if (l=rexp.exec(links[i].href)) if (!links[i].rel) labels[l[1]]=cexp.exec(links[i].nextSibling.nodeValue)[1]; var str="if(typeof(Delicious) == 'undefined') Delicious = {}; Delicious.tags = {"; for (var j in labels) str+='"'+j+'":'+labels[j]+','; str+="};"; document.write(str);
Does that get your creative juices flowing?
Filed in: blogtech, blogger, freshtags, blogger-hacks, del.icio.us beta
See also: