donnemartin / haxor-news Goto Github PK
View Code? Open in Web Editor NEWBrowse Hacker News like a haxor: A Hacker News command line interface (CLI).
License: Other
Browse Hacker News like a haxor: A Hacker News command line interface (CLI).
License: Other
Use IOError instead.
Ask HN: Who is hiring?
https://news.ycombinator.com/item?id=TBD
Ask HN: Freelancer? Seeking freelancer?
https://news.ycombinator.com/item?id=TBD
Ask HN: Who wants to be hired?
https://news.ycombinator.com/item?id=TBD
If anyone wants to contribute on a bite-sized issue, feel free to submit a pull request for next month's set of hiring post ids.
Check out these PRs as a reference:
"Ask HN: Who wants to be hired?" isn't hooked up yet.
Hi...
I think it would be a good thing to have a command that can help exit from the haxor
command line.
Currently F10 is the key used for this purpose. However, in some terminals the key may be bound to some other function. Like in my case I am using the GNOME Terminal (3.6.2) that comes with Linux Mint. In this pressing F10 opens the file menu.
Ctrl+C, exit, halt, quit don't work for quiting the haxor
command line to get to the original command line. It would be great if such a functionality could be added.
The following lines of code result in errors in Python 2.7.6:
class Config(object):
...
parser = configparser.RawConfigParser()
try:
with open(config_file_path) as config_file:
parser.read_file(config_file) # AttributeError
class HTML2Text(HTMLParser.HTMLParser):
def __init__(self, out=None, baseurl=''):
HTMLParser.HTMLParser.__init__(self, convert_charrefs=False) # TypeError
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Getting this error when trying to run the script.
A functionality like Pocket/Readability would be awesome on console. I could then just read the articles without any clutter or going through myriad of links.
Ask HN: Who is hiring?
https://news.ycombinator.com/item?id=TBD
Ask HN: Freelancer? Seeking freelancer?
https://news.ycombinator.com/item?id=TBD
Ask HN: Who wants to be hired?
https://news.ycombinator.com/item?id=TBD
If anyone wants to contribute on a bite-sized issue, feel free to submit a pull request for next month's set of hiring post ids.
Check out these PRs as a reference:
"Ask HN: Who wants to be hired?" isn't hooked up yet.
it appears click.echo_via_pager
is not handling these properly and is resulting in an exception.
The plan is to fix this in two steps:
click.echo_via_pager
README
Windows section to let users know they can manually send the output to a pager, ie with | more
click.echo_via_pager
or determine a suitable replacement (see #16)This cli gui is a good start, especially the filtering capabilities are very nice, however it would be great to have a "browse experience", similar to a mail or news reader, like using cursor keys to navigate the posts, press enter to see comments, ESC to get back to list of posts, etc, you get it.
prompt-toolkit
v1.0.0 hanging while autocompleting the hn view command. Revert back to prompt-toolkit
v0.52. This bug only happens on Windows.exit
and quit
commands, which can be used instead of ctrl-d
.prompt-toolkit
1.0.0, which includes a number of performance improvements (especially noticeable on Windows) and bug fixes.Config
docstrings.README
:
haxor-news
CONTRIBUTING
.When running the auto-completer haxor-news
, the hn view
command of a post's linked contents is not supporting colors on Windows, like it does on Mac and Linux. When not running the auto-completer, the results are not sent to a pager, like it does on Mac and Linux.
Users can send the results to a pager by appending the | more
command.
Ask HN: Who is hiring? (August 2016)
https://news.ycombinator.com/item?id=TBD
Ask HN: Freelancer? Seeking freelancer? (August 2016)
https://news.ycombinator.com/item?id=TBD
Ask HN: Who wants to be hired? (August 2016)
https://news.ycombinator.com/item?id=TBD
If anyone wants to contribute on a bite-sized issue, feel free to submit a pull request for next month's set of hiring post ids.
Check out these PRs as a reference:
"Ask HN: Who wants to be hired?" isn't hooked up yet.
Wouldn't it be great if we can build an extension of the same where we can add other sites(like gizmodo,THN etc)?
Ask HN: Who is hiring?
https://news.ycombinator.com/item?id=TBD
Ask HN: Freelancer? Seeking freelancer?
https://news.ycombinator.com/item?id=TBD
Ask HN: Who wants to be hired?
https://news.ycombinator.com/item?id=TBD
If anyone wants to contribute on a bite-sized issue, feel free to submit a pull request for next month's set of hiring post ids.
Check out these PRs as a reference:
"Ask HN: Who wants to be hired?" isn't hooked up yet.
Running 2.7.10:
donnemartin at Donnes-MBP in ~/Dev/github/sources/haxor-news on master [!?$]
$ hn hiring
Traceback (most recent call last):
File "/Users/donnemartin/.virtualenvs/haxor2/bin/hn", line 9, in <module>
load_entry_point('haxor-news==0.1.1', 'console_scripts', 'hn')()
File "/Users/donnemartin/Dev/github/sources/haxor-news/haxor_news/main_cli.py", line 32, in cli
haxor_news.cli()
File "/Users/donnemartin/.virtualenvs/haxor2/lib/python2.7/site-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/Users/donnemartin/.virtualenvs/haxor2/lib/python2.7/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/Users/donnemartin/.virtualenvs/haxor2/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/donnemartin/.virtualenvs/haxor2/lib/python2.7/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/donnemartin/.virtualenvs/haxor2/lib/python2.7/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/Users/donnemartin/.virtualenvs/haxor2/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "/Users/donnemartin/.virtualenvs/haxor2/lib/python2.7/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/Users/donnemartin/Dev/github/sources/haxor-news/haxor_news/hacker_news_cli.py", line 161, in hiring
hacker_news.config.load_hiring_and_freelance_ids()
File "/Users/donnemartin/Dev/github/sources/haxor-news/haxor_news/config.py", line 329, in load_hiring_and_freelance_ids
except urllib.error.URLError:
AttributeError: 'module' object has no attribute 'error'
Update compat.py
:
try:
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
except ImportError:
from urlparse import urlparse
from urllib import urlencode
from urllib2 import urlopen, Request, HTTPError
Currently no way to view the next X number of posts.
If I view the top 10 posts, and I want to see the next 10, I have to run hn view 20
, which fills my terminal with content that is 50% stuff I've already seen.
I feel like it would be good for usability to be able to do the following:
haxor> hn top 10
# posts 1 - 10 display
haxor> hn next 10
# posts 11 - 20 display
I'd be happy to work on a PR for this.
The monthly posts hosted by HN need to have their ids updated each month and fetched from the command line.
Ask HN: Who is hiring? (May 2016)
https://news.ycombinator.com/item?id=11611867
Ask HN: Freelancer? Seeking freelancer? (May 2016)
https://news.ycombinator.com/item?id=11611868
Ask HN: Who wants to be hired? (May 2016)
https://news.ycombinator.com/item?id=11611869
UnicodeEncodeError: 'charmap' codec can't encode character '\u200a' in position 14: character maps to <undefined>
windows 7, using cmd and python 3.5
while browsing comments, when reaching an unsupported character the entire screen fills up with a trace of the error
$ hn view foo
Traceback (most recent call last):
File "/Users/donnemartin/.virtualenvs/haxor/bin/hn", line 9, in <module>
load_entry_point('hncli==0.2.0', 'console_scripts', 'hn')()
File "/Users/donnemartin/Dev/github/sources/haxor-news/hncli/main_cli.py", line 34, in cli
hncli.cli()
File "/Users/donnemartin/.virtualenvs/haxor/lib/python3.4/site-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/Users/donnemartin/.virtualenvs/haxor/lib/python3.4/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/Users/donnemartin/.virtualenvs/haxor/lib/python3.4/site-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/donnemartin/.virtualenvs/haxor/lib/python3.4/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/donnemartin/.virtualenvs/haxor/lib/python3.4/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/Users/donnemartin/.virtualenvs/haxor/lib/python3.4/site-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "/Users/donnemartin/.virtualenvs/haxor/lib/python3.4/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/Users/donnemartin/Dev/github/sources/haxor-news/hncli/hacker_news_cli.py", line 358, in view
hacker_news.view_setup(int(index),
ValueError: invalid literal for int() with base 10: 'foo'
In corporate environments it's a common practice to have a proxy that mangles ssl certificates, so we have to ignore certificate verification in pip, curl, wget, git, etc.
$ hn top
Traceback (most recent call last):
...
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)
Please allow disabling certificate verification? (i.e. passing verify=False
to requests
methods)
I was attempting to make a contribution to Haxor-News by adding these missing filters/list types, but it seems as though the public Firebase API does not include them.
classic
mode, which filters story results so that only submitted stories by longstanding members are present: https://news.ycombinator.com/classicbestcomments
filter, which aggregates highest voted recent comments: https://news.ycombinator.com/bestcommentsactive
filter, which aggregates the most active current discussions: https://news.ycombinator.com/activebest
filter, which simply lists the highest voted recent links: https://news.ycombinator.com/bestI believe the only way to add these in would be to manually parse the HTML of those pages to extract out JSON structures that could be parsed by the existing implementation, which is quite the departure from the current spirit of the codebase.
Is there any interest in this, or would it simply add more complexity than it's actual worth?
Ask HN: Who is hiring? (June 2016)
https://news.ycombinator.com/item?id=11814828
Ask HN: Freelancer? Seeking freelancer? (June 2016)
https://news.ycombinator.com/item?id=11814829
Ask HN: Who wants to be hired? (June 2016)
https://news.ycombinator.com/item?id=11814830
Older versions of Python can cause the following warnings.
C:\Users\foo\Envs\haxor\lib\site-packages\requests\packages\urllib3\util\ssl_.py:315:
SNIMissingWarning: An HTTPS request has been made,
but the SNI (Subject Name Indication) extension to TLS is not available on this platform.
This may cause the server to present an incorrect TLS certificate,
which can cause validation failures. For more information, see
https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
SNIMissingWarning
C:\Users\foo\Envs\haxor\lib\site-packages\requests\packages\urllib3\util\ssl_.py:120:
InsecurePlatformWarning: A true SSLContext object is not available.
This prevents urllib3 from configuring SSL appropriately and may cause
certain SSL connections to fail. For more information, see
https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
One solution is to upgrade to a more recent version of Python.
If you are not able to upgrade Python, check out the following Stack Overflow links to install additional libraries to fix this issue:
I think that this is more an observation than an issue as such.
I installed haxor-news, on a Windows 10 machine, and the installation process was seamless, but when I tried to launch it, it constantly keeps telling me that it "failed to create process
".
After a while, and reading a couple of blogs, and stackoverflow articles, I came to the realization/discovery that the root of my problem was that my username contains an empty space (that is "Antonio Gil") and for some reason, that I don't fully understand, that little details was causing the issue.
The fix? I just changed the first line of both scipts (haxor-news-script.py
and hn-script.py
) from:
#!c:\users\antonio gil\appdata\local\programs\python\python35\python.exe
to
#!"c:\users\antonio gil\appdata\local\programs\python\python35\python.exe"
And that was all to get haxor-news work as expected.
Probably it was just a "newbie error" (never use python, or pip before), but I guess that it should be great to consider that detail.
Best regards!
haxor-news
v0.4.0, running prompt-toolkit
v1.0.0:
https://github.com/donnemartin/haxor-news/releases/tag/0.4.0
Windows 10
Python 3.5.1
$ haxor-news # start the shell
$ hn view 1 # works the first time
$ hn view 1 # second time*
*Hangs for awhile but eventually comes back, attempting to type hn view 1 -c
.
Previous version of prompt-toolkit
0.52 doesn't have the same issue.
➜ ~ pip install haxor-news
Collecting haxor-news
Collecting prompt-toolkit==0.52 (from haxor-news)
Using cached prompt_toolkit-0.52-py2-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): colorama>=0.3.3 in /Library/Python/2.7/site-packages (from haxor-news)
Requirement already satisfied (use --upgrade to upgrade): requests>=2.4.3 in /Library/Python/2.7/site-packages (from haxor-news)
Requirement already satisfied (use --upgrade to upgrade): pygments>=2.0.2 in /Library/Python/2.7/site-packages (from haxor-news)
Collecting six>=1.9.0 (from haxor-news)
Using cached six-1.10.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): click>=5.1 in /Library/Python/2.7/site-packages (from haxor-news)
Collecting wcwidth (from prompt-toolkit==0.52->haxor-news)
Using cached wcwidth-0.1.6-py2.py3-none-any.whl
Installing collected packages: six, wcwidth, prompt-toolkit, haxor-news
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 736, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 742, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/var/folders/n9/_fh0q6555sb_djs4_l70t1y80000gn/T/pip-A9Ynf3-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
➜ ~
pip install --ignore-installed six
https://hub.docker.com/search/?isAutomated=0&isOfficial=0&page=1&pullCount=0&q=haxornews&starCount=0
docker run sthysel/docker-haxornews
Version: 0.3.1
Syntax: hn <command> [params] [options]
Traceback (most recent call last):
File "/usr/local/bin/haxor-news", line 9, in <module>
load_entry_point('haxor-news==0.3.1', 'console_scripts', 'haxor-news')()
File "/usr/local/lib/python3.5/site-packages/haxor_news/main.py", line 26, in cli
haxor.run_cli()
File "/usr/local/lib/python3.5/site-packages/haxor_news/haxor.py", line 205, in run_cli
document = self.cli.run()
File "/usr/local/lib/python3.5/site-packages/prompt_toolkit/interface.py", line 321, in run
with self.input.raw_mode():
File "/usr/local/lib/python3.5/site-packages/prompt_toolkit/input.py", line 65, in raw_mode
return raw_mode(self.stdin.fileno())
File "/usr/local/lib/python3.5/site-packages/prompt_toolkit/terminal/vt100_input.py", line 344, in __init__
self.attrs_before = termios.tcgetattr(fileno)
termios.error: (25, 'Inappropriate ioctl for device')
The dockerfile is exactly what I'd expect:
FROM python:3.5
MAINTAINER https://github.com/sthysel/docker-haxornews
RUN pip install haxor-news
CMD ["haxor-news"]
This should load the default color value instead.
When I try to change the color of items to none, in the first run it works fine then the next one it goes back to the default config.
Ask HN: Who is hiring? (April 2016)
https://news.ycombinator.com/item?id=11405239
Ask HN: Freelancer? Seeking freelancer? (April 2016)
https://news.ycombinator.com/item?id=11405240
Ask HN: Who wants to be hired? (April 2016)
https://news.ycombinator.com/item?id=11405241
Currently, we support:
Ask HN: Who is hiring?
Ask HN: Freelancer? Seeking freelancer?
Add support for:
Ask HN: Who wants to be hired?
Latest:
Ask HN: Who wants to be hired? (April 2016)
https://news.ycombinator.com/item?id=11405241
upvote could be nice like hn upvote 10
! I assume that this would require to login first.
Thanks for the great job.
Ask HN: Who is hiring? (July 2016)
https://news.ycombinator.com/item?id=TBD
Ask HN: Freelancer? Seeking freelancer? (July 2016)
https://news.ycombinator.com/item?id=TBD
Ask HN: Who wants to be hired? (July 2016)
https://news.ycombinator.com/item?id=TBD
If anyone wants to contribute on a bite-sized issue, feel free to submit a pull request for next month's set of hiring post ids.
Check out these PRs as a reference:
"Ask HN: Who wants to be hired?" isn't hooked up yet.
If you run the auto-completer, comments are automatically sent to a pager.
$ haxor-news
To get the same effect if you run without the auto-completer, you'll need to pipe less -r
:
$ hn view 1 -c | less -r
Currently, we're using less
, which is not available on Windows and results in an exception.
We're still using prompt-toolkit 0.52 due to #62, which has now been fixed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.