Created
July 16, 2013 22:18
-
-
Save Chris2048/6015687 to your computer and use it in GitHub Desktop.
getHN
This file contains 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
#!/usr/bin/python2.7 | |
import requests | |
def getItems(from_date, to_date): | |
api_root = 'http://api.thriftdb.com/api.hnsearch.com/items/_search' | |
url = api_root + '?filter[fields][create_ts]=[{}+TO+{}]'.format(from_date, to_date) | |
payload = { | |
'limit': 100, | |
'sortby': 'create_ts desc', | |
'filter[fields][title]': 'Show\ HN\*', | |
'filter[fields][type]': 'submission', | |
} | |
r = requests.get(url, params=payload) | |
print r.url | |
print r.json()['hits'] | |
for i in r.json()['results']: | |
print i['item']['title'] | |
getItems('2013-06-10T00:00:00Z', '2013-06-20T00:00:00Z') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment