This... is cool, but also kinda sucks for me. I've invested dozens of hours into writing an extremely complicated scraper for my Android version of HN. https://play.google.com/store/apps/details?id=com.airlocksof... The newest version (still under development, probably a month or two from release) adds support for displaying polls, linking to subthreads, and full write support (voting, commenting, submitting, etc). I…
Hacker News API
41–50 of 315 posts
Re: Hacker News API
#42Why do you have all the times in Unix time instead of ISO-8601 UTC? EDIT: Also, the "about" value in the users api appears to be truncated. Compare... https://hacker-news.firebaseio.com/v0/user/angersock# ...with... https://news.ycombinator.com/user?id=angersock EDIT2: Note that the JSON is correct, but the preview in the firebase API seems to be broken. EDIT3: No issue tracker on the Github? Laaaame.
UNIX time is actually much easier to parse and more accurate. Almost all platforms (even Windows[0]) have a way to convert a UNIX time into a culture specific local time. What you're asking for is a string you have to parse. That's a lot more work and there is a lot more that can go wrong. [0] https://stackoverflow.com/questions/249760/how-to-convert-un...
var time = new Date("") // in Javascript
time = DateTime.iso8601("") # in Ruby
Aaaand it's human readable! Aaaaand it works before the Unix epoch!EDIT:
Changed DateTime.parse to DateTime.iso8601, to be even more retentive.
Look, parent claimed that parsing ISO strings is hard (it's not, especially if you're consuming a web api on a modern web language) and that it was more readable (which is so clearly wrong I have no words).
As for being more accurate, again no. The range is worse (lol wraparound if you're using a 32-bit int), there isn't explicit support for fractional seconds, doesn't map onto UTC cleanly, doesn't handle leap seconds, and so on.
It's only "easier" if you don't actually care about a human-readable timestamp that is robust and if you desire to do date parsing yourself instead of using any of the well-established libraries out there. Ugh.
Re: Hacker News API
#43This... is cool, but also kinda sucks for me. I've invested dozens of hours into writing an extremely complicated scraper for my Android version of HN. https://play.google.com/store/apps/details?id=com.airlocksof... The newest version (still under development, probably a month or two from release) adds support for displaying polls, linking to subthreads, and full write support (voting, commenting, submitting, etc). I…
So, @anyone involved with the API project, can you give us an estimate on when will the OAuth-based user-specific API be rolled out? I'm fining with pausing my efforts until then, if it's going to be soon, in order to go a less complex and error-prone path.
[1]: https://github.com/geomaster/hnop/blob/master/backend/src/hn...
Re: Hacker News API
#44Re: Hacker News API
#45Oh man you guys, patio11 has generated massive amounts of content: https://hacker-news.firebaseio.com/v0/user/patio11.json?prin... I count 8,483 submissions. I'm sure there's something interesting to be done with all of this data. A word frequency chart? --- Edit: So apparently there's a ruby gem that lets you feed it a body of text and generates pseudo-random phrases based on that text. I present to you the patio11…
https://hacker-news.firebaseio.com/v0/user/tptacek.json?prin...
Re: Hacker News API
#46Re: Hacker News API
#47Re: Hacker News API
#48Any kind of rate limitations we should be made aware of?
[Firebase Dev Advocate here] We don't currently have rate limits. I'd recommend using our SDKs, they handle connections more efficiently than dealing with the REST API. You can also run your own server process using our Node ( https://www.npmjs.org/package/firebase ) or Java libraries ( https://www.firebase.com/docs/android/quickstart.html ).
Re: Hacker News API
#49Best news I've heard all day!
Re: Hacker News API
#50On the one hand, of course it's great that HN is finally getting a proper API and also modernizing its markup (which is a mess even if you ignore all the tables – for example, the first paragraph in a comment usually isn't wrapped in
tags), but on the other hand this current v0 version is very lacking and impractical for a regular client application.
Since the top stories (limited to 100) and child comments are only available as a list of IDs a client app would have to make a separate HTTP request for every single item, which is obviously not something you'd want to do especially in a mobile environment. Other lists apart from the top stories (new, show, ask, best, active etc.) don't seem to be available at all right now.
Of course this is just the first version, and the documentation promises improvements over time – which I don't doubt at all – but there's no clear indication that the API will be at feature-parity with the current website, even excluding anything that requires authentication, by October 28. So this means that I – and other developers of client apps or unofficial APIs – will probably have to write new scraping code once the new rendering engine (which I assume refers to the website) arrives instead of being able to switch to the new API immediately.
Now I guess I might just be needlessly worried, especially since the blog post explicitly says that the new API "should hopefully making switching your apps fairly painless", but then why not wait until it's actually ready for that before making the announcement? Putting a half-baked API out there a few days/weeks (?) in advance before it's fully fleshed out doesn't seem all that helpful, at least to me.