3 ms·
Algolia's API show votes for older comments (not sure how old is the line when it stops showing). Edit: naturally, there is a strong bias for older comments in
by soneca 9y ago
Algolia's API show votes for older comments (not sure how old is the line when it stops showing).
Edit: naturally, there is a strong bias for older comments in the list.
Code I use:
<script>
$(document).ready(function() {
var lasthours = "";
$("#refresh").on("click", function() {
var html = "";
var url = "https://hn.algolia.com/api/v1/search?tags=comment&numericFilters=points>120&page=";
var page = Math.floor(Math.random() * (20)) + 1;
url += page.toString();
var position = 0;
position = Math.floor(Math.random() * 20);
$.getJSON(url, function(json) {
var hits = json.hits;
var html = "<p>"+hits[position].comment_text+"</p><p>Story: <a target='_blank' href='"+hits[position].story_url+"'>"+hits[position].story_title+"</a><br><a target='_blank' href='https://news.ycombinator.com/item?id="+hits[position].story_id+"'>comment by "+hits[position].author+"</a></p>";
$("#quote-text").html(html);
});
});
});
</script>
- minimaxir 9y agoThe Algolia API cutoff for comment scores is October 2014. (which I know because it was cut off after I made a blog post on the subject: http://minimaxir.com/2014/10/hn-comments-about-comments/ http://minimaxir.com/2014/10/hn-comments-about-comments/) There have been quite a few good comments since then. It is worse to make an incredibly biased list than no list at all.
- soneca 9y agoIt is just a learning project. Feel free to not access it and downvote my comment advertising it if you think it is dangerous.
- minimaxir 9y agoMy comment was not a criticism, but a warning. It is very important to note where the data is coming from and any associated caveats which may influence the results.