master
Felix Pankratz 1 year ago
parent 1a5ac7bb5a
commit d43389b20a

@ -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'

Loading…
Cancel
Save