Get the top max_stories posts from HackerNews - https://news.ycombinator.com/
(max_stories: int = 10)
| 16 | |
| 17 | |
| 18 | def hackernews_top_stories(max_stories: int = 10) -> list[dict]: |
| 19 | """ |
| 20 | Get the top max_stories posts from HackerNews - https://news.ycombinator.com/ |
| 21 | """ |
| 22 | url = "https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty" |
| 23 | story_ids = httpx.get(url, timeout=10).json()[:max_stories] |
| 24 | return [get_hackernews_story(story_id) for story_id in story_ids] |
| 25 | |
| 26 | |
| 27 | def hackernews_top_stories_as_markdown(max_stories: int = 10) -> str: |
no test coverage detected