I wrote a short JavaScript snippet to export HN Favorites to a CSV file.
It runs in your browser like a browser extension. It scrapes the HTML and navigates from page to page.
Setup and usage instructions are in the file.
Check out https://gabrielsroka.github.io/getHNFavorites.js or to view the source code, see getHNFavorites.js on https://github.com/gabrielsroka/gabrielsroka.github.io
https://github.com/reactual/hacker-news-favorites-api
Here's an example query:
https://reactual.api.stdlib.com/hnfavs/?id=sbr464&limit=1
Would a client using your API paginate to fetch, say, 50 pages? When I tried it using ?limit=50, I got a 504 error.
Thanks!
(Edit, never mind, I see you explain it in the readme.)
Plug for a related golang tool I wrote and use which exports favorites upvotes as structured JSON:
https://github.com/jaytaylor/hn-utils
Just
I've been having some fun with the API recently building this tool: https://github.com/dogsheep/hacker-news-to-sqlite
Related Question: Is this the source code for HN? https://github.com/wting/hackernews
That's great news! Is there a way to be notified (eg, via email) when this comes out?
Thanks.
I wanted to show people that it's possible (and easy) to get to your own data!
(Edit: haha, I see what you just did there. A little recursive humor.)
https://www.heyraviteja.com/post/projects/deep-search-hn/
I used the jQuery selector `a.storylink`.
One more question: what is the best way stop it when it will reaches last page?
> for p in range(1, 17):
Actually p=17[0] is empty (as p=16 is maximum as for now).
Maybe, script should scrap pages from `1` to `infinity` UNTIL it detect next message on page[0]:
> app4soft hasn't added any favorite submissions yet.
[0] https://news.ycombinator.com/favorites?id=app4soft&p=17
I'm not sure if it still works as it too relied on HTML scraping. Perhaps I should update it to support favorites too.
Edit: Whoa, it's been 4 years already. I believe HN didn't have favorite feature at the time. That's why I used upvoting as my bookmarks system and created a script to export that data.
Edit: I see from the other PR it's called `upvoted`.
Edit 2: I changed it to `upvoted` and now I get a 200 OK, but the code crashed right afterwards on `tree.cssselect()`.