Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ def api_feed():
feed_type=feed_type
)

encoded_url = urllib.parse.quote(url, safe="")
selected_feed = f"{base_url}/feed/{feed_type}/{encoded_url}"

discord_result = None
discord_webhook_url = data.get('discord_webhook_url', '').strip()
if discord_webhook_url:
Expand All @@ -84,6 +87,8 @@ def api_feed():

return Response(json.dumps({
'youtube_rss': youtube_rss,
'selected_feed': selected_feed,
'feed_type': feed_type,
'channel_id': channel_id,
'channel_name': channel_name,
'atom_feed': atom_feed,
Expand Down
6 changes: 3 additions & 3 deletions api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ <h1>YouTube RSS Scanner</h1>
html += '<p><strong>Channel ID:</strong> ' + data.channel_id + '</p>';
html += '</div>';

html += '<div class="feed-row"><div class="feed-label">YouTube RSS:</div>';
html += '<div class="feed-link">' + data.youtube_rss + '</div>';
html += '<button class="copy-btn" onclick="copyEncodedText(\'' + encodeURIComponent(data.youtube_rss) + '\')">Copy YouTube RSS</button></div>';
html += '<div class="feed-row"><div class="feed-label">Selected RSS Feed:</div>';
html += '<div class="feed-link">' + (data.selected_feed || data.youtube_rss) + '</div>';
html += '<button class="copy-btn" onclick="copyEncodedText(\'' + encodeURIComponent((data.selected_feed || data.youtube_rss)) + '\')">Copy Selected RSS</button></div>';

if (data.api_endpoints && Object.keys(data.api_endpoints).length > 0) {
html += '<div class="atom-output"><div class="feed-label">API Endpoints:</div>';
Expand Down
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,18 +245,18 @@ <h1>YouTube RSS Scanner</h1>

const feedLabel = document.createElement('div');
feedLabel.className = 'feed-label';
feedLabel.textContent = 'YouTube RSS:';
feedLabel.textContent = 'Selected RSS Feed:';
feedRow.appendChild(feedLabel);

const feedLink = document.createElement('div');
feedLink.className = 'feed-link';
feedLink.textContent = data.youtube_rss;
feedLink.textContent = (data.selected_feed || data.youtube_rss);
feedRow.appendChild(feedLink);

const copyBtn = document.createElement('button');
copyBtn.className = 'copy-btn';
copyBtn.textContent = 'Copy YouTube RSS';
copyBtn.addEventListener('click', () => copyText(data.youtube_rss));
copyBtn.textContent = 'Copy Selected RSS';
copyBtn.addEventListener('click', () => copyText((data.selected_feed || data.youtube_rss)));
feedRow.appendChild(copyBtn);
resultDiv.appendChild(feedRow);

Expand Down
4 changes: 2 additions & 2 deletions rss_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ def get_rss_feed(url: str, include_api_endpoints: bool = False, base_url: str =
"""
channel_id, channel_name = extract_channel_id(url)

# 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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 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}`.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.


# Try to get videos from the selected YouTube channel page
videos = get_channel_videos(channel_id, feed_type=feed_type)
Expand Down
6 changes: 3 additions & 3 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ <h1>YouTube RSS Scanner</h1>
html += '<p><strong>Channel ID:</strong> ' + data.channel_id + '</p>';
html += '</div>';

html += '<div class="feed-row"><div class="feed-label">YouTube RSS:</div>';
html += '<div class="feed-link">' + data.youtube_rss + '</div>';
html += '<button class="copy-btn" data-encoded="' + encodeURIComponent(data.youtube_rss) + '">Copy YouTube RSS</button></div>';
html += '<div class="feed-row"><div class="feed-label">Selected RSS Feed:</div>';
html += '<div class="feed-link">' + (data.selected_feed || data.youtube_rss) + '</div>';
html += '<button class="copy-btn" data-encoded="' + encodeURIComponent((data.selected_feed || data.youtube_rss)) + '">Copy Selected RSS</button></div>';

if (data.api_endpoints && Object.keys(data.api_endpoints).length > 0) {
html += '<div class="atom-output"><div class="feed-label">API Endpoints:</div>';
Expand Down