Skip to content

Instantly share code, notes, and snippets.

@aaizemberg
Created December 5, 2016 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaizemberg/2a09a5195e5bbeafc8cb8f1b7d5e118c to your computer and use it in GitHub Desktop.
Save aaizemberg/2a09a5195e5bbeafc8cb8f1b7d5e118c to your computer and use it in GitHub Desktop.
Las noticias mas importantes del dia
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.3/d3.min.js"></script>
<meta name="viewport" content="width=device-width">
<title>Top 100</title>
</head>
<body>
<script>
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1;
var yyyy = today.getFullYear();
if (dd<10) {
dd='0'+dd
}
if (mm<10) {
mm='0'+mm
}
var fecha = yyyy + '-' + mm + '-' + dd;
var url = "http://infovis2.it.itba.edu.ar/news-visualization/api/word-cloud?&date1=" + fecha + "&api=2.0&limit=100";
d3.json( url , function(error, data) {
if (error) throw error;
d3.select("body").append("h1").text("Las 100 noticias mas importantes del " + fecha)
var ul = d3.select("body").append("ul");
ul.selectAll("li").data(data).enter().append("li")
.html( function(d,i) {return "<a href='http://infovis.it.itba.edu.ar/news/titulos.php?date1=" + fecha + "&keyword="+d[0]+"&api=2.0'>"+d[0]+"</a>" + " ("+d[1]+")"})
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment