I built a scraper around 3 years ago (been through a few usernames since then), and I've had to change it once 3 months ago because the HTML output added quotes around HTML attributes. Even though it's read only, I'll continue to use my scraper rather than the API simple because it's one request, rather than the API would require one request for the top IDs and then one call per story, so it would be 31 calls instead…
Hacker News API
271–280 of 315 posts
Re: Hacker News API
#272Re: Hacker News API
#273And that returns only the ids, nothing else. To get basic information like the score, title or url you have to lookup the ids individually. And even the story items do not contain such basic information as the number of comments. And you can't calculate it yourself since only the top comments are even returned (as ids of course). So you'll have to recursively dig through the comments to get the number.
This is even more curious as there is a very solid Algolia API where you can filter for submission time, story score, number of comments and even return a greater number of results + access page numbers to get even more.
To get the information of a single algolia api call you will need hundreds or thousands (in case of nested comments) "official" API calls. Hoping for updates
Re: Hacker News API
#274The Firebase JavaScript library makes make this impressively straightforward to use. I built a clone using React.js and Firebase's library. Because v0 of the API requires a request for each news story, it's not possible to use Firebase's React mixin yet. https://github.com/ssorallen/hackernews-react
Re: Hacker News API
#275I wrote a stupid simple wrapper and pushed it to PyPI. My excuse is that I needed to learn how to use setuptools today. pip install hackernews-python Usage: >>> from hackernews import HackerNews >>> hn = HackerNews() >>> hn.top_stories() [8422599, 8422087, 8422928, 8422581, 8423825... >>> hn.user('pg') {'delay': 2, 'id': 'pg', 'submitted': [7494555, 7494520, 749411... >>> hn.item(7494555)['title']) Hacker News API >>…
Traceback (most recent call last):
File "", line 1, in
File "hackernews.py", line 23, in top_stories
return r.json()
TypeError: 'list' object is not callable
Tried in both python 2.7.3 and python 3.2.3EDIT: You need a relatively new version of requests for this to work. The version packaged with Debian Wheezy is too old. Use pip.
Re: Hacker News API
#276Earlier quoted context omitted.
Great you're here. I'm using this app, but I'm sorry to say this... It's pretty bad. Here's a list of issues that I encounter very often: - It often crashes during startup - There are massive encoding issues, I see question mark symbols pretty often. - Comments often won't load, without any error message whatsoever. I uninstalled the app multiple times for these reasons, but unfortunately there isn't anything that's…
Would you be willing to beta test my application? It's pretty much finished already and doesn't have any of the issues you listed (in addition to having a, in my opinion, much nicer design), I'd just be looking for some general feedback regarding the discoverability of some features. I could submit a beta today or tomorrow.
Re: Hacker News API
#277On the top of my wishlist: Look up HN story by URL.
(From the comments, I learned about a different API that will suffice for now: https://hn.algolia.com/api/v1/search?query=google.com&restri... )
Re: Hacker News API
#278Earlier quoted context omitted.
I'd like to know the average hourly amount earned from HN. I know personally HN has helped me greatly in the projects I do at work.
Yes this is an interesting question too, but one that is much harder to answer. I love HN, but it sure gets a lot of activity during work hours :)
Re: Hacker News API
#279Re: Hacker News API
#280Earlier quoted context omitted.
I actually have the list of top users by comment karma: https://docs.google.com/spreadsheets/d/1Ws2VK-UB7IQpVUZgPZ9M... I also included the number of thread wins (user made comment with highest number of points in a given submission thread) to see if there was any unusual relationship. There wasn't: correlation is 0.89. I ended up not including it in the article because it's long enough as-is. :P
Is that top overall karma users, but then sorted by comment karma, or is that actually top comment karma users?
SQL query:
SELECT
author,
SUM(num_points) AS total_comment_karma,
MAX(created_at) AS last_comment
FROM hn_comments
GROUP BY author
ORDER BY total_comment_karma DESC
LIMIT 1000