In [2]:
from __future__ import print_function

In [3]:
from hackernews import HackerNews
hn = HackerNews()

In [29]:
show_hn_ids = hn.show_stories()
print(len(show_hn_ids), "total Show HN ids")
# 
show_hn_stories = []
for sid in show_hn_ids:
     show_hn_stories.append(hn.get_item(sid))


60 total Show HN ids
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-29-286fef4b5a31> in <module>()
      6      show_hn_stories.append(hn.get_item(sid))
      7 
----> 8 show_hn_github_repos = [story for story in stories if 'github.com' in story.url]
      9 print(len(show_hn_github_repos), "Show HN stories from github")
     10 

NameError: name 'stories' is not defined

In [31]:
show_hn_github_repos = [item for item in show_hn_stories 
                       if item.url is not None
                       and 'github.com' in item.url 
                       and 'gist' not in item.url]
print(len(show_hn_github_repos), "Show HN stories from github")
 
print('\n'.join([item.title for item in show_hn_github_repos 
        if item in hn_github_repos]))


18 Show HN stories from github


In [5]:
new_hn_ids = hn.new_stories()
print(len(new_hn_ids), "total HN ids")

all_hn_items = []
for sid in new_hn_ids:
    all_hn_items.append(hn.get_item(sid))


500 total HN ids
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-5-1a1dd72a783c> in <module>()
      6     all_hn_items.append(hn.get_item(sid))
      7 
----> 8 hn_github_repos = [story for story in stories if 'github.com' in story.url]
      9 print(len(hn_github_repos), "HN stories from github")

NameError: name 'stories' is not defined

In [22]:
hn_github_repos = [item for item in all_hn_items 
                   if item.url is not None
                   and 'github.com' in item.url 
                   and 'gist' not in item.url]

In [24]:
print(len(hn_github_repos), "total github repos", '\n')

print('\n\n'.join
      (
        item.title+'\n'+item.url 
        for item in hn_github_repos
      )
     )


40 total github repos 

Clojure Katas Inspired by Alice in Wonderland
https://github.com/gigasquid/wonderland-clojure-katas

Hyperminimal JavaScript dependency injection framework
https://github.com/derhuerst/flacon

Comprehensive Sudoers Management with Ansible
https://github.com/wtcross/ansible-sudoers

Desktopen – a CLI util to open and position X windows
https://github.com/snitko/desktopen

Additional sorting algorithms for C++14
https://github.com/Morwenn/cpp-sort

Picrin – a lightweight R7RS scheme implementation in pure C89
https://github.com/picrin-scheme/picrin

Optimize Node.js code execution and detect memory leaks
https://github.com/s-a/iron-node/blob/master/docs/PROFILE.md

RIVR – The world's first open source torrents search engine
https://github.com/algoprog/rivr-search

Micro: ES7 HTTP microservices
https://github.com/zeithq/micro

Show HN: My kids' nightlight powered by Node.js, Philips Hue and Dash buttons
https://github.com/ecaron/hue-website-nightlights/

Directory tags for lazy programmers
https://github.com/joowani/dtags

Mircosoft FFmpegInterop library for Windows
https://github.com/Microsoft/FFmpegInterop

Python module to generate regular all expression matches
https://github.com/google/sre_yield

Show HN: Awesome scripts that make WhatsApp Web better
https://github.com/zweicoder/AwesomeScripts/tree/master/WhatsApp

Express Applies to Become a Node “Top Level Project”
https://github.com/nodejs/TSC/pull/39

Blazing fast Apple TV application development using pure JavaScript
https://github.com/emadalam/atvjs

UPB – small, fast parsers for the 21st century
https://github.com/google/upb

Show HN: A Ruby Gem for getting volume and the bounding box from an STL file
https://github.com/chiedolabs/stl_parser

Awesome Public Datasets Ranging from Finance to Geology
https://github.com/caesar0301/awesome-public-datasets

Java bindings for Brotli: a new compression algorithm for the internet
https://github.com/meteogroup/jbrotli

Show HN: Openblog – Blogging with GitHub Issues
https://github.com/mateogianolio/openblog

Google Open Source Load Balancer in Go
https://github.com/google/seesaw

Curvilinear: an insanely small (2KB), unopinionated alternative to React
https://github.com/pags/curvilinear

Tcl.js: robust, high-performance Tcl in JavaScript
https://github.com/cyanogilvie/Tcl.js

Rereduce: reducer library for Redux
https://github.com/slorber/rereduce

Peersuasive/luce: Luce – A GUI Module for Lua Based on JUCE
https://github.com/peersuasive/luce

Jade, Node.js template engine, is being forced to rename due to trademark
https://github.com/pugjs/jade/issues/2184

Furnish JavaScript - Let the classes on DOM elements generate the CSS for you
https://github.com/Idnan/furnish-js

What the Classics Know of Blue
https://github.com/emdaniels/what-the-classics-know-of-blue

Parse Alternatives
https://github.com/relatedcode/ParseAlternatives

Redux-devtools-chart-monitor: A chart monitor for Redux DevTools
https://github.com/romseguy/redux-devtools-chart-monitor

Show HN: Introductory book about writing webapps with Go
http://github.com/thewhitetulip/web-dev-golang-anti-textbook

Show HN: A simple todo list manager
http://github.com/thewhitetulip/Tasks

Material, a Graphics Framework for Material Design in Swift
https://github.com/CosmicMind/Material

Show HN: ES2015 method polymorphism
https://github.com/dosaygo/open-0/blob/master/decorators-and-type-checking-js/README.md

Automagically sets trending, good images on Reddit as desktop wallpapers
https://github.com/yask123/RedditWallpapers

Learn X in Y minutes as a single PDF
https://github.com/aviaryan/learnxinyminutes-pdf

Show HN: KISS Literate Programming
https://github.com/fibo/kiss-literate-programming/blob/master/README.md#kiss-literate-programming

Space Shooter in QBasic
https://github.com/strathausen/qtrek.bas

Reasonably secure pair programming
https://github.com/goerz/tmuxpair#reasonably-secure-pair-programming

In [25]:
dir(hn_github_repos[1])


Out[25]:
['__class__',
 '__delattr__',
 '__dict__',
 '__doc__',
 '__format__',
 '__getattribute__',
 '__hash__',
 '__init__',
 '__module__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__setattr__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 '__weakref__',
 'by',
 'dead',
 'deleted',
 'item_id',
 'item_type',
 'kids',
 'parent',
 'parts',
 'raw',
 'score',
 'submission_time',
 'text',
 'title',
 'url']

In [34]:
a = hn_github_repos[1]
b = show_hn_github_repos[1]
x = a
print(x.item_id, 
      x.item_type, 
      x.parts, 
      x.raw, 
      x.score, 
      x.submission_time, 
      x.text, 
      x.title, 
      x.url, 
      sep='\n')


11004238
story
None
{"title": "Hyperminimal JavaScript dependency injection framework", "url": "https://github.com/derhuerst/flacon", "descendants": 0, "by": "derhuerst", "score": 1, "time": 1454195493, "type": "story", "id": 11004238}
1
2016-01-30 15:11:33
None
Hyperminimal JavaScript dependency injection framework
https://github.com/derhuerst/flacon

In [ ]: