Created
July 28, 2015 01:04
-
-
Save bsnux/95117a92b5f5884b1de5 to your computer and use it in GitHub Desktop.
Getting recent Hacker News stories about Python and Django
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https = require 'https' | |
url = 'https://hacker-news.firebaseio.com/v0/topstories.json' | |
base_item_url = 'https://hacker-news.firebaseio.com/v0/item/' | |
pattern = /python|django/i | |
https.get url, (res) -> | |
res.on 'data', (codes) -> | |
for code in JSON.parse(codes) | |
item_url = base_item_url + code + '.json' | |
https.get item_url, (res_item) -> | |
res_item.on 'data', (story_res) -> | |
story = JSON.parse(story_res) | |
console.log story.title + '\t' + story.url if story.title.match(pattern) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment