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.
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'm fine with switching to a new API (Square's Retrofit will make it super easy to switch), but without submitting, commenting, and upvote support I have to disable a bunch of features I worked really hard on. Also it would've been cool to know this was coming about 3 months ago so I didn't waste my time.
Anyways, quick question on how it works -- when I query for the list of top stories
I'm sorry you just invested a lot of time in scraping. I know from experience what a pain that is. We said several times that the API was coming, and I've made it clear to anyone who asked, but there's just no way to reach everybody. All: in the future, please get answers to questions like this by emailing hn@ycombinator.com.
Re write access and logged-in access, if that turns out to be how people want to use the API, that's the direction we'll go. But we think it's important to launch an initial release and develop it based on feedback. There are many other use cases for this data besides building a full-featured client: analyzing history, providing notifications, and so on. It will be fascinating to see what people build!
I'm not blaming you. It just feels bad, you know? I'll definitely email you in the future about stuff like this. And don't get me wrong, it will be great to be able to throw out the cruft that comes along with parsing the current layout. The app is engineered to be able to drop in a new API pretty quick since I thought something like this would happen eventually.
It would help me out a lot if the current front end would live on under oldnews.ycombinator.com like that until the new API has write access, though. I think it's pretty cool to be able to be reading an article somewhere else, click "Share" in Android and have "Submit to HN" pop up in the results.
I second that request. Having a subdomain point to the current layout for a little longer is definitely going to help the transition, especially for write access and platforms without Firebase SDKs.
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.
This definitely does suck. I feel your pain. But it's also part of the package of scraping websites. You go in knowing that it could break at any time.
Oh, I'm well aware. I've had to push many quick fixes when some field gets renamed, etc. It's really not the API change that bothers me, more the lack of features. But hopefully they can add those things soon and I can re-enable them down the road.
Yes. While with HTTP pipelining you can request them all over a single TCP connection using a single SSL session, you will need to make an HTTP request for each item you want.
If you're on a supported platform, the Firebase SDKs handle all this efficiently and can even provide real-time change notifications.
I'm trying to attach a ChildEventListener to the "item" Firebase and I'm getting a "permission denied" error. My guess is that I am doing something wrong, but on the off chance that the adding event listeners is not (yet) enabled, it would be nice to know. Any clues to what I might be doing wrong?
I've never used the Firebase API itself before. It's very clean!
Edit: I reached the same (now obvious) conclusion as mentioned in the reply below. Now my quick hack is working perfectly. Thank you so much for this!
[Firebase Dev Advocate] Glad you're enjoying Firebase! Attaching a listener to the "items" Firebase is disabled. This is because it would send every item from HN to your computer. You'll need to attach a listener to the individual item instead. The "permission denied" error is coming from the security rules on the HN Firebase (https://www.firebase.com/docs/security/quickstart.html). If you're trying to find out what the latest updates are, they're kept in the /updates node (https://github.com/HackerNews/API#changed-items-and-profiles).
I'm also currently writing a scraper[1] for the HN frontpage (for my WIP Hacker News redesign), and while there's a limited Algolia API available, it doesn't do much good if users can't post comments, upvote etc. Same goes for the official one now.
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.
[Firebase Dev Advocate]
@airlocksoftware - Yes, you should make separate requests for each story. You can attach a listener to the topstories node (https://www.firebase.com/docs/web/guide/retrieving-data.html...) and when that’s triggered, you can make a request for the data on each story. Using the Firebase SDK, each request will get made using the same connection. I'd recommend using our SDK instead of the REST API so you don't have to worry about managing your own connections and retries.
Here's an example showing all topstories and updating in realtime. Obviously, in JS, but the other Firebase SDKs are similar: http://jsfiddle.net/firebase/96voj1xh/
Just wanted to drop a comment on the awesomeness of your app.
Hacker News 2 is by far the best Hacker News app, not just on Android, but on all mobile platforms i've tried (so, iOS, Android and Windows Phone)
Awesome work you are doing.
Yeah, I like it a lot, but I've put tons of time into my scraper for Reader YC (https://github.com/krruzic/Reader-YC). I support everything but polls currently. This api is nice but my scraper actually supports more... No option to get Show HN, Ask HN or New afaik. Still glad this is out!
Exactly. Is this really the case, or it just isn't documented? I've send an email to api@ycombinator.com about that and hopefuly, I will be able to shed some light on this, later. I will write as soon as I get a response. (assuming someone responds)
Oh, thanks for the reminder. I fixed it a few days ago and did a staged rollout but forgot to push it to everyone. I've done that so it should update for you soon.
Ha! A) Because I love Double-Doubles. B) Because it's more than 2 year old (before there really was a hamburger icon on Android). It's completely redesigned in the next version, though.
So why, in the first place, would I want another mobile app rather than just opening the fully functional website (which is pretty simple & basic already) on my mobile browser?
Because it can be better designed, use common design / navigation patterns of your mobile OS, notify you when you get a reply, change the text size, change the theme, have richer animations, and allow you to automatically share content from other applications directly to HN?
Yeah. I'm just a bit averse to apps scraping data for the reasons you mentioned. It should have been the work of the mobile website, not an app. Speaking purely from the user's point of view (not the developer - I realize this is a community full of app developers) - one can't just keep installing apps for every website which is not mobile efficient yet. You all must have seen a lot of websites showing messages like "Welcome, we have an app, pess OK to install that, or Cancel to continue". Most of those websites don't do anything which a mobile website couldn't.
I agree with you in theory, but most mobile websites are poorly thought out and implemented - if at all. I definitely don't download apps for every site I use, but for the ones I use daily, I generally find I need to. Native OS interactions seem to be difficult to get right in the browser.
HN is definitely an example of a site that isn't ideal in a mobile browser. For instance, if you have the ability to downvote, it's incredibly easy to mistakenly downvote when you mean to upvote because how close and small the buttons are. There's other added functionality, like tracking who I've upvoted / downvoted in the past as well as tracking un/read comments when returning to a thread. In the browser, I use a chrome extension for this, and on my phone, I use airlocksoftware's app. (side-note, I wish said state carried between the extension and the app)
The developers of HN are surely capable of creating a mobile website that could work just as well, or even better than a mobile app. But currently, it's not ideal. And for that reason, I completely appreciate airlocksoftware's (and the devs of other HN apps) for their efforts.
Ideally those in charge of HN would have simply employed someone - they had offers starting at free I gather from previous threads - to make HN mobile friendly. Failing that apps are just patching the original site. I too decry this form of progress (replacing web access with apps that only fix the borked site) but it's not hard to see why people should want that.
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'm fine with switching to a new API (Square's Retrofit will make it super easy to switch), but without submitting, commenting, and upvote support I have to disable a bunch of features I worked really hard on. Also it would've been cool to know this was coming about 3 months ago so I didn't waste my time.
Anyways, quick question on how it works -- when I query for the list of top stories
https://hacker-news.firebaseio.com/v0/topstories.json?print=...
it just returns a list of ids. Do I have to make a separate request for each story
https://hacker-news.firebaseio.com/v0/item/8863.json?print=p...)
to assemble them into a list for the front page, or am I missing something?