3 ms·
I've been waiting forever for an API from HN, but unfortunately I will not be using it for my app (https://github.com/bennyguitar/News-YC---iPhone https://githu
by bennyg 12y ago
I've been waiting forever for an API from HN, but unfortunately I will not be using it for my app (https://github.com/bennyguitar/News-YC---iPhone https://github.com/bennyguitar/News-YC---iPhone).
I've built a library for iOS (https://github.com/bennyguitar/libHN https://github.com/bennyguitar/libHN) that handles scraping, commenting, submitting, voting, etc pretty well and allows me to make as few web calls as necessary to use HN. It looks like I'd have to drop functionality and completely change the networking scheme to match this API - something I'm not willing to do yet.
Correct me if I'm wrong here, but to get every comment on a post, I'd have to recursively get each item for each child. Instead, right now, I can make one network request and get all comments for a story. Granted, I have to parse the HTML (which I hate), but it's a much cleaner solution than going through every item, checking the children and then getting those items ad infinitum. Again, I just glanced over the documentation, but that seems untenable to me.
- kogir 12y agoIf you use the Firebase iOS library they handle it all and use an efficient bidirectional streaming protocol.
- bennyg 12y agoThat's good to know - wasn't super clear on my first pass of the documentation.
- dailen 12y agoCheck the article btw "Most importantly, the reason we released an API is so that we can start modernizing the markup on Hacker News. Because there are a lot of apps and projects out there that rely on scraping the site to access the data inside it, we decided it would be best to release a proper API and give everyone time to convert their code before we launch any new HTML."
- bennyg 12y agoYeah, the only problem is that I don't want to cut major functionality just to use their API. Things I do, that it doesn't look like the API handles: - More than 100 stories - Best, Top, Ask, ShowHN, Jobs, User Submission Posts - User Management (logging in/out) - Commenting - Submitting - Voting My app doesn't just function as a reader, which is what this API seems geared towards with the v0 release, it functions as about as full-fledged of an HN client as you could get. There's a couple things that I haven't built in yet like changing your about me text, but those were on the roadmap. I'm actually thinking about storing the configuration of how my app scrapes online such that if the HTML markup changes, I won't have to push huge sweeping changes to the App Store to get my app online again. I just deploy to Heroku and the app will handle that configuration and scrape correctly sans pushing to Apple.
- pjmlp 12y agoWhen everyone === lucky to have a supported platform.