Let me begin by thanking you all for your love; my last post made it to the Hacker News front page and also got some buzz in Twitter, Reddit and Facebook. I am not just thanking the ones that agreed with me and upvoted my post, those of you who have disagreed and commented are valued equally.
I have named my blog ‘Hacks and Thoughts’ but my last two posts (only ones so far) were both thoughts so I was due for a hack. So here it comes.
A couple of times, I have submitted web-contents to Hacker News only to find that it has already been submitted there. When my article made it to the HN front-page, I realized that there is another disconnect as well: readers who come to the page from other sources (subscription, twitter etc.) are not aware of the attention and thus remain isolated from the interesting discussions. In my last post, I invited them to join the discussion by providing a link at the end but that was not a very good solution.
Having been around HN for some time, I suspected that someone might have already come-up with a solution. I searched for Hacker News submission tools but only found a bookmarklet and a Chrome extension. A like button is much more provoking for readers visiting a page than a bookmarklet or the extension which has to be pre-installed. Also, it would not help readers realize the discussions that might be going on. I decided to explore it a little bit.
Basically, we could pass the url (as query string u) and the title (as query string t) to http://news.ycombinator.com/submitlink programmatically and the user would only need to click submit given that s/he is already logged in. That was one part of the like button.
The other part was getting the HN points for the submission so that it could be displayed in the like button. This would indicate the HN hotness right on the page without the need for the user to go find in HN. I was trying to come-up with a way to scrape the points from the thread but found that HN actually offers a search API that returns json response. On top of that, it offered scoring different attributes for matching so it was possible to only search submitted urls that matched the url of the current content and retrieve the score if the submission already existed.
That’s it! The rest is skinning the cat and the recently released Twitter Bootstrap toolkit came handy in putting a page together.
Pre-launch, every thing seems to be working fine (on three browsers that is ) except for the not-so-nice user expereince of having to close the submit pop-up window after submitting. If this takes off after launch, the large scale of requests might affect HN search API. I didn’t see any rate-limiting details for the API but there might be a limit. I registered a domain and forwarded it to my hobby project server so that may go down as well. If the community thinks this is useful, I am willing to build and maintain it as a reliable service.