Live data from Hacker News

Ask HN: Favorite HN comment(s)

news.ycombinator.com

11–20 of 95 posts

Re: Ask HN: Favorite HN comment(s)

#15
post #2

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

HN comment scores are not public, so I am unsure how you find the "most upvoted comments"

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:

    
		
		  $(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 = "

"+hits[position].comment_text+"

Story: "+hits[position].story_title+"
comment by "+hits[position].author+"

"; $("#quote-text").html(html); }); }); });

Re: Ask HN: Favorite HN comment(s)

#16
post #6

Best HN comeback: https://news.ycombinator.com/item?id=35079

When I was a kid, a neighbor friend of my sister's came over to our house and very arrogantly announced "I live next door to a Nobel Prize winner." We all made polite comments. After she left, my mom turned to us and said "I so wanted to tell her 'my dear, I sleep with one.'

Yes, it was probably the only block in the world with two Nobel Prize winners living on it.

Re: Ask HN: Favorite HN comment(s)

#17
post #15

Earlier quoted context omitted.

HN comment scores are not public, so I am unsure how you find the "most upvoted comments"

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: $(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() *…

The 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/)

There have been quite a few good comments since then.

It is worse to make an incredibly biased list than no list at all.

Re: Ask HN: Favorite HN comment(s)

#18
post #2

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

HN comment scores are not public, so I am unsure how you find the "most upvoted comments"

https://news.ycombinator.com/bestcomments?

Re: Ask HN: Favorite HN comment(s)

#20
post #15

Earlier quoted context omitted.

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: $(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() *…

The 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/ ) There have been quite a few good comments since then. It is worse to make an incredibly biased list than no list at all.

It is just a learning project. Feel free to not access it and downvote my comment advertising it if you think it is dangerous.
Post reply on HN