<commit_before>haxor
=====

Unofficial Python wrapper for official Hacker News API.

Installation
------------

::

    pip install haxor

Usage
-----

import and initialization:

::

    from hackernews import HackerNews
    hn = HackerNews()

Get certain user info by user id (i.e. username on Hacker News)

::

    user = hn.get_user('pg')
    # >>> user.user_id
    # pg
    # >>> user.karma
    # 155040

Stories, comments, jobs, Ask HNs and even polls are just items and they
have unique item id. To get info of an item by item id:

::

    item = hn.get_item(8863)
    # >>> item.title
    # "My YC app: Dropbox - Throw away your USB drive"
    # >>> item.type
    # story
    # >>> item.kids
    # [ 8952, 9224, 8917, ...]

To get item ids of current top stories:

::

    top_story_ids = hn.top_stories()
    # >>> top_story_ids
    # [8432709, 8432616, 8433237, ...]

To get current largest item id:

::

    max_item = hn.get_max_item()
    # >>> max_item
    # 8433746

Examples
--------

Getting top 10 stories: 

::

    for story in hn.top_stories(limit=10):
        print hn.get_item(story)

    # 8432709: Redis cluster, no longer vaporware
    # 8432423: Fluid Actuators from Disney Research Make Soft, Safe Robot Arms
    # 8433237: Is Capturing Carbon from the Air Practical?
    # ...
    # ...


Find Python jobs from monthly who is hiring thread:

::

    # Who is hiring
    # https://news.ycombinator.com/item?id=8422599

    who_is_hiring = hn.get_item(8394339)

    for comment_id in who_is_hiring.kids:
        comment = hn.get_item(comment_id)
        if 'python' in comment.text.lower():
            print comment.item_id

    # 8395568
    # 8394964
    # ...
    # ...
<commit_msg>fixed wrong id in python jobs examples<commit_after>haxor
=====

Unofficial Python wrapper for official Hacker News API.

Installation
------------

::

    pip install haxor

Usage
-----

import and initialization:

::

    from hackernews import HackerNews
    hn = HackerNews()

Get certain user info by user id (i.e. username on Hacker News)

::

    user = hn.get_user('pg')
    # >>> user.user_id
    # pg
    # >>> user.karma
    # 155040

Stories, comments, jobs, Ask HNs and even polls are just items and they
have unique item id. To get info of an item by item id:

::

    item = hn.get_item(8863)
    # >>> item.title
    # "My YC app: Dropbox - Throw away your USB drive"
    # >>> item.type
    # story
    # >>> item.kids
    # [ 8952, 9224, 8917, ...]

To get item ids of current top stories:

::

    top_story_ids = hn.top_stories()
    # >>> top_story_ids
    # [8432709, 8432616, 8433237, ...]

To get current largest item id:

::

    max_item = hn.get_max_item()
    # >>> max_item
    # 8433746

Examples
--------

Getting top 10 stories: 

::

    for story in hn.top_stories(limit=10):
        print hn.get_item(story)

    # 8432709: Redis cluster, no longer vaporware
    # 8432423: Fluid Actuators from Disney Research Make Soft, Safe Robot Arms
    # 8433237: Is Capturing Carbon from the Air Practical?
    # ...
    # ...


Find Python jobs from monthly who is hiring thread:

::

    # Who is hiring
    # https://news.ycombinator.com/item?id=8394339

    who_is_hiring = hn.get_item(8394339)

    for comment_id in who_is_hiring.kids:
        comment = hn.get_item(comment_id)
        if 'python' in comment.text.lower():
            print comment.item_id

    # 8395568
    # 8394964
    # ...
    # ...

{'fraction_non_alphanumeric': 0.12054476963199073, 'fraction_numerical': 0.0596928426543031, 'mean_word_length': 2.3482056256062074, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 45, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6756633', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1184, 'n_words': 354}