Live data from Hacker News

Hacker News Official API

github.com

81–90 of 138 posts

Re: Hacker News Official API

#81
post #38

How hard is it for HN to make its own API? so I could do something like: curl https://api.news.ycombinator.com/

My understanding is that this is the official HN API. I think Firebase is a YC company. Others can correct me if I'm wrong. See the link at the bottom of every HN item page. Edit: I took a look, it seems like Firebase is owned by Google now, but it was original a YC-funded startup, judging by this page: https://www.crunchbase.com/funding_round/firebase-pre-seed--...

Yes, Firebase is listed on YC’s list of companies they have funded here:

https://www.ycombinator.com/companies/firebase

Re: Hacker News Official API

#83
post #76

Earlier quoted context omitted.

It's not going to happen. Showing comments led to constantly flamewars about unfair commenting. Even without the comment scores, the mods are still constantly having to remind people to stop arguing about scores. The decision not to display or make available other people's scores was litigated intensely; it is now part of the premise of the community.

By “showing comments led” do you mean showing comment points/votes? Also, if comment viewable comment points are gone forever, then the “popularity” filter should be removed from HN’s search and the old voting data removed from the public API. To me, if users have concerns about “unfair voting” to me the solution is not to hide them. Also, if comment points aren’t important, why even allow them? They are obviously im…

Like I said, this has been heavily litigated. So much so that I think you'd have difficulty coming up with an argument that hadn't been made already about it. Not making other people's comment scores available is, as I said, a part of the premise of the community. There are other communities that work differently. There isn't a single optimal set of policies.

Re: Hacker News Official API

#84

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…

I found this interesting, looking at the Firebase API. I guess one could get the min/max item ids for the child posts, and query the range of ids (startAt(), endAt()).

Van Puffelen answers some of this here, but he doesn't get into specific queries: https://www.youtube.com/watch?v=66lDSYtyils

He also mentions here that Firestore offers a bit more for WHERE type clauses over Firebase:

https://stackoverflow.com/questions/26700924/query-based-on-...

Re: Hacker News Official API

#85
post #70

In response to people's complaints about the usability of the HN Firebase API: yes. We're going to eventually have a new API that returns a simple JSON version of any HN URL. At that point we'll phase out the Firebase API, with a generous deprecation period. I'd be curious to hear people's thoughts about what a generous deprecation period might be.

Can you allow login and write operation via the API?

I want to build a HN web client but it's not possible without scrapping the site which won't scale.

Re: Hacker News Official API

#86
post #70

In response to people's complaints about the usability of the HN Firebase API: yes. We're going to eventually have a new API that returns a simple JSON version of any HN URL. At that point we'll phase out the Firebase API, with a generous deprecation period. I'd be curious to hear people's thoughts about what a generous deprecation period might be.

Can you allow login and write operation via the API? I want to build a HN web client but it's not possible without scrapping the site which won't scale.

Im typing this from the iOS app HACK which somehow allows for writing comments and upvoting etc.

Re: Hacker News Official API

#87

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…

Yeah, I built a graphql API for HN for this reason. It will let you fetch all comments, users, and posts in a single request.

https://hngraphql.fly.dev/graphql

Re: Hacker News Official API

#88

Earlier quoted context omitted.

Can you allow login and write operation via the API? I want to build a HN web client but it's not possible without scrapping the site which won't scale.

Im typing this from the iOS app HACK which somehow allows for writing comments and upvoting etc.

They have to scrape the site in the background to work. While this is doable, any such client will need to follow the HN bot policy which limits the scrapping speed.

Another issue is browser only client. If HN has set proper cors (I didn't check if it is the case), then you cannot build a web client through scrapping without proxy.

Post reply on HN