Show HN: Free HN User Favorites API Endpoint (MIT)

4 points by sbr464 ↗ HN
I needed a way to access my hn favorites since I use them like bookmarks. This was put together very quickly. Uses x-ray (nodejs)

API Endpoint: https://reactual.lib.id/hnfavs@dev

Example GET request for user: sbr464, 1 page (30 favs): https://reactual.lib.id/hnfavs@dev/?id=sbr464&limit=1

It currently accepts 2 query params:

id (string = '') - hn user id limit (number = 1) - pagination 30/page

Will error if you don't include an id.

I'll put it up on a more permanent URL and may move it to a different cloud function provider. I just used stdlib.com for now to get feedback.

If the url changes, I'll put the updated url in my hn profile/source and include it in the JSON response error for a while.

Link to source code (MIT): https://github.com/reactual/hacker-news-favorites-api/tree/m...

1 comment

[ 2.6 ms ] story [ 14.8 ms ] thread
Also accepts the query param offset (number, optional, default is 1). There is a 30 second timeout, so if you need older pages of favorites, just provide an offset. Usually over 10 pages, it becomes relevant (limit=10/300 favorites)