

Hacker news in your terminal - Socketubs
https://github.com/socketubs/pyhn

======
bdcravens
Interesting to post this 4 days after another terminal version of Hacker News

<http://news.ycombinator.com/item?id=4992951>

Maybe should have put "another" in the title? :-)

~~~
Socketubs
Very similar but easier to install (I think). The hacker_term don't work for
me, so I do my own :)

------
kaolinite
Nice work :-) may end up using this. I noticed that you rolled your own hacker
news parsing - any reason why you used this over <http://www.hnsearch.com/api>
or similar?

On another note (and sorry for advertising my own project) but it is relevant
and some may find it useful - Hacker News for Sublime Text:
<https://github.com/dotty/HackerNews-SublimeTextPlugin>

By the way, you might want to consider putting "Show HN: ..." in the title.
Tends to stand out more and people often look for these posts.

~~~
Socketubs
Oh yeah it's a nice project too. Thanks for it!

Edit too: Use my own to test BeautifulSoup and for fun.

------
gglanzani
Is there any reason I can't read the comments in the terminal? It should be
relatively easy to implement once you've rolled out your own parser...

~~~
Socketubs
Parser don't handle comments at this time but it's could be a nice feature and
not so difficult to implement.

------
joshdotsmith
Glad you built a way for me to be more productive at being less productive.

------
mmorett
I mean this with all sincerity, but did I understand this correctly? Using
Terminal to sift thru HN articles, only to open them up in a web browser via
the "c" key or the Enter key? I fail see the point. If you have a browser, you
don't need the less usable Terminal version.

I tried thinking about who could be the target audience for something like
this and had images of 1960s-era IBMers who worked exclusively with character-
based terminals hooked to the mainframes (ignore the lack of browsers in that
time period for the moment). But today, barring specialized defense related
jobs and the like, everyone has a browser. Hell, many of us have browsers in
our pockets via smartphones.

I guess I just don't understand the fetish with 1960s-era technologies in 2013
(up to and including vi/vim vs. more powerful editors). Is it nostalgia?

~~~
habitue
I spend most of my day in a terminal. I might use this just to have one less
context switch. But I agree that opening the actual article in the browser
sort of defeats the point.

As far as vi/vim versus "more powerful" editors... you mean emacs right?
Because IDEs aren't necessarily more powerful than vim/emacs, they are just
easier to learn.

~~~
mmorett
"you mean emacs right?"

Lol. I'm not taking that bait. :-)

FWIW, I had never tried emacs before and decided last week, ironically, to try
it for the first time. I fired it up, poked around, tried to do something
useful and then wanted to quit. I couldn't find a way to quit the app. As best
as I can remember, I don't remember seeing an obvious way to exit so I closed
the entire Terminal window. lol

But that same exercise on TextMate was not even close. I was immediately
productive in TextMate, having never used it before, and was able to get
things done. Even better, I was able to exit "properly" without killing the
program.

TextMate required no memorization of any kind. But it also doesn't make one
out to be a genius for simply being able to use it. Those archaic command-line
editors do. My gf has to use nano because she can't navigate using vi. I use
vi (barely), and I can't navigate it either. lol. vi, for me, is like a one
night stand...get in and out as fast as possible. I hate using it. But many
people swear by it...in 2013. Because ":wq" is so obvious.

~~~
eLobato
\-- why vim.

Don't want to create a flame thread, but I felt the urge to reply.

I was really skeptical of vim as an editor just like you are, until I (and I
am so glad I did) forced myself to use vim for a month for ALL my text
editing. The linux kernel is old, does that make it less useful? That's not a
valid argument at all.

It certainly takes some time to learn how to do things, macros, search and
replace, move blocks of text, install some good plugins, etc... All of this is
incredibly fast and ergonomic as opposed to move your right hand to the arrow
keys every now and then. Textmate, Gedit, Redcar, pretty much other text
editor has just a subset of features that vim has (emacs being the exception
where vim might be a subset of emacs). Learning vim is just like learning a
sort of new way of talking to your editor. ":wq" is obvious once you learn the
words. It means write and quit. Another big advantage I see is I can work
remotely through SSH and be instantly super productive with an editor that
doesn't get in my way. I learnt vim before doing this, now I pretty much do
all my coding on remote machines where using Textmate would simply be losing a
lot of time after a few days.

It is not a replacement for IntelliJ Idea, Eclipse, Visual Studio, or any IDE.
IDE's help you in a different way that sometimes can be more valuable than
having a powerful tool to edit code. Programming JavaEE apps for instance is
something I just find way easier to do with an IDE.

I agree, the user has to put a lot of effort to be able to understand and make
vim work for him as an amazing editor. Spending time learning how to use a
computer program is something we are not used to do these days but in the case
of vim it pays off.

\--- OP

Back to the original topic, I agree opening the results on a web browser sort
of defeats the point for me as well. If you can find a way to render the
articles and comments texts nicely in a terminal I would find it a lot more
useful though. Maybe you can reuse the parsing work the fellows at Pulse.me
have done, I can't find the feed if there's any though :( . Best of luck!

~~~
mmorett
"It certainly takes some time to learn how to do things, macros, search and
replace, move blocks of text, install some good plugins, etc... All of this is
incredibly fast and ergonomic as opposed to move your right hand to the arrow
keys every now and then. "

This explains it so perfectly. The arrow keys are not a penalty. They are 1.
clearly labeled, and 2. available on every keyboard. Using them is intuitive.
They require no knowledge or memorization.

Yes, I have to move my right hand to them, just as I have to occasionally move
my right hand to the mouse and/or trackpad. I am not performing data entry. I
am editing a file, often a configuration file of some sort. Speed is not the
issue; accuracy of the changes being made are. Even when I'm coding in an IDE,
I'm not touch-typing like a 1960s typist. I spend more time
thinking/contemplating than typing.

It's not a vi/vim thing. Emacs was just as confusing to me. I'm not proposing
or suggesting anything so much as observing how a new, less effective
technique of consuming HN was given praise "just because it's done in
Terminal". There is a perverse hatred of the GUI or even things considered
intuitive in the linux world, which I understand are inherited from the unix
world, which is very, very old.

I just don't understand why we can't pay homage to that legacy, but still
advance the needle. What the developer did was nice, showed skill, deserves
some props, but not useful.

Making a character-based editor that could be used by grandma for the next 20
years in linux would be.

------
Surio
Tried installing... Installation bombed with errors:

    
    
      running build
    
      running build_py
    
      running build_ext
    
      building 'urwid.str_util' extension
    
      error: Unable to find vcvarsall.bat
    

\----------------------------------------

I have Python 2.7 and VS2010 Express installed and have already done most of
the things SO recommends, such as setting up path variables, etc....

Any other ideas?

~~~
Socketubs
Maybe windows guy can help you. I don't have it.

------
thejsjunky
This is nice, good work.

As a testament to the simplicity of HN's design though, it should be noted HN
is fully functional and looks good in elinks etc. In fact I'm posting this
very comment from my terminal with elinks. With elinks re-writing scripting it
wouldn't be hard to massage the pages a little first to get them looking even
better.

------
icambron
Noob question (I barely ever use Python stuff), but after I install this with
pip, how do I actually run it? I'd have expected a hashbanged script on my
path but bash can't seem to find one...

~~~
onehp
Just run /usr/local/share/python/pyhn

~~~
icambron
Ah thanks. That wasn't on my path for some reason.

------
deloschang
Great project - one bug is that when you scroll above the top (#1), index goes
out of range. Should be easy to fix.

~~~
Socketubs
This bug is fixed now.
[https://github.com/socketubs/pyhn/commit/60a95a842a4e60bd49a...](https://github.com/socketubs/pyhn/commit/60a95a842a4e60bd49af47b9139a6fa60980acbf)

------
ragsagar
Hope you will integrate vim bindings soon!

~~~
Socketubs
[https://github.com/socketubs/pyhn/commit/3d1e4d0adb07874b221...](https://github.com/socketubs/pyhn/commit/3d1e4d0adb07874b2210fc22e068106aa8ca4735)

Done!

~~~
deloschang
Vim bindings are inverted for me, unfortunately. For instance, 'k' scrolls
down instead of up. Or am I missing something? I would have expected it to
work like Vimium.

~~~
Socketubs
Now fixed.

~~~
ragsagar
great! nice work!

------
Devlin_Donnelly
Looks good. Cleaner and more articles on the screen than visiting Hacker News
using lynx.

------
guilloche
I am using w3m for hacker news, it is clean and pretty good.

------
fox91
Seriously, another one?

------
lscott3
Pretty sweet!

