6 ms·
Show HN: HNTerm – Browse Hacker News in the Terminal
- ggerganov 7y agoThis is a console application that I wrote for browsing HN in a terminal. It has an ncurses UI and uses libcurl to query the HN API [0]. Currently works on Linux and Mac. I also ported it to web with Emscripten's Fetch API so it can be easily demonstrated [1]. [0] - https://github.com/HackerNews/API https://github.com/HackerNews/API [1] - https://hnterm.ggerganov.com https://hnterm.ggerganov.com
- johnnyfived 7y agoThis is awesome, but not sure why pressing o / O on mac (catalina) doesn't open anything.
- ggerganov 7y agoI’m just calling system() with “xdg-open” and url as argument. This is what a quick google search told me can be used for openning a browser from a C++ program. Maybe “xdg-open” is not available on Catalina. It is on Mojave I think.
- ComputerGuru 7y agoUse `open` instead of xdg-open on macOS.
- Terretta 7y agoCool app // And screenshot
- deleted 7y ago[deleted]
- iddan 7y agoFew UX comments: 1. There are a few advanced features that are enabled by default that I think should be hidden by default: stats and multiple panes 2. It's unclear how to get back when entering an article
- equalunique 7y agoThanks for this. I love the concept, and would use it daily if there were features for adding/removing/viewing favorites. This is something that the official API doesn't support, so it's not something I'm faulting this application for. Impressive for sure. Also +1 on wlqlwlql's dark-mode idea, although a color theme in general might be a better approach (but perhaps overly complicated?).
- ggerganov 7y agoThe "favorite"/"follow" function is something I was also thinking about. I have some ideas about it - something like an extra feed window where only favorited (and related) things show up. Regarding color themes - these are super easy to add.
- agustif 7y agoan easy way of doing it would be storin a default bookmarks.txt file wherever and use that outside of the account, love the concept. Would love it for PH too
- plibither8 7y agoThis might not be addressing your issue directly, but for my browser extension Refined Hacker News [1], once a user is logged-in in the browser site it is fairly simple to "construct" the favorite-ing endpoint URL. The URL endpoint is "/fave" and requires two query parameters: `auth` and `id`. "auth" is a random string that is unique for each story/comment and is generated from the HN server (it's required for authorization of the "favorite" request), and "id" is the story/comment's ID number. The auth string of a story for "fave" is the same as the auth string for the "hide" and "flag" links (since they are already present, the links' hrefs contain that auth string), and so we can extract the auth string from their hrefs and use it for favoriting and un-favoriting. Moreover, I've created a simple API which can be used to get all the favorited items of a user: https://github.com/plibither8/hn-faves-api https://github.com/plibither8/hn-faves-api 1: https://github.com/plibither8/refined-hacker-news https://github.com/plibither8/refined-hacker-news
- folkhack 7y agoLooking at the API request counter/how it renders it seems like you're pinging the API for every news item? 43 for just the "news" and "show" sections seems pretty high. If that were the case I'd be worried about hitting an API limit, etc. Great concept though! Looks clean =)
- ggerganov 7y agoIt's just the way the API works - to get the details for a single story (i.e. title, score, user, time, etc.) you need a single API request. Once the stories are fetched, then you can query the API only for those that have changed. I was wondering what is the API limit - I haven't hit it yet. Will see.
- folkhack 7y agoGotcha - it's times like that that I go with an old-fashioned raw HTTP request and parse it with a DOM parsing engine. Sometimes the "web-facing API" (so-to-speak) is better than the official API. Super cool project!
- dang 7y agoYes, an API that is isomorphic to the website itself would be much easier to use. Our plan is for the next version of HN's API to simply serve a JSON version of every page. In the meantime, if you scrape the HTML, please respect https://news.ycombinator.com/robots.txt https://news.ycombinator.com/robots.txt and don't do it more than once per 30 seconds. HN's app server runs on a single core, so we don't have a lot of performance to spare! This is in the works to change as well.
- protomikron 7y ago> HN's app server runs on a single core, so we don't have a lot of performance to spare! That's interesting. Is there any more information about HN's tech stack? I know it's built on top of the Lisp dialect Arc, but I wonder about the server specs and would be happy to be pointed at some resource. Although I experienced HN being down, I guess the overall uptime and availability is pretty decent. Keep up the good work!
- oneeyedpigeon 7y agoFYI works fine on mac but requires cmake (I downloaded and built cmake from source with no problems on 10.14.6, but other installation options are available)
- ducaale 7y agoWow, the vim keybindings are very intiutive. I just pressed O without thinking about it and it opened the highlighted link in a browser. although I miss using h and l for going right and left. also, I don't know about others but it took me some time to figure out the enter key to open comments page. maybe that should be mentioned in the help window.
- a13n 7y agoWhat's wrong with browsing Hacker News in the browser?
- yjftsjthsd-h 7y agoBetter keybindings?
- halfjoking 7y agoYeah I could see putting things like baseball game scores in a terminal, because you don't really want to be browsing mlb.com at work - but HackerNews should be considered work related if you're a dev. If your dayjob doesn't allow you to spend 1 hour a day keeping up on tech news/interests, then maybe you need a better job.
- tsukurimashou 7y agoWhat's wrong with browsing Hacker News in your terminal?
- a13n 7y agoJust trying to figure out what problem this project is solving.
- oneeyedpigeon 7y agoWoah, those are some big dates: https://bobbyjack.me/images/hackernews/hnterm.png https://bobbyjack.me/images/hackernews/hnterm.png
- shreyamathur651 7y agouse Good Antivirus!
- mjsir911 7y agoThat's nice! There are some other mentions about color themes, but I'm wondering if it could just respect my terminal's color theme with background & foreground colors?
- lainproliant 7y agoIn general your imtui library looks really nice. I may have to consider it for some future projects!
- qxga 7y agoTangentially related - I wish there were a way to browse HN in Acme.