Fix RSS discovery for direct feed URLs and rel=self links#10
Conversation
DiscoverFeedURL now handles two additional cases: 1. When a URL already returns a feed content-type (application/rss+xml, application/atom+xml, or application/feed+json), return it directly instead of trying to parse HTML. 2. When HTML pages use rel="self" instead of rel="alternate" for their feed link tags, check both attributes. This fixes discovery for feeds like TechCrunch tag/category feeds which return XML directly and may use rel="self" links. Based on upstream PR #14 by @carlotran4 (Hyaxia/blogwatcher#14), adapted to our fork's patterns (context threading, testify, etc.). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/rss/rss.go`:
- Around line 95-101: The mime.ParseMediaType call currently ignores parse
errors; update the code around mime.ParseMediaType in internal/rss/rss.go so
that when err != nil you do not silently continue but instead handle it per
project rule — either log the parse error with the package's logger (including
context like the contentType and candidate blogURL) or propagate the error to
the caller (adjust the function signature/returns if needed). Keep the existing
mediaType checks (application/rss+xml, application/atom+xml,
application/feed+json) unchanged when err == nil; only add explicit error
handling for the ParseMediaType error path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: fbc279ac-b94f-4ce6-a7bf-8a65b911f7ed
📒 Files selected for processing (2)
internal/rss/rss.gointernal/rss/rss_test.go
Summary
application/rss+xml,application/atom+xml,application/feed+json),DiscoverFeedURLnow returns it directly instead of trying to parse HTMLrel="self"link tags in addition torel="alternate", since some feeds (e.g. TechCrunch tag feeds) use self-referencing linksCredit
Based on upstream Hyaxia/blogwatcher#14 by @carlotran4, adapted to our fork's patterns (context threading, testify, error handling in tests, etc.).
Test plan
TestDiscoverFeedURL_XMLContentType- verifies direct feed URL return for RSS content-typeTestDiscoverFeedURL_RelSelf- verifies discovery viarel="self"link tagsgolangci-lint runreports 0 issues🤖 Generated with Claude Code
Summary by CodeRabbit