Add selectable feed types (all/videos/shorts/live) to API, UI, and RSS scanner#24
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe PR refines feed type selection by constructing a backend ChangesSelected Feed URL Display
Sequence DiagramsequenceDiagram
participant User
participant Frontend
participant API
participant Scanner
User->>Frontend: Select feed type and submit
Frontend->>API: POST /api/feed with feed_type
API->>Scanner: get_rss_feed(channel_id, feed_type)
Scanner->>Scanner: build_youtube_feed_url(channel_id, feed_type)
Scanner-->>API: youtube_rss (with feed_type filter)
API->>API: Construct selected_feed URL with feed_type
API-->>Frontend: {selected_feed, youtube_rss, feed_type, ...}
Frontend->>User: Display "Selected RSS Feed" with selected_feed value
User->>Frontend: Copy Selected Feed
Frontend->>User: Copy selected_feed to clipboard
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
| # YouTube's native RSS URL (mostly broken but included for reference) | ||
| youtube_rss = YOUTUBE_RSS_TEMPLATE.format(channel_id=channel_id) | ||
| # YouTube RSS URL (supports hidden filtered variants for shorts/live) | ||
| youtube_rss = build_youtube_feed_url(channel_id, feed_type=feed_type) |
There was a problem hiding this comment.
🔴 Call to undefined function build_youtube_feed_url causes NameError on every request
The PR replaces YOUTUBE_RSS_TEMPLATE.format(channel_id=channel_id) with build_youtube_feed_url(channel_id, feed_type=feed_type), but build_youtube_feed_url is never defined anywhere in the codebase. This will raise a NameError every time get_rss_feed() is called, which breaks all functionality: the CLI tool (main()), the /api/feed endpoint (api/app.py:66), and the /feed/<feed_type>/<path:channel_url> endpoint (api/app.py:170).
Prompt for agents
The function `build_youtube_feed_url` is called at rss_scanner.py:302 but never defined. It was intended to replace the previous line `youtube_rss = YOUTUBE_RSS_TEMPLATE.format(channel_id=channel_id)` and add feed_type-aware URL building (e.g. for shorts/live filtered feeds). You need to either:
1. Define `build_youtube_feed_url(channel_id, feed_type)` in rss_scanner.py that returns the appropriate YouTube RSS feed URL based on the feed_type parameter, or
2. Revert to the old code `YOUTUBE_RSS_TEMPLATE.format(channel_id=channel_id)` if feed_type filtering of the YouTube RSS URL is not needed (since the custom atom feed generation already handles feed_type via `get_channel_videos`).
The YOUTUBE_RSS_TEMPLATE constant is defined at rss_scanner.py:25 as `https://www.youtube.com/feeds/videos.xml?channel_id={channel_id}`.
Was this helpful? React with 👍 or 👎 to provide feedback.
Motivation
Description
feed_typeparameter across the API and endpoints with accepted valuesall,videos,shorts, andlive, and validated inputs inapi/app.py(returned in responses asfeed_type)./feedroutes toGET /feed/<feed_type>/<channel_url>with usage helper and added cache key awareness for feed type by usingrequest.pathin the cache key, and updated API JSON to includeselected_feedURL.rss_scanner.pyto acceptfeed_type, addedbuild_youtube_feed_urland_extract_video_ids_from_pagehelpers, madeget_channel_videosrespectfeed_type(scrapes the appropriate channel page path), and updatedget_rss_feedto return feed-specificyoutube_rssand additionalapi_endpointsentries for each feed variant.index.html,/api/index.html, andtemplates/index.html) and README to add aFeed Typeselector, sendfeed_typewith API requests, and display/copy theSelected RSS Feedand additional endpoint links.Testing
POST /api/feedacceptsfeed_typeand returnsselected_feed, andGET /feed/<type>/<encoded_url>serves the generated Atom feed for the given type (manual checks succeeded).Codex Task
Summary by CodeRabbit