News for hackers. Stuff that matters.
Re:Show HN: A HN Api to provide random HN posts to read upon by minimaxir on Monday July 13, 2015 @02:23AM (#9876710)

  hn_url := "http://hn.algolia.com/api/v1/"
  page := rand.Intn(50)
  points := randomInt(200, 600)
  url := hn_url + "search?tags=story&numericFilters=points>" + strconv.Itoa(points) + "&page=" + strconv.Itoa(page)
That's an odd definition of random.
Re:Show HN: A HN Api to provide random HN posts to read upon by bluerail on Monday July 13, 2015 @02:28AM (#9876726)
The points is just a threshold to get a good article instead of just anything. And, Algolia returns maximum of 1000 hits for a query with 20 per page. So shuffling the page to pick up too.
Re:Show HN: A HN Api to provide random HN posts to read upon by Killswitch on Monday July 13, 2015 @10:12PM (#9882445)
Not bad, but instead of displaying title and just url, maybe put HN url too, because I refreshed the endpoint a few times and got a couple self posts that had blank urls, but titles looked interesting...

Maybe at least if it's a self post, show the HN url.

Re:Show HN: A HN Api to provide random HN posts to read upon by bluerail on Friday July 17, 2015 @04:17AM (#9901730)
Yeah, sounds good. I'll add it today. I also am building another Ruby script which works on top of this to save the articles to pocket.