Skip to content

Instantly share code, notes, and snippets.

@yuyoyuppe
Created January 16, 2016 14:23
Show Gist options
  • Save yuyoyuppe/7716d0ed0b348169a70c to your computer and use it in GitHub Desktop.
Save yuyoyuppe/7716d0ed0b348169a70c to your computer and use it in GitHub Desktop.
TED talks TOP10 most popular themes
console.log("TED talks TOP10");
$(".h9").filter(function(i){
return $(this).parent().hasClass("topics__list__topic")
&& $(this).parent().text().indexOf("TED") < 0;
}).map(function() {
var match = /(.*)\n(\d+)/gm.exec($(this).parent().text());
var res = {};
res.name = match[1];
res.c = parseInt(match[2]);
return res;
}).sort(function(a, b){
return b.c - a.c;
}).slice(0, 9).each(function(){
console.log(this.name + ": " + this.c);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment