Skip to content

Instantly share code, notes, and snippets.

@aaizemberg
Last active October 30, 2019 18:39
Show Gist options
  • Save aaizemberg/2e9bd94727c5e49f057715a553b7c609 to your computer and use it in GitHub Desktop.
Save aaizemberg/2e9bd94727c5e49f057715a553b7c609 to your computer and use it in GitHub Desktop.
Noticias sobre las elecciones en Argentina 2019 (fuente: GoogleNews)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>XData News - Elecciones en Argentina 2019</title>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<style>
body {
font-family: 'Roboto', sans-serif;
}
h1 {
font-size:xx-large;
}
h2 {
font-size:xx-large;
}
.title {
font-size:x-large;
}
.source {
font-style:italic;
}
</style>
</head>
<body>
<script src="https://d3js.org/d3.v5.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/rss-parser@3.1.2/dist/rss-parser.min.js"></script>
<script>
var data = [];
var CORS_PROXY = "https://cors-anywhere.herokuapp.com/"
var parser = new RSSParser();
var url = "https://news.google.com/rss/topics/CAAqBwgKMN-jhwswi-OFAw?hl=es-419&gl=AR&ceid=AR%3Aes-419"
parser.parseURL(CORS_PROXY + url, function(err, feed) {
feed.items.forEach(function(entry) {
data.push( {
title : entry.title.split(" - ")[0],
source : entry.title.split(" - ")[1],
link : entry.link,
pubDate : entry.pubDate,
isoDate : entry.isoDate,
contentSnippet : entry.contentSnippet,
content : entry.content
} );
})
data.sort(function(x, y){
return d3.descending(x.isoDate, y.isoDate);
});
d3.select("body").append('h1').text('XData News - elecciones@AR 2019')
// d3.select("body").append('h2').text('http://bit.ly/2NtUsjw')
d3.select("body").selectAll('p').data(data).enter().append('p')
.html(function(d) { return d.pubDate + " - <span class='source'>" + d.source + "</span><div class='title'><a href='" + d.link+ "'>" + d.title + "</a></div>";})
})
</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-110333943-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-110333943-1');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment