Live data from Hacker News

Hacker News API

blog.ycombinator.com

91–100 of 315 posts

Re: Hacker News API

#91
This makes it really easy to add average karma to the comment section for every user. For instance, you can paste the below into the console, and should add average karma data for each user.

    Array.prototype.forEach.call(document.querySelectorAll('a[href^=user]'),
    	function(v,k) { 
    		var s = document.createElement("script");
    		s.src = '//hacker-news.firebaseio.com/v0/user/' + v.innerHTML + '.json?callback=ud_' + k;   
    		document.head.appendChild(s);
    		window['ud_' + k] = function(user_data){
    			var avg_karma = user_data.karma / user_data.submitted.length;
    			v.innerHTML += ' (' + avg_karma.toFixed(1) + ')';
    		}
    	} 
    );

Re: Hacker News API

#92
post #51

Earlier quoted context omitted.

That's two programming languages. Not all languages have a nice ISO-8601 parser built-in. Human-readable is a slight advantage, agreed.

It's not a slight advantage if you've ever had to parse through logfiles by hand or debug APIs with curl--it's a great deal more than that. Why not, let's have some more examples: In PHP (with a bug, because PHP is stupid and doesn't handle decimal fractions): $dateTime = DateTime::createFromFormat( DateTime::ISO8601, '2009-04-16T12:07:23Z'); In C#: DateTime time = DateTime.Parse("2010-08-20T15:00:00Z", null, DateTim…

> It's not a slight advantage if you've ever had to parse through logfiles by hand or debug APIs with curl--it's a great deal more than that.

Funny you should say that, UNIX time works great for log files. Since now even a dumb tool can search for values in the range, 1388491199-1420027199 to see all 2013-2014 lines.

Your way requires specific support for the date format, dealing with "2014" false positives, or searching through all 12 months individually (2013-01, 2013-02, 2013-03, etc).

You keep drumming on about library support, which is important for a format which isn't universally supported. Fortunately for UNIX time there's no value in listing them off one by one, you can just assume it is all of them...

UNIX timestamps are also listed in several international standards. Including POSIX.

Re: Hacker News API

#93

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…

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.

Re: Hacker News API

#95
post #73

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…

just wanted to let you know that I love your application!

Thanks! I think you'll like the new version whenever it gets finished :)

Re: Hacker News API

#96

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…

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.

Re: Hacker News API

#98
I am excited about this because now I can finally build a way to query my own posts and comments. I often times come across products/services/cool hacks on here that I vaguely remember, but cannot always locate. Using built-in search is kludgy, and I'd like to be able to do something more complex. Thanks for doing this!

Re: Hacker News API

#100

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…

I, for one, was just thinking about writing a scraper...

Thanks very much guys!

Post reply on HN