first commit
This commit is contained in:
47
todo.txt
47
todo.txt
@@ -1,47 +0,0 @@
|
|||||||
is there a way to add a bar for the topic, right now only search for tech news but if i
|
|
||||||
want videogames or cience, is it possible?
|
|
||||||
|
|
||||||
/btwis there a way to add a bar for the topic, right now only search for tech news but if i
|
|
||||||
want videogames or cience, is it possible?
|
|
||||||
|
|
||||||
Yes, totally possible. The Hacker News API has fixed categories (topstories, askstories,
|
|
||||||
etc.) but it's always tech-focused. To get other topics like videogames or science you'd
|
|
||||||
need to switch news sources.
|
|
||||||
|
|
||||||
The cleanest approach would be a source/category bar (similar to the tab bar already in the
|
|
||||||
app) where each entry points to a different RSS feed or API:
|
|
||||||
|
|
||||||
[ HN Tech ] [ Games ] [ Science ] [ Programming ] [ World ]
|
|
||||||
|
|
||||||
Good free sources that need no API key:
|
|
||||||
|
|
||||||
┌─────────────┬──────────────────────┬──────────┐
|
|
||||||
│ Category │ Source │ Type │
|
|
||||||
├─────────────┼──────────────────────┼──────────┤
|
|
||||||
│ Tech │ Hacker News API │ JSON API │
|
|
||||||
├─────────────┼──────────────────────┼──────────┤
|
|
||||||
│ Games │ Reddit r/gaming │ RSS feed │
|
|
||||||
├─────────────┼──────────────────────┼──────────┤
|
|
||||||
│ Science │ Reddit r/science │ RSS feed │
|
|
||||||
├─────────────┼──────────────────────┼──────────┤
|
|
||||||
│ Programming │ Reddit r/programming │ RSS feed │
|
|
||||||
├─────────────┼──────────────────────┼──────────┤
|
|
||||||
│ General │ BBC News │ RSS feed │
|
|
||||||
├─────────────┼──────────────────────┼──────────┤
|
|
||||||
│ Science │ NASA │ RSS feed │
|
|
||||||
└─────────────┴──────────────────────┴──────────┘
|
|
||||||
|
|
||||||
Reddit RSS feeds are simply https://www.reddit.com/r/gaming.rss — they return XML with
|
|
||||||
title, URL, score, and author, very similar to what the app already displays.
|
|
||||||
|
|
||||||
The main work to implement it:
|
|
||||||
|
|
||||||
1. Add an rss or quick-xml crate to parse XML feeds
|
|
||||||
2. Define a Source enum with a URL per category
|
|
||||||
3. Add a horizontal source bar (like the current tab bar) at the top, navigated with ←/→ or
|
|
||||||
number keys
|
|
||||||
4. When you switch source, fetch and parse that feed instead of the HN API
|
|
||||||
5. The Story struct stays the same — just map RSS fields into it
|
|
||||||
|
|
||||||
The UI and content display code wouldn't need to change at all since everything downstream
|
|
||||||
just works with Vec<Story>.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user