TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: A HN Api to provide random HN posts to read upon

5 pointsby bluerailalmost 10 years ago

2 comments

minimaxiralmost 10 years ago
<p><pre><code> hn_url := &quot;http:&#x2F;&#x2F;hn.algolia.com&#x2F;api&#x2F;v1&#x2F;&quot; page := rand.Intn(50) points := randomInt(200, 600) url := hn_url + &quot;search?tags=story&amp;numericFilters=points&gt;&quot; + strconv.Itoa(points) + &quot;&amp;page=&quot; + strconv.Itoa(page) </code></pre> That&#x27;s an odd definition of random.
评论 #9876726 未加载
Killswitchalmost 10 years ago
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...<p>Maybe at least if it&#x27;s a self post, show the HN url.
评论 #9901730 未加载