|
|
|
@ -22,7 +22,6 @@ def get_topstories():
|
|
|
|
|
return r.json()
|
|
|
|
|
|
|
|
|
|
async def get_story(session, story_id):
|
|
|
|
|
#story_url = f'https://hacker-news.firebaseio.com/v0/item/{story_id}.json'
|
|
|
|
|
async with session.get(f'https://hacker-news.firebaseio.com/v0/item/{story_id}.json') as resp:
|
|
|
|
|
s = await resp.json() #requests.get(story_url).json()
|
|
|
|
|
return Story(s['id'],
|
|
|
|
@ -30,7 +29,7 @@ async def get_story(session, story_id):
|
|
|
|
|
s['url'] if 'url' in s else 'No URL',
|
|
|
|
|
s['by'],
|
|
|
|
|
s['score'],
|
|
|
|
|
len(s['kids']) if 'kids' in s else 0, False)
|
|
|
|
|
s['descendants'] if 'descendants' in s else 0, False)
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
ts = get_topstories()
|
|
|
|
|