diff --git a/hn.py b/hn.py index 80b0e3d..fd3cfda 100644 --- a/hn.py +++ b/hn.py @@ -22,7 +22,7 @@ def main(stdscr): r = requests.get(url) if not r.ok: raise Exception('Error fetching data from Hacker News API') - ids = r.json()[:10] # Show only the first ten stories + ids = r.json()[:15] # Show only the first ten stories stories = [] for i in ids: story_url = f'https://hacker-news.firebaseio.com/v0/item/{i}.json' @@ -39,8 +39,11 @@ def main(stdscr): stdscr.addstr('\n\nHacker News Top Stories:\n') for i, story in enumerate(stories): prefix = '>>> ' if i == current_pos else ' ' - text = f'{prefix}{i+1}: {story.title} ({story.link})\n' + text = f'{prefix}{story.title} ({story.link})\n' stdscr.addstr(text) + if i == current_pos: + detail = f' by {story.author} | {story.votes} points\n' + stdscr.addstr(detail) stdscr.refresh() c = stdscr.getch()