A comment about the feasibility / features of a potential SN API came up in a recent discussion. This piqued my interest, as I've recently been investigating the HN API, which exists as part of an unclear relationship with Firebase. Basically, you can get all the HN posts, comments, etc., since the beginning. (Annoyingly, you can't get comment upvotes, though.)
I was thinking about doing some experiments on the HN dataset, and this API makes that feasible. Although honestly, I don't need the API to do what I want, I just need a tarball of the data, which doesn't seem to exist. So I'd have to make a zillion API calls to extract it, I guess.
Anyway, I've thought before about interesting experiments to do on the SN dataset. What's the liklihood of getting a HN-like API, or even just a dump of posts, comments, users, etc? It would be helpful for my imagined use case, and perhaps also for third-party innovation. The API wouldn't be privacy-compromising , as it would only include the data a person could scrape -- it would just save the trouble of having to scrape it. Some of the cool RT features of the Firebase feed are nice-to-haves but not necessary.
Thoughts?
We have a graphql API: https://stacker.news/api/graphql
You should be able to find a UI to inspect it, but the interface is defined in these files if that's easier: https://github.com/stackernews/stacker.news/tree/master/api/typeDefs
Getting a db dump is tricky on the privacy side and I'm a little overwhelmed with stuff to do as is. If you want to construct a privacy preserving pg_dump command for me to run, I'd be happy to run it once I've confirmed it's not harming privacy.
reply
That's great, this will be a good PoW for me to figure out what to ask for. Thanks :)
reply
If you want just a simple api reference on how to do things on SN from a third-party client, take a look at this file I've written for the unofficial SN app:
The code is a little bit messy because I just hacked something together and kept adding more and more code to it because I just needed something quick and dirty to build a prototype. It's written in Dart but it's easy to understand and it'd be simple to convert it to JavaScript.
reply
This will be a great reference to learn from, @felipe -- thanks very much. I love your hacker energy :)
reply
I just fixed a few bugs on that api.dart file (along with a few others). The app is hopefully working now, so it should be a better reference
reply