5 ms·
Related, I am learning to code and in the process I built this simple website that randomly shows the most upvoted HN comments: http://www.opusnota.com/hnbc ht
by soneca 9y ago
Related, I am learning to code and in the process I built this simple website that randomly shows the most upvoted HN comments:
http://www.opusnota.com/hnbc http://www.opusnota.com/hnbc
- jmstfv 9y agoHow do you fetch comment scores?
- minimaxir 9y agoHN comment scores are not public, so I am unsure how you find the "most upvoted comments"
- RodericDay 9y agotop of every story probably
- minimaxir 9y agoThat is a very bad metric because comment rankings are a function of score and time.
- soneca 9y agoAlgolia'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.
- TeMPOraL 9y agohttps://news.ycombinator.com/bestcomments https://news.ycombinator.com/bestcomments?