‘Reverse Engineering’ Hacker News into an API
lukakerr.github.io
lukakerr.github.io
It's not possible to achieve capability-parity just *reading* HN as the API does not return comment karma, which is used to sort the view. (I think this is the subtler half of why HN reader sites never catch on - the interesting comments are never at the top, so the presented content is very noticeably that much more boring.)
So a while back I tried building a simple scraper component (an internal API, I guess) that would use Firebase for realtime updates, and strategically poll the site (say one request every 3-5 seconds) to get the current sort order. I never got to the Firebase part because I crashed into Cloudflare while fiddling around tuning the ratelimiting.
So yeah. You need full Chrome (to satisfy whatever Cloudflare's WAF throws at you) and a captcha-solving subscription (because the WAF will get the flyswat out when it sees your datacenter IP) to be able to do this properly - especially if you want to APIify this sort of thing.
Link to my app if anyone’s curious. Red question mark in upper left corner of page goes to its “about” page:
[0] https://github.com/searchableguy/hackernews_graphql
I recently built a Hacker News client [0] on top of the official API and using the method described in the article to login users is very inconsistent. I kept running into Captcha issues and even when that didn’t happen, sometimes a login request would simply not return the expected token.
Unless the official API starts offering user login, this will remain difficult.
The first commit is from Oct 2, 2014 while the article was published on April 1, 2018.
However, it seems that you did not read the first paragraph of the article which states the following:
> While building hackd I faced a problem - the official Hacker News API doesn’t allow for interaction, such as upvoting, posting and commenting. I wanted hackd to be a full featured Hacker News client, so this wasn’t going to cut it.
So to answer your question:
> Didn’t HN get an official API a long time ago? Or was that read-only?
Yes, it appears that at the time of publication, the API was read-only.