From d43389b20aa741c91e77695025d8a503fa264b43 Mon Sep 17 00:00:00 2001 From: Felix Pankratz Date: Tue, 29 Aug 2023 15:14:38 +0200 Subject: [PATCH] fixes --- hn.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hn.py b/hn.py index 10c5eae..c75eb6c 100755 --- a/hn.py +++ b/hn.py @@ -32,15 +32,15 @@ def main(stdscr): height, width = stdscr.getmaxyx() num_stories = curses.LINES - 3 # headline, detail, footer # Query Hacker News API for top stories and their titles/links + # returns the top 500 stories, so quite enough. url = 'https://hacker-news.firebaseio.com/v0/topstories.json' r = requests.get(url) if not r.ok: raise Exception('Error fetching data from Hacker News API') - ids = r.json()[:num_stories] + ids = r.json() stories = [] - for idx, i in enumerate(ids): + for idx, i in enumerate(ids[:num_stories]): stdscr.clear() - #stdscr.addstr(f'[{spinner_states[idx%4]}] Getting stories...') footer(stdscr, f'[{spinner_states[idx%4]}] Getting stories...') stdscr.refresh() story_url = f'https://hacker-news.firebaseio.com/v0/item/{i}.json'