Repository navigation
feat(fetcher): add *_trending batch — reddit / wikipedia / crypto / huggingface - #242
Conversation
…uggingface
Four sibling fetchers covering the "what's hot right now" axis across
distinct public APIs. All Safety::Safe (each host hardcoded; user input
is closed enums or numeric counts), all cached, all share the same
7-shape contract: LinkedTextBlock (default) / ImageLinkedList /
TextBlock / Text / MarkdownTextBlock / Entries / Bars.
reddit_trending — /r/popular.json site-wide listing, reuses the
existing reddit/client.rs + Post DTO; extends
common.rs to expose post_title / post_meta to
the new module.
wikipedia_trending — wikimedia.org pageview top API for the
previous UTC day, filters Main_Page / Special:
/ Wikipedia: / Portal: / File: / Category: /
Help: / Template: / Talk: namespaces;
per-article /page/summary lookup resolves the
thumbnail URL for ImageLinkedList.
crypto_trending — CoinGecko /search/trending; the response already
carries thumb URLs so ImageLinkedList needs no
N+1 fan-out. Rank-by-position bars
((MAX_COUNT - position).max(1)) avoid the
degenerate "score=0" tail of CoinGecko's own
score field.
huggingface_trending — HF Hub /api/{models|datasets|spaces}
?sort=trendingScore. Author avatar is
resolved per-author via /api/users then
/api/organizations fallback, dedup'd
in-loop so repeat authors don't fan out.
Ticks the candidate boxes on #67 (reddit_trending, wikipedia_trending),
#68 (crypto_trending), #64 (huggingface_trending).
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR adds four new trending fetchers (CoinGecko, Hugging Face Hub, Reddit, Wikimedia) that retrieve and render trending data across different platforms. Each fetcher supports configurable options, HTTP fetching with size/status limits, multi-shape rendering with optional thumbnail downloads, sample payloads, and comprehensive unit tests. ChangesTrending Fetchers Across Multiple Platforms
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #242 +/- ##
==========================================
- Coverage 95.71% 95.42% -0.30%
==========================================
Files 207 211 +4
Lines 55326 56895 +1569
==========================================
+ Hits 52958 54293 +1335
- Misses 2368 2602 +234
🚀 New features to boost your workflow:
|
Summary
Adds a
*_trendingbatch — four sibling fetchers covering the "what's hot right now" axis across distinct public APIs.reddit_trending/r/popular.jsonsite-wide listingreddit_*wikipedia_trendingwikipedia_*crypto_trending/search/trendingcrypto_*huggingface_trending/api/{models|datasets|spaces}?sort=trendingScorehuggingface_*(new)All four are
Safety::Safe(each host hardcoded; user input is closed enums or numeric counts), all cached, all share the same 7-shape contract:linked_text_block(default)image_linked_listtext_block/text/markdown_text_blockentriesbarsRejected shapes (
Ratio/NumberSeries/PointSeries/Image/Calendar/Heatmap/Badge/Timeline) carry no natural representation for a "snapshot list of items ranked by popularity" — see the spec discussion on the trending batch.Design notes
reddit_trendingplugs into the existingreddit/client.rs+PostDTO + thumbnail pipeline.common.rsexposespost_title/post_metato the new module so the renderer can build Text / Markdown / Bars without duplicating the formatting helpers.Main_Page, search, and meta namespaces (Special:/Wikipedia:/Portal:/File:/Category:/Help:/Template:/Talk:) so the list reads as real articles a reader would click.scorefield decays to zero for the lower half, which makeschart_barcollapse.rank_baruses(MAX_COUNT - position).max(1)instead so the chart stays informative across the full top-15./api/users/{author}then/api/organizations/{author}(HF puts both in the same namespace but separate API paths). In-loop dedup keeps a 20-row feed at ≤ N distinct lookups when one org ships multiple trending models in the same window.Test plan
cargo fmt --all -- --check— cleancargo clippy --all-targets -- -D warnings— cleancargo test— 2,609 tests pass (73 new across the four fetchers).splashboard/dashboard.tomlexercising each fetcher in two shapes (list_links+list_cards/chart_bar): list rendering, OSC 8 links, thumbnails, and number formatting all looked correct.Reference pages
After this lands and the docs site rebuilds, the new fetchers will appear at:
🤖 Generated with Claude Code
Summary by CodeRabbit