TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

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

5 点作者 bluerail将近 10 年前

2 条评论

minimaxir将近 10 年前
<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 未加载
Killswitch将近 10 年前
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 未加载