Code Monkey home page Code Monkey logo

haxor-news's People

Contributors

aviddiviner avatar cyblue9 avatar donnemartin avatar dtzwill avatar jashgala avatar raghav-ys avatar readmecritic avatar thatlurker avatar thoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

haxor-news's Issues

Command to view next [#] posts

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.

Update latest monthly hiring post ids (July 2016)

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.

[feature request] Sharing posts, TTS

  • It would be nice to be able to tweet one post (link and description) directly from the cli.
  • Or, alternatively, be able to copy one post link (and the description, if wanted) to the clipboard directly from the cli as well.
  • I think a text-to-speech integration would be great!

Improve pager support for hn view of a post's linked contents on Windows

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.

Need to sanitize comments

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

Firebase API does not expose several "hidden" filters/lists of data.

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.

  1. The so-called classic mode, which filters story results so that only submitted stories by longstanding members are present: https://news.ycombinator.com/classic
  2. The bestcomments filter, which aggregates highest voted recent comments: https://news.ycombinator.com/bestcomments
  3. The active filter, which aggregates the most active current discussions: https://news.ycombinator.com/active
  4. The best filter, which simply lists the highest voted recent links: https://news.ycombinator.com/best

I 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?

Use of urllib is not compatible with Python2

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

SNI Missing warning

/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.

Windows hn view of a post's linked contents often results in encoding errors

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:

  • Remove pager functionality for Windows through click.echo_via_pager
    • Update README Windows section to let users know they can manually send the output to a pager, ie with | more
  • Further investigate a fix for click.echo_via_pager or determine a suitable replacement (see #16)

Update latest monthly hiring post ids (November 2016)

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.

Update latest monthly hiring post ids (October 2016)

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.

Update latest monthly hiring post ids (August 2016)

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.

FR: please make list of posts and comments browsable

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.

Command for exiting 'haxor' terminal

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.

Update latest monthly hiring post ids (September 2016)

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.

prompt-toolkit v1.0.0 hangs autocompleting hn view command while running Windows

Build

haxor-news v0.4.0, running prompt-toolkit v1.0.0:

https://github.com/donnemartin/haxor-news/releases/tag/0.4.0

Environment

Windows 10
Python 3.5.1

Steps to reproduce

 $ 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.

prompt-toolkit issue

prompt-toolkit/python-prompt-toolkit#308

Python 2.7.6 compat issues with parser.read_file and convert_charrefs=False

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

urllib3\util\ssl_.py: SNIMissingWarning, InsecurePlatformWarning

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:

Extending it to other sites

Wouldn't it be great if we can build an extension of the same where we can add other sites(like gizmodo,THN etc)?

Allow to ignore certificate verification

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)

Error 'failed to create process' when user profile folder contains a blank space

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!

Share link to interesting article

  1. Share good stories. Enhancement - share link by email
  2. Send to mobile. Enhacenement - use pushbullet api to push link to user's phone
  3. Send to Text-to-Speech reader on android - I use " @voice " on my android to have HN articles read to me while I drive. Can we push article links using pushbullet api to your phone and to your TTS app?

Release 0.4.1 on GitHub and PyPI

Changelog

0.4.1 (2016-05-30)

Bug Fixes

  • #62 - Fix 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.

0.4.0 (2016-05-30)

Features

  • #52 - Add exit and quit commands, which can be used instead of ctrl-d.
  • #53 - Allow clicking of urls in some terminals to open in a browser.

Bug Fixes

  • #36 - Fix crash caused by Unicode comments on Windows.
  • #59 - Update to prompt-toolkit 1.0.0, which includes a number of performance improvements (especially noticeable on Windows) and bug fixes.
  • Fix some comments and docstrings.

Updates

  • #48, #50 - Update latest monthly hiring post ids.
  • #56 - Update packaging dependencies based on semantic versioning.
  • Fix Config docstrings.
  • Update README:
    • Update intro
    • Add Hacker News discussion of haxor-news
    • Update comments discussion and examples
    • Update TODO
    • Fix urls based on redirects
    • Remove buggy Codecov graph
    • Add note about OS X 10.11 pip installation issue
  • Add Gemnasium dependencies management.
  • Update links in CONTRIBUTING.

0.3.1 (2016-04-10)

  • Initial release.

Feature request - upvote

upvote could be nice like hn upvote 10! I assume that this would require to login first.

Thanks for the great job.

View command exception if passed a non-integer post index

$ 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'

Six issue when installing package on OS X 10.11 El Capitan

I. when I try and pip install I get this error:

➜  ~ 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'
➜  ~

II. this points to a solution, but does not work: http://stackoverflow.com/questions/31900008/oserror-errno-1-operation-not-permitted-when-installing-scrapy-in-osx-10-11

pip install --ignore-installed six

III. so then I tried to build from a docker container I found here, but it outputs:

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"]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.