Live data from Hacker News

Hacker News Official API

github.com

21–30 of 138 posts

Re: Hacker News Official API

#22
> The v0 API is essentially a dump of our in-memory data structures.

TIL that HN doesn't use a "proper" / persistent DB. I wonder then how HN handles data persistence. Is it as simple as creating write-ahead logs + checkpointing every some duration?

Re: Hacker News Official API

#23
I'm currently writing an HN posts score tracker (basically it plots score variations over time since they were in new for each popular post) and it's really handy that you can just subscribe with eventsource [0] and get realtime update when something changes without having to manually poll each post wasting resources. Not yet sure about the latency though.

[0] https://github.com/jpopesculian/reqwest-eventsource/

Re: Hacker News Official API

#24

Wish API would show comment votes instead of only showing them up until 8 years ago when displaying them was turned off on the main site. Aside from allowing users to enable them via their on interface, do analysis, etc — it broke HN’s comment search based on comment popularity. Related: https://news.ycombinator.com/item?id=32535637

I wrote a script that will allow you to use cookies to download your comment scores [1]. I also did some analysis of my own scores [2]

[1] https://github.com/superb-owl/hacker-news-comments

[2] https://superbowl.substack.com/p/commenting-on-hacker-news

Re: Hacker News Official API

#26
Only using the official API is quite cumbersome, as fetching a story with comments requires one network request per each comment.

Instead, try considering the (more unknown) Algolia API[0]. It supports fetching the entire tree in one request. Unfortunately the comments aren’t sorted, so you’ll still have to use the official one (or parse the HN HTML) if you need that.

For my HN client[1], I parse the HN HTML (as it’s required for voting), and sort the comments from the Algolia API. It’s much faster than recursively requesting the official API.

[0]: https://hn.algolia.com/api

[1]: https://github.com/goranmoomin/HackerNews

Re: Hacker News Official API

#27

Wish API would show comment votes instead of only showing them up until 8 years ago when displaying them was turned off on the main site. Aside from allowing users to enable them via their on interface, do analysis, etc — it broke HN’s comment search based on comment popularity. Related: https://news.ycombinator.com/item?id=32535637

I’d like to be able to conveniently access my most popular comments. There are quite a few things in there that I might like to write longer-form articles about. ( https://james.darpinian.com/blog/scraping-my-own-hacker-news... gives one way of doing it, by crawling your /threads?id=‹username› page, which does contain the point counts for each comment by you.)

Which would be possible if HN was API first and all data beside email for recovery were public. Otherwise, HN is simply not designed to be responsive to user system design requests — but their have been a massive amount of alternative systems built by users that built things HN would have never made.

Re: Hacker News Official API

#28

Firebase is owned by google. There are plenty of OSS solutions to create this exact realtime thing without getting too close to the elephant in the room.

I don't think it was owned by google when hn started using it for the API.
Post reply on HN