Created
January 16, 2016 14:23
-
-
Save yuyoyuppe/7716d0ed0b348169a70c to your computer and use it in GitHub Desktop.
TED talks TOP10 most popular themes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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